MultipleDistribution
contract MultipleDistribution
is Ownable, IMultipleDistribution
Distributes STAKE tokens for Private Offering and Advisors Reward.
Index
- Burnt
- DistributionAddressSet
- Initialized
- ParticipantEdited
- ParticipantRemoved
- ParticipantsAdded
- ParticipantsFinalized
- Withdrawn
- _withdraw
- addParticipants
- burn
- editParticipant
- fallback
- finalizeParticipants
- getParticipants
- initialize
- initialized
- notFinalized
- onTokenTransfer
- poolStake
- removeParticipant
- renounceOwnership
- setDistributionAddress
- withdraw
Reference
Events
Burnt
event Burnt(uint256 value)
Emits when `burn` method has been called.
- Parameters:
value
- Burnt value.
DistributionAddressSet
event DistributionAddressSet(address distribution, address caller)
Emits when the `Distribution` address has been set.
- Parameters:
distribution
- `Distribution` contract address.caller
- The address of the caller.
Initialized
event Initialized(address token, address caller)
Emits when `initialize` method has been called.
- Parameters:
token
- The address of ERC677MultiBridgeToken contract.caller
- The address of the caller.
ParticipantEdited
event ParticipantEdited(address participant, uint256 oldStake, uint256 newStake, address caller)
Emits when `editParticipant` method has been called.
- Parameters:
participant
- Participant address.oldStake
- Old participant stake.newStake
- New participant stake.caller
- The address of the caller.
ParticipantRemoved
event ParticipantRemoved(address participant, uint256 stake, address caller)
Emits when `removeParticipant` method has been called.
- Parameters:
participant
- Participant address.stake
- Participant stake.caller
- The address of the caller.
ParticipantsAdded
event ParticipantsAdded(address[] participants, uint256[] stakes, address caller)
Emits when `addParticipants` method has been called.
- Parameters:
participants
- Participants addresses.stakes
- Participants stakes.caller
- The address of the caller.
ParticipantsFinalized
event ParticipantsFinalized(uint256 numberOfParticipants, address caller)
Emits when `finalizeParticipants` method has been called.
- Parameters:
numberOfParticipants
- Number of participants.caller
- The address of the caller.
Withdrawn
event Withdrawn(address recipient, uint256 value)
Emits when `withdraw` method has been called.
- Parameters:
recipient
- Recipient address.value
- Transferred value.
Modifiers
initialized
modifier initialized()
Checks that the contract is initialized.
notFinalized
modifier notFinalized()
Checks that the participant set is not finalized.
Functions
_withdraw
function _withdraw(address _recipient) internal returns (uint256)
Transfers a share to participant or unclaimed part to address(0). Used by the `withdraw` and `burn` functions.
- Modifiers:
- initialized
- Parameters:
_recipient
- The address of a participant or address(0).- Returns:
- uint256
addParticipants
function addParticipants(address[] _participants, uint256[] _stakes) external
Adds participants. This function doesn't limit max gas consumption, so adding too many participants can cause it to reach the out-of-gas error.
- Modifiers:
- onlyOwner notFinalized
- Parameters:
_participants
- The addresses of new participants._stakes
- The amounts of the tokens that belong to each participant.
burn
editParticipant
function editParticipant(address _participant, uint256 _newStake) external
Edits participant stake.
- Modifiers:
- onlyOwner notFinalized
- Parameters:
_participant
- Participant address._newStake
- New stake of the participant.
fallback
function (uint8 _pool) public
- Parameters:
_pool
- uint8
finalizeParticipants
function finalizeParticipants() external
Calculates unused stake and disables the following additions/edits.
- Modifiers:
- onlyOwner notFinalized
getParticipants
function getParticipants() external view returns (address[])
Returns an array of participants.
- Returns:
- address[]
initialize
function initialize(address _tokenAddress) external
Initializes the contract after the token is created.
- Parameters:
_tokenAddress
- The address of the STAKE token contract.
onTokenTransfer
function onTokenTransfer(address _from, uint256 _value, bytes ) external returns (bool)
Updates an internal value of the balance to use it for correct share calculation (see the `_withdraw` function) and prevents transferring tokens to this contract not from the `Distribution` contract.
- Parameters:
_from
- The address from which the tokens are transferred._value
- The amount of transferred tokens.- bytes
- Returns:
- bool
poolStake
function poolStake() external view returns (uint256)
Returns a total amount of tokens.
- Returns:
- uint256
removeParticipant
function removeParticipant(address _participant) external
Removes participant. This function doesn't limit max gas consumption, so having too many participants can cause it to reach the out-of-gas error.
- Modifiers:
- onlyOwner notFinalized
- Parameters:
_participant
- Participant address.
renounceOwnership
function renounceOwnership() public
The removed implementation of the ownership renouncing.
- Modifiers:
- onlyOwner
setDistributionAddress
function setDistributionAddress(address _distributionAddress) external
Sets the `Distribution` contract address.
- Modifiers:
- onlyOwner
- Parameters:
_distributionAddress
- The `Distribution` contract address.
withdraw
function withdraw() external
Transfers a share to participant. Can only be called by Private Offering or Advisors Reward participant to withdraw their currently available share.