Reserve
Last updated
Last updated
The Reserve contract provides historical lookups of a token balance increase during a target time range. As the Reserve contract transfers OUT tokens, the withdrawal accumulator is increased. When tokens are transferred IN new checkpoint can be created if checkpoint()
is called after transferring tokens. By using the reserve and withdrawal accumulators to create a new checkpoint, any contract or account can look up the balance increase of the reserve for a target time range. By calculating the total held tokens in a specific time range, contracts that require knowledge of captured interest during a draw period, can easily call into the Reserve and deterministically determine the newly acquired tokens for that time range.
Allows to initialize the contract during the deployment. Constructs Reserve with passed parameters.
Parameters:
Name | Type | Description |
---|---|---|
Create observation checkpoint in ring buffer. Calculates total deposited tokens since last checkpoint and creates a new accumulator checkpoint.
Transfer Reserve token balance to recipient address. Creates checkpoint before token transfer. Increments withdrawAccumulator
with amount.
Parameters:
Name | Type | Description |
---|---|---|
Allows the pendingOwner
address to claim the owner role. This function is only callable by the pendingOwner
.
Leaves the contract without owner. It will not be possible to call the owner's functions anymore. Can only be called by the current owner. The method does not take any parameters. Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.
Transfers ownership of the contract to a _pendingOwner
. Can only be called by the current owner.
Parameters:
Allows the owner to give the manager role to an address. The manager role has access to the functions with the modified onlyManager
or onlyManagerOrOwner
.
Parameters:
Calculate token accumulation between timestamp range. Search the ring buffer for two checkpoint observations and diffs accumulator amount.
Parameters:
Return:
Read global token value. It is the token that the reserve will accept.
Total withdrawal amount from reserve.
An account that is the owner of the contract. It has access to the functions that use the modified onlyOwner
.
Address that can claim the owner role. It is used to transfer the owner.
Manager role that can be granted exclusive access to specific functions with the modifier onlyManager
or onlyManagerOrOwner
.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
_owner
address
Address that will become the new owner of the contract.
_token
address
ERC20 address that will be used in the reserve.
_recipient
address
Account address.
_amount
uint256
Transfer amount.
_newOwner
address
An account that will become the _pendingOwner
.
_newManager
address
An account that will become the new manager.
_startTimestamp
uint32
Start timestamp.
_endTimestamp
uint32
End timestamp.
_amount
uint224
Accumulated between input timestamps.