Distribution
contract Distribution
is Ownable, IDistribution
Distributes STAKE tokens.
Index
- Initialized
- InstallmentMade
- PoolAddressChanged
- PreInitialized
- _calculateInstallmentValue
- _calculateInstallmentValue
- _calculateNumberOfAvailableInstallments
- _endInstallment
- _now
- _updatePoolData
- _validateAddress
- active
- changePoolAddress
- fallback
- initialize
- initialized
- makeInstallment
- onTokenTransfer
- preInitialize
- renounceOwnership
Reference
Events
Initialized
event Initialized(address caller)
Emits when `initialize` method has been called.
- Parameters:
caller
- The address of the caller.
InstallmentMade
event InstallmentMade(uint8 pool, uint256 value, address caller)
Emits when an installment for the specified pool has been made.
- Parameters:
pool
- The index of the pool.value
- The installment value.caller
- The address of the caller.
PoolAddressChanged
event PoolAddressChanged(uint8 pool, address oldAddress, address newAddress)
Emits when the pool address was changed.
- Parameters:
pool
- The index of the pool.oldAddress
- Old address.newAddress
- New address.
PreInitialized
event PreInitialized(address token, address caller)
Emits when `preInitialize` method has been called.
- Parameters:
token
- The address of ERC677MultiBridgeToken.caller
- The address of the caller.
Modifiers
active
modifier active(uint8 _pool)
Checks that the installments for the given pool are started and are not finished already.
- Parameters:
_pool
- The index of the pool.
initialized
modifier initialized()
Checks that the contract is initialized.
Functions
_calculateInstallmentValue
function _calculateInstallmentValue(uint8 _pool) internal view returns (uint256)
Calculates the value of the installment for 1 day for the given pool.
- Parameters:
_pool
- The index of the pool.- Returns:
- uint256
_calculateInstallmentValue
function _calculateInstallmentValue(uint8 _pool, uint256 _valueAtCliff) internal view returns (uint256)
Calculates the value of the installment for 1 day for the given pool.
- Parameters:
_pool
- The index of the pool._valueAtCliff
- Custom value to distribute at cliff.- Returns:
- uint256
_calculateNumberOfAvailableInstallments
function _calculateNumberOfAvailableInstallments(uint8 _pool) internal view returns (uint256)
Calculates the number of available installments for the given pool.
- Parameters:
_pool
- The index of the pool.- Returns:
- The number of available installments.
_endInstallment
function _endInstallment(uint8 _pool) internal
Marks that all installments for the given pool are made.
- Parameters:
_pool
- The index of the pool.
_now
function _now() internal view returns (uint256)
- Returns:
- uint256
_updatePoolData
function _updatePoolData(uint8 _pool, uint256 _value, uint256 _currentNumberOfInstallments) internal returns (uint256)
Updates the given pool data after each installment: the remaining number of tokens, the number of made installments. If the last installment are done and the tokens remained then transfers them to the pool and marks that all installments for the given pool are made.
- Parameters:
_pool
- The index of the pool._value
- Current installment value._currentNumberOfInstallments
- Number of installment that are made.- Returns:
- uint256
_validateAddress
function _validateAddress(address _address) internal pure
Checks for an empty address.
- Parameters:
_address
- address
changePoolAddress
function changePoolAddress(uint8 _pool, address _newAddress) external
Changes the address of the specified pool.
- Parameters:
_pool
- The index of the pool (only ECOSYSTEM_FUND or FOUNDATION_REWARD are allowed)._newAddress
- The new address for the change.
fallback
function (address _ecosystemFundAddress, address _publicOfferingAddress, address _privateOfferingAddress, address _advisorsRewardAddress, address _foundationAddress, address _liquidityFundAddress) public
Sets up constants and pools addresses that are used in distribution.
- Parameters:
_ecosystemFundAddress
- The address of the Ecosystem Fund._publicOfferingAddress
- The address of the Public Offering._privateOfferingAddress
- The address of the Private Offering contract._advisorsRewardAddress
- The address of the Advisors Reward contract._foundationAddress
- The address of the Foundation Reward._liquidityFundAddress
- The address of the Liquidity Fund.
initialize
function initialize() external
Initializes token distribution.
makeInstallment
function makeInstallment(uint8 _pool) public
Makes an installment for one of the following pools: Private Offering, Advisors Reward, Ecosystem Fund, Foundation Reward.
- Modifiers:
- initialized active
- Parameters:
_pool
- The index of the pool.
onTokenTransfer
function onTokenTransfer(address , uint256 , bytes ) public pure returns (bool)
This method is called after the STAKE tokens are transferred to this contract.
- Parameters:
- address
- uint256
- bytes
- Returns:
- bool
preInitialize
function preInitialize(address _tokenAddress, uint256 _initialStakeAmount) external
Pre-initializes the contract after the token is created. Distributes tokens for Public Offering, Liquidity Fund, and part of Private Offering.
- Modifiers:
- onlyOwner
- Parameters:
_tokenAddress
- The address of the STAKE token contract._initialStakeAmount
- The sum of initial stakes made on xDai chain before transitioning to POSDAO. This amount must be sent to address(0) because it is excess on Mainnet side.
renounceOwnership
function renounceOwnership() public
The removed implementation of the ownership renouncing.
- Modifiers:
- onlyOwner