UserData
propose
propose
If user has enough gas and it's not slashed, deploys new proposal to the dao root, if not notifies user that proposal is not created.
Parameters:
Name | Type | Description |
---|---|---|
proposal_data | TvmCell | Proposal data in cell format necessary for deploying new proposal |
threshold | uint128 | Minimal amount of tokens necessary to propose |
onProposalDeployed
onProposalDeployed
Adds proposal to the created proposals, deletes pending proposal and notifies user that the proposal has been created.
Parameters:
Name | Type | Description |
---|---|---|
nonce | uint32 | Id of the temporary proposal |
proposal_id | uint32 | The id of the created proposal |
answer_id | uint32 |
castVote
castVote
If there was an error notifies user that vote is rejected, if not adds vote to the casted votes and casts vote to the proposal with given id.
Parameters:
Name | Type | Description |
---|---|---|
code_version | uint32 | Current version of the code |
proposal_id | uint32 | The id of the proposal for which user is casting the vote |
support | bool | True if vote is in favor of proposal, false if itβs against |
reason | string | Reason of the decided vote |
Events emitted:
VoteCast
voteCasted
voteCasted
Notifies user that the vote is casted.
Parameters:
Name | Type | Description |
---|---|---|
proposal_id | uint32 | The id of the proposal for which the users vote is casted |
rejectVote
rejectVote
Deletes vote from casted votes and notifies user about rejection.
Parameters:
Name | Type | Description |
---|---|---|
proposal_id | uint32 | The id of the proposal for which the users vote is rejected |
tryUnlockVoteTokens
tryUnlockVoteTokens
Unlocks tokens used for voting.
Parameters:
Name | Type | Description |
---|---|---|
code_version | uint32 | Current version of the code |
proposal_id | uint32 | The id of the proposal for which votes tokens should be unlocked |
unlockVoteTokens
unlockVoteTokens
Deletes created proposal and unlocks user votes.
Parameters:
Name | Type | Description |
---|---|---|
proposal_id | uint32 | The id of the proposal for which votes tokens should be unlocked |
success | bool | True if proposal was accepted, false if denied |
Events emitted:
UnlockVotes
tryUnlockCastedVotes
tryUnlockCastedVotes
Unlocks casted votes from proposal and transfers remaining gas to user.
Parameters:
Name | Type | Description |
---|---|---|
code_version | uint32 | Current version of the code |
proposal_ids | uint32[] | The idβs of the proposals for which casted votes should be unlocked |
unlockCastedVote
unlockCastedVote
Deletes casted votes from list and notifies user that votes are unlocked.
Parameters:
Name | Type | Description |
---|---|---|
proposal_id | uint32 | The id of the proposal for which user casted a vote |
success | bool | True if proposal was accepted, false if denied |
Events emitted:
UnlockCastedVotes
_lockedTokens
_lockedTokens
Returns the total amount of userβs locked tokens used in proposals
Return value:
Type | Description |
---|---|
uint128 | Total amount of userβs locked tokens |
syncRewards
syncRewards
Synchronize all data linked to reward rounds list when adding new reward round.
Parameters:
Name | Type | Description |
---|---|---|
reward_rounds | IStakingPool.RewardRound[] | List of roundβs rewards |
updated_balance | uint256 | Updated token balance after some action |
slash
slash
Synchronizes rewards, sets banned rewards, reward debts and token balance and confirms slashing using that data.
Parameters:
Name | Type | Description |
---|---|---|
reward_rounds | RewardRound[] | List of roundβs rewards |
send_gas_to | address | Address where to send spent gas |
processDeposit
processDeposit
Synchronizes rewards, adds deposited tokens to token balance and finishes deposit.
Parameters:
Name | Type | Description |
---|---|---|
nonce | uint64 | Id of the deposit which should be reverted or finalized |
_tokens_to_deposit | uint128 | Amount of tokens to deposit |
reward_rounds | RewardRound[] | List of roundβs rewards |
code_version | uint32 | Current version of the code |
Events emitted:
DepositProcessed
processClaimReward
processClaimReward
Synchronizes rewards, creates new list of rewards whose data is reward balance from each reward round and finishes claiming rewards.
Parameters:
Name | Type | Description |
---|---|---|
reward_rounds | RewardRound[] | List of roundβs rewards |
send_gas_to | address | Address where to send spent gas |
code_version | uint32 | Current version of the code |
getRewardForRelayRound
getRewardForRelayRound
Does all the necessary checks and processes getting the reward for finished relayer round.
Parameters:
Name | Type | Description |
---|---|---|
round_num | uint32 | Number of the round |
processGetRewardForRelayRound2
processGetRewardForRelayRound2
Synchronizes rewards and based on the relayer round address found using round number gets reward for the specified round.
Parameters:
Name | Type | Description |
---|---|---|
reward_rounds | RewardRound[] | List of roundβs rewards |
round_num | uint32 | Number of the round |
code_version | uint32 | Current version of the code |
relay_round_code_version | uint32 | Code version of the relayβs round |
receiveRewardForRelayRound
receiveRewardForRelayRound
Increases reward balance for the specified round.
Parameters:
Name | Type | Description |
---|---|---|
relay_round_num | uint32 | Number of the relayer round |
reward_round_num | uint32 | Number of the reward for the round |
reward | uint128 | Amount to increase the reward balance for |
Events emitted:
RelayRoundRewardClaimed
processLinkRelayAccounts
processLinkRelayAccounts
Links relayer accounts by setting the relay_ton_pubkey and relay_eth_address
Parameters:
Name | Type | Description |
---|---|---|
ton_pubkey | uint256 | Public key of the ton account |
eth_address | uint160 | Address of the ethereum account |
confirm | bool | True if both ton and eth accounts are confirmed, false otherwise |
code_version | uint32 | The current version of the code |
Events emitted:
RelayKeysUpdated
TonPubkeyConfirmed
EthAddressConfirmed
confirmTonAccount
confirmTonAccount
Sets ton_pubkey_confirmed to true.
Events emitted:
TonPubkeyConfirmed
processConfirmEthAccount
processConfirmEthAccount
Sets eth_address_confirmed to true and transfers remaining gas to the send_gas_to.
Parameters:
Name | Type | Description |
---|---|---|
eth_address | uint160 | Address of the ethereum account |
send_gas_to | address | Address where to send spent gas |
Events emitted:
EthAddressConfirmed
becomeRelayNextRound
becomeRelayNextRound
Processes relayer for next round in the staking pool.
processBecomeRelayNextRound2
processBecomeRelayNextRound2
Based on election address apply for membership.
Parameters:
Name | Type | Description |
---|---|---|
round_num | uint32 | The number of the round |
lock_time | uint32 | Duration of locking the tokens |
min_deposit | uint128 | Minimum amount for relayer deposit |
code_version | uint32 | Current version of the code |
election_code_version | uint32 | Code version of the election |
relayMembershipRequestAccepted
relayMembershipRequestAccepted
Locks relayer for 30 days.
Parameters:
Name | Type | Description |
---|---|---|
round_num | uint32 | The number of the round |
tokens | uint128 | |
ton_pubkey | uint256 | Public key of the ton account |
eth_addr | uint160 | Address of the ethereum account |
lock_time | uint32 | Duration of locking the tokens |
Events emitted:
RelayMembershipRequested
processWithdraw
processWithdraw
Synchronizes rewards, decreases from token balance number of tokens to withdraw and finishes withdraw in the staking pool.
Parameters:
Name | Type | Description |
---|---|---|
_tokens_to_withdraw | uint128 | Amount of tokens to withdraw |
reward_rounds | RewardRound[] | List of roundβs rewards |
emergency | bool | True if withdrawal is emergency, false if not |
send_gas_to | address | Address where to send spent gas |
code_version | uint32 | Current version of the code |
withdrawTons
withdrawTons
Transfers to user all the tons left.
Last updated