-
Notifications
You must be signed in to change notification settings - Fork 24
Rebasing Funding Manager
File: RebasingFundingManager.sol
- The
RebasingFundingManager
is aModule
contract that also extends theElasticReceiptToken
(Upgradable) contract. - The Elastic Receipt Token is a rebase token that continuously syncs the token supply with a supply target.
- The downstream contract can mint and burn tokens to addresses with the assumption that the supply target changes precisely by the number of tokens minted/burned.
- There exists a supply cap of
100_000_000e18
which ensures that the co-relation between the externaltokens
and internalbits
remains correct. Post this point, there are no mathematical relationship guarantees.
modifier validAddress(address to)
This modifier checks if the given address is valid or not. The definition of valid is that the given address should neither be address(0)
nor the address of the RebasingFundingManager
itself.
function token() public view returns (IERC20)
- IERC20:
This token will be used for the funding in the entire workflow managed by a particular orchestrator.
- IERC20: {IERC20} IERC20 instance of the token used for payments and funding across the workflow.
function init(
IOrchestrator orchestrator_,
Metadata memory metadata,
bytes memory configData
) external override(Module)
The function used to initialize the Rebasing Funding Manager.
- IOrchestrator orchestrator_: {IOrchestrator} instance of the orchestrator that uses this rebasing funding manager.
- Metadata metadata: Metadata about the RebasingFundingManager module
- bytes configData: Custom data that is useful for the initialization of this module.
function deposit(uint amount) external;
This function is used to deposit amount
number of the orchestrator tokens into the Rebasing Funding Manager
by the _msgSender()
. An equivalent amount of internal bits are allocated to _msgSender()
.
- uint amount: The amount of tokens to deposit
function depositFor(address to, uint amount) external;
This function is used to deposit amount
number of the orchestrator tokens into the Rebasing Funding Manager
on behalf of address to
. An equivalent amount of internal bits are allocated to address to
.
- address to: The address to which the tokens need to be deposited
- uint amount: The amount of tokens to deposit
function withdraw(uint amount) external;
This function burns internal bits equivalent to amount
and transfers the (adjusted) amount
of external tokens to the _msgSender()
.
- uint amount: The number of tokens that need to be withdrawn
function withdrawTo(address to, uint amount) external;
This function burns internal bits equivalent to amount
and transfers the (adjusted) amount
of external tokens to the address to
.
- address to: Address to which the tokens are withdrawn to
- uint amount: Number of tokens that need to be withdrawn
function transferOrchestratorToken(address to, uint amount) external;
Transfer amount
number of orchestrator tokens to the address to
. This function is only callable by the orchestrator contract.
- address to: The address to which tokens will be transferred
- uint amount: The number of tokens to be transferred