Skip to content

Latest commit

 

History

History
415 lines (277 loc) · 8.53 KB

File metadata and controls

415 lines (277 loc) · 8.53 KB

Solidity API

IncomeVault

constructor

constructor(address forwarderIrrevocable) public

initialize

function initialize(address admin, contract IERC20 ERC20TokenPayment_, contract ICMTATSnapshot cmtat_token, contract IRuleEngine ruleEngine_, contract IAuthorizationEngine authorizationEngineIrrevocable, uint256 timeLimitToWithdraw_) public

@notice initialize the proxy contract The calls to this function will revert if the contract was deployed without a proxy

Parameters

Name Type Description
admin address Address of the contract (Access Control)
ERC20TokenPayment_ contract IERC20 ERC20 token to perform the payment
cmtat_token contract ICMTATSnapshot
ruleEngine_ contract IRuleEngine
authorizationEngineIrrevocable contract IAuthorizationEngine
timeLimitToWithdraw_ uint256

__IncomeVault_init

function __IncomeVault_init(address admin, contract IERC20 ERC20TokenPayment_, contract ICMTATSnapshot cmtat_token, contract IRuleEngine ruleEngine_, contract IAuthorizationEngine authorizationEngineIrrevocable, uint256 timeLimitToWithdraw_) internal

calls the different initialize functions from the different modules

_msgSender

function _msgSender() internal view returns (address sender)

This surcharge is not necessary if you do not use the MetaTxModule

_msgData

function _msgData() internal view returns (bytes)

This surcharge is not necessary if you do not use the MetaTxModule

_contextSuffixLength

function _contextSuffixLength() internal view returns (uint256)

IncomeVaultInternal

CMTAT_TOKEN

contract ICMTATSnapshot CMTAT_TOKEN

ERC20TokenPayment

contract IERC20 ERC20TokenPayment

claimedDividend

mapping(address => mapping(uint256 => bool)) claimedDividend

segregatedDividend

mapping(uint256 => uint256) segregatedDividend

segregatedClaim

mapping(uint256 => bool) segregatedClaim

timeLimitToWithdraw

uint256 timeLimitToWithdraw

_computeDividendBatch

function _computeDividendBatch(uint256 time, address[] tokenHolders, uint256[] tokenHoldersBalance, uint256 tokenTotalSupply) internal view returns (uint256[] tokenHolderDividend)

Parameters

Name Type Description
time uint256 dividend time
tokenHolders address[] addresses to compute dividend
tokenHoldersBalance uint256[] the sender balance
tokenTotalSupply uint256 the total supply

_computeDividend

function _computeDividend(uint256 time, uint256 senderBalance, uint256 tokenTotalSupply) internal view returns (uint256 tokenHolderDividend)

Parameters

Name Type Description
time uint256 dividend time
senderBalance uint256 token holder balance
tokenTotalSupply uint256 the total supply

_transferDividend

function _transferDividend(uint256 time, address tokenHolder, uint256 tokenHolderDividend) internal

Parameters

Name Type Description
time uint256 dividend time
tokenHolder address addresses to send the dividends
tokenHolderDividend uint256 the computed dividends

IncomeVaultInvariantStorage

INCOME_VAULT_OPERATOR_ROLE

bytes32 INCOME_VAULT_OPERATOR_ROLE

INCOME_VAULT_DEPOSIT_ROLE

bytes32 INCOME_VAULT_DEPOSIT_ROLE

INCOME_VAULT_DISTRIBUTE_ROLE

bytes32 INCOME_VAULT_DISTRIBUTE_ROLE

INCOME_VAULT_WITHDRAW_ROLE

bytes32 INCOME_VAULT_WITHDRAW_ROLE

IncomeVault_ClaimNotActivated

error IncomeVault_ClaimNotActivated()

IncomeVault_DividendAlreadyClaimed

error IncomeVault_DividendAlreadyClaimed()

IncomeVault_NoDividendToClaim

error IncomeVault_NoDividendToClaim()

IncomeVault_AdminWithAddressZeroNotAllowed

error IncomeVault_AdminWithAddressZeroNotAllowed()

IncomeVault_TokenPaymentWithAddressZeroNotAllowed

error IncomeVault_TokenPaymentWithAddressZeroNotAllowed()

IncomeVault_CMTATWithAddressZeroNotAllowed

error IncomeVault_CMTATWithAddressZeroNotAllowed()

IncomeVault_FailApproval

error IncomeVault_FailApproval()

IncomeVault_NoAmountSend

error IncomeVault_NoAmountSend()

IncomeVault_NotEnoughAmount

error IncomeVault_NotEnoughAmount()

IncomeVault_TokenBalanceIsZero

error IncomeVault_TokenBalanceIsZero()

IncomeVault_TooLateToWithdraw

error IncomeVault_TooLateToWithdraw(uint256 currentTime)

IncomeVault_TooEarlyToWithdraw

error IncomeVault_TooEarlyToWithdraw(uint256 currentTime)

newDeposit

event newDeposit(uint256 time, address sender, uint256 dividend)

DividendClaimed

event DividendClaimed(uint256 time, address sender, uint256 dividend)

IncomeVaultOpen

TIME_ERROR_CODE

enum TIME_ERROR_CODE {
  OK,
  CLAIM_NOT_ACTIVATED,
  TOO_LATE_TO_WITHDRAW,
  TOO_EARLY_TO_WITHDRAW
}

validateTimeCode

function validateTimeCode(uint256 time) public view returns (enum IncomeVaultOpen.TIME_ERROR_CODE code)

validate if a time is valid, return 0 if valid

validateTime

function validateTime(uint256 time) public view

validate if a time is valid, revert if invalid

validateTimeBatch

function validateTimeBatch(uint256[] times) public view

batch version of {validateTime}

claimDividend

function claimDividend(uint256 time) public

claim your payment

Parameters

Name Type Description
time uint256 provide the date where you want to receive your payment

claimDividendBatch

function claimDividendBatch(uint256[] times) public

batch version of {claimDividend}

Don't check if the dividends have been already claimed before external call to CMTAT.

Parameters

Name Type Description
times uint256[] provide the dates where you want to receive your payment

IncomeVaultRestricted

__IncomeVaultRestricted_init_unchained

function __IncomeVaultRestricted_init_unchained(uint256 timeLimitToWithdraw_) internal

calls the different initialize functions from the different modules

deposit

function deposit(uint256 time, uint256 amount) public

deposit an amount to pay the dividends.

Parameters

Name Type Description
time uint256 provide the date where you want to perform a deposit
amount uint256 the amount to deposit

withdraw

function withdraw(uint256 time, uint256 amount, address withdrawAddress) public

withdraw a certain amount at a specified time.

Parameters

Name Type Description
time uint256 provide the date where you want to perform a deposit
amount uint256 the amount to withdraw
withdrawAddress address address to receive amountof tokens

withdrawAll

function withdrawAll(uint256 amount, address withdrawAddress) public

withdraw all tokens from ERC20TokenPayment contracts deposited

Parameters

Name Type Description
amount uint256 the amount to withdraw
withdrawAddress address address to receive amountof tokens

distributeDividend

function distributeDividend(address[] addresses, uint256 time) public

distribute the dividends

The dividends are distributed only if they have not yet been claimed by the token holder

Parameters

Name Type Description
addresses address[] compute and transfer dividend for these holders
time uint256 dividend time

setStatusClaim

function setStatusClaim(uint256 time, bool status) public

set the status to open or close the claims for a given time

Parameters

Name Type Description
time uint256 target time
status bool boolean (true or false)

setTimeLimitToWithdraw

function setTimeLimitToWithdraw(uint256 timeLimitToWithdraw_) public

configure the time limit to withdraw