Skip to content

Rebasing Funding Manager

Rahul Saxena edited this page Oct 26, 2023 · 5 revisions

File: RebasingFundingManager.sol

Things to know

  1. The RebasingFundingManager is a Module contract that also extends the ElasticReceiptToken(Upgradable) contract.
  2. The Elastic Receipt Token is a rebase token that continuously syncs the token supply with a supply target.
  3. 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.
  4. There exists a supply cap of 100_000_000e18 which ensures that the co-relation between the external tokens and internal bits remains correct. Post this point, there are no mathematical relationship guarantees.

Modifiers

1. validAddress

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.

View Functions

1. token

function token() public view returns (IERC20)
  1. IERC20:

This token will be used for the funding in the entire workflow managed by a particular orchestrator.

Return Data

  1. IERC20: {IERC20} IERC20 instance of the token used for payments and funding across the workflow.

Write Functions

1. init

function init(
        IOrchestrator orchestrator_,
        Metadata memory metadata,
        bytes memory configData
    ) external override(Module)

The function used to initialize the Rebasing Funding Manager.

Parameters

  1. IOrchestrator orchestrator_: {IOrchestrator} instance of the orchestrator that uses this rebasing funding manager.
  2. Metadata metadata: Metadata about the RebasingFundingManager module
  3. bytes configData: Custom data that is useful for the initialization of this module.

2. deposit

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().

Parameters

  1. uint amount: The amount of tokens to deposit

3. depositFor

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.

Parameters

  1. address to: The address to which the tokens need to be deposited
  2. uint amount: The amount of tokens to deposit

4. withdraw

function withdraw(uint amount) external;

This function burns internal bits equivalent to amount and transfers the (adjusted) amount of external tokens to the _msgSender().

Parameters:

  1. uint amount: The number of tokens that need to be withdrawn

5. withdrawTo

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.

Parameters:

  1. address to: Address to which the tokens are withdrawn to
  2. uint amount: Number of tokens that need to be withdrawn

6. transferOrchestratorToken

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.

Parameters

  1. address to: The address to which tokens will be transferred
  2. uint amount: The number of tokens to be transferred
Clone this wiki locally