FungibleToken.sol (ERC20 Token Contract):
- Use: Acts as a digital currency bank.
- Functionality: Keeps track of how much of a specific digital currency each person holds.
- Interaction: Other contracts interact with this contract to add or subtract the currency from individuals' accounts.
ContractA.sol:
- Use: Acts as a helper to transfer funds and create new funds.
- Functionality: Coordinates transactions to give currency to individuals and generate new currency simultaneously.
- Interaction: Communicates with the FungibleToken contract to deduct funds from one account and transfer them to another, and also communicates with ContractB to create new funds and add them to the FungibleToken contract.
ContractB.sol:
- Use: Generates new units of the digital currency (tokens).
- Functionality: Creates additional currency units and adds them to the FungibleToken contract's balance.
- Interaction: Receives requests from ContractA to generate new currency and contributes these newly generated funds to the FungibleToken contract, increasing the total available balance.
Interaction Sequence:
- You request ContractA to transfer funds and generate new funds.
- ContractA communicates with FungibleToken to transfer funds from one account to another.
- Concurrently, ContractA communicates with ContractB to generate new funds.
- ContractB creates new currency units and adds them to the FungibleToken contract.
- The overall process ensures that existing funds are transferred and new funds are created, and coordinated by ContractA and ContractB.
This interaction ensures a synchronized flow of existing and new funds, managed by the helper (ContractA) and the fund generator (ContractB), both contributing to the FungibleToken contract's balance.