Skip to content

Latest commit

History

767 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Non-Custodial Seed Node Staking Contracts

GitHub Actions

For phase 0 contracts, please refer to here.

Non-custodial seed node staking in Zilliqa as described in ZIP-11 makes use of four contracts written in Scilla. This repository is the central portal that collates together the contracts, documentations around them, unit tests, and scripts to deploy and run the contracts on the network.

In the sections below, we describe in detail: 1) the purpose of each contract, 2) their structure and specifications, 3) running unit tests for the contracts.

Table of Content

Overview

The table below summarizes the purpose of the four contracts that ZIP-11 will broadly use:

Contract NameFile and LocationDescription
SSNListssnlist.scillaThe main contract that keeps track of Staked Seed Nodes aka SSNs, the delegators, the amount staked by a delegator with an SSN, and available rewards, etc.
SSNListProxyproxy.scillaA proxy contract that sits on top of the SSNList contract. Any call to the SSNList contract must come from SSNListProxy. This contract facilitates upgradeability of the SSNList contract in case a bug is found.
Walletmultisig_wallet.scillaA multisig wallet contract tailored to work with the SSNListproxy contract. Certain transitions in the SSNListProxy contract can only be invoked when k-out-of-n users have agreed to do so. This logic is handled using the Wallet contract.
gZILTokengzil.scillaA ZRC-2 compliant fungible token contract. gZIL tokens represent governance tokens. They are issued alongside staking rewards whenever a delegator withdraws her staking rewards.

SSNList Contract Specification

The SSNList contract is the main contract that is central to the entire staking infrastructure.

Roles and Privileges

The table below describes the roles and privileges that this contract defines:

RoleDescription & Privileges
ssnA registered SSN that provides the seed node service and gets rewarded for the service. An SSN can only be registered by the admin.
verifierAn entity that checks the health of SSNs and rewards them accordingly for their service.
adminThe administrator of the contract. admin is a multisig wallet contract (i.e., an instance of Wallet).
initiatorThe user who calls the SSNListProxy that in turns call the SSNList contract.
delegatorA token holder who wishes to delegate her tokens to an SSN for staking. The delegator earns a portion of the reward that the SSN receives.

Data Types

The contract defines and uses several custom ADTs that we describe below:

  1. SSN Data Type:
typeSsn =
| SsnofBoolUint128Uint128StringStringStringUint128Uint128Uint128ByStr20
(* Each SSN has the following fields: *)(* ActiveStatus : Bool *)(* Represents whether the SSN has the minimum stake amount and therefore ready to participate in staking and receive rewards. *)(* StakeAmount : Uint128 *)(* Total stake that can be used for reward calculation. *)(* StakeRewards : Uint128 *)(* (Unwithdrawn) Reward accumulated so far across all cycles. It only includes the reward that the SSN can distribute to its delegators. It does not include SSN's own commission. *)(* Name : String *)(* A human-readable name for this SSN. *)(* URLRaw : String *)(* Represents "ip:port" of the SSN serving raw API requests. *)(* URLApi : String *)(* Representing URL exposed by SSN serving public API requests. *)(* BufferedDeposit : Uint128 *)(* Stake deposit that cannot be counted as a part of reward calculation for the ongoing reward cycle. But, to be considered for the next one. *)(* Commission : Uint128 *)(* Percentage of incoming rewards that the SSN takes. Represented as an integer. If the commission is 10.5%, then it is multiplied by 10^7 and then resulting integer is set as commission. The assumption is that the percentage is up to 7 decimal places. *)(* CommissionRewards : Uint128 *)(* Number of ZILs earned as commission by the SSN. *)(* ReceivingAddress : ByStr20 *)(* Address to be used to receive commission. *)
  1. SsnStakeRewardShare Data Type:
typeSsnStakeRewardShare = | SsnStakeRewardShareofByStr20Uint128Uint128
(* SSNAddress : ByStr20 *)
(* Address of the SSN. *)
(* CycleReward : Uint128 *)
(* Integer representation of reward assigned by the verifier to this SSN for this cycle. *)
(* TotalStakeAmount : Uint128 *)
(* Total stake amount at a specific cycle. *)
  1. SSNCycleInfo Data Type:
typeSSNCycleInfo =
| SSNCycleInfoofUint128Uint128
(* Each SSNCycleInfo has the following fields: *)(* TotalStakeDuringTheCycle : Uint128 *)(* Represents the amount staked during this cycle for the given SSN. *)(* TotalRewardEarnedDuringTheCycle : Uint128 *)(* Represents the total reward earned during this cycle for the given SSN. *)
  1. Error Data Type:
typeError =
| ContractFrozenFailure(* Contract is paused *)
| VerifierValidationFailed(* Initiator is not verifier *)
| AdminValidationFailed(* Initiator is not admin *)
| ProxyValidationFailed(* Caller is not proxy *)
| DelegDoesNotExistAtSSN(* Delegator does not exist at the given SSN *)
| DelegHasBufferedDeposit(* Delegator has some buffered deposit. *)
| ChangeCommError(* Commission could not be changed *)
| SSNNotExist(* SSN does not exist *)
| SSNAlreadyExist(* SSN already exists *)
| DelegHasUnwithdrawnRewards(* Delegator has unwithdrawn Rewards *)
| DelegHasNoSufficientAmt(* Delegator does not have sufficient amount to withdraw *)
| SSNNoComm(* SSN has no commission left to withdraw *)
| DelegStakeNotEnough(* Delegator's stake is not above minimum *)
| ExceedMaxChangeRate(* SSN is trying to modify the commission rate by over 1% *)
| ExceedMaxCommRate(* SSN is trying to set the commission rate greater than the allowed max *)
| InvalidTotalAmt(* Error when the total stake amount is being decreased by an illegal amount *)
| VerifierNotSet(* Verifier's address is not set in the field *)
| VerifierRecvAddrNotSet(* Verifier's reward address address is not set in the field *)
| ReDelegInvalidSSNAddr(* Delegator cannot redelegate to same SSN address *)
| AvailableRewardsError(* Verifier reward does not match computed SSN reward *)
| InvalidSwapAddr(* Swap address is invalid; either the address is does not match the one in the request map or the address does not exists *)
| SwapAddrValidationFailed(* Requestor swap address is different *)
| SwapAddrAlreadyExistsAsRequest(* There exists another swap request that is the inverse of this swap address pair; causing a cyclic request *)

Immutable Parameters

The table below lists the parameters that are defined at the contract deployment time and hence cannot be changed later on.

NameTypeDescription
init_adminByStr20The initial admin of the contract.
init_proxy_addressByStr20The initial address of the SSNListProxy contract.
init_gzil_addressByStr20Address of the gZILToken contract.

Mutable Fields

The table below presents the mutable fields of the contract and their initial values.

NameTypeInitial ValueDescription
ssnlistMap ByStr20 SsnEmp ByStr20 SsnMapping between SSN addresses and the corresponding Ssn information.
comm_for_ssnMap ByStr20 (Map Uint32 Uint128)Emp ByStr20 (Map Uint32 Uint128)Map (SSNAddress -> Map (RewardCycleNum -> Commission)) This Map is not used for computing commission fee for an SSN. Its purpose is to act as a placeholder to prevent SSN operators from changing their commission rate multiple times within one reward cycle.
deposit_amt_delegMap ByStr20 (Map ByStr20 Uint128)Emp ByStr20 (Map ByStr20 Uint128)Map (DelegatorAddress -> Map (SSNAddress -> AmoutDelegated))
ssn_deleg_amtMap ByStr20 (Map ByStr20 Uint128)Emp ByStr20 (Map ByStr20 Uint128)Map (SSNAddress -> Map (DelegatorAddress -> AmountDelegated)) This map does not affect any of the contract operation. It is introduced so that wallet developers can easily query the deposit amount given by a delegator.
buff_deposit_delegMap ByStr20 (Map ByStr20 (Map Uint32 Uint128))Emp ByStr20 (Map ByStr20 (Map Uint32 Uint128))Map (DelegatorAddress -> Map (SSNAddress -> Map (RewardCycleNum -> BufferedStakeAmount)))
direct_deposit_delegMap ByStr20 (Map ByStr20 (Map Uint32 Uint128))Emp ByStr20 (Map ByStr20 (Map Uint32 Uint128))Map (DelegatorAddress -> Map (SSNAddress -> Map (RewardCycleNum -> UnBufferedStakeAmount)))
last_withdraw_cycle_delegMap ByStr20 (Map ByStr20 Uint32))Emp ByStr20 (Map ByStr20 Uint32))Map (DelegatorAddress -> Map (SSNAddress -> RewardCycleWhenLastWithdrawn)). For a new delegator that has never deposited any stake for this SSN, this field will store the reward cycle number during which the delegator successfully deposited its stake.
last_buf_deposit_cycle_delegMap ByStr20 (Map ByStr20 Uint32))Emp ByStr20 (Map ByStr20 Uint32))Map (DelegatorAddress -> Map (SSNAddress -> RewardCycleWhenLastDeposited))
stake_ssn_per_cycleMap ByStr20 (Map Uint32 SSNCycleInfo))Emp ByStr20 (Map Uint32 SSNCycleInfo))Map (SSNAddress -> Map (RewardCycleNum -> SSNCycleInfo)). Note that this data type contains information that corresponds to the end of the cycle when the verifier has distributed the reward. It could therefore be different from the information stored in ssnlist particularly its stake field which gets updated in the middle of a cycle.
withdrawal_pendingMap ByStr20 (Map BNum Uint128)Emp ByStr20 (Map BNum Uint128)Map (DelegatorAddress -> (BlockNumberWhenRewardWithdrawalRequested -> Amount ))
deleg_swap_requestMap ByStr20 ByStr20Emp ByStr20 ByStr20Map (DelegatorAddress_A -> DelegatorAddress_B) This map stores requestor and recipient addresses that are involved in the swap requests.
bnum_reqUint128Uin128 24000Bonding period in terms of number of blocks. Set to be equivalent to 14 days.
verifierOption ByStr20None {ByStr20}The address of the verifier.
verifier_receiving_addrOption ByStr20None {ByStr20}The address to receive verifier's rewards.
minstakeUint128Uin128 10000000000000000000Minimum stake required to activate an SSN (1 mil ZIL expressed in Qa, where 1 ZIL = 10^12 Qa).
mindelegstakeUint128Uin128 10000000000000Minimum stake for a delegator (10 ZIL expressed in Qa where 1 ZIL = 10^12 Qa).
contractadminByStr20init_adminAddress of the administrator of this contract.
proxyaddrByStr20init_proxy_addressAddress of the proxy contract.
gziladdrByStr20init_gzil_addressAddress of the gzil contract.
lastrewardcycleUint32Uint32 1The block number when the last reward was distributed.
pausedByStr20TrueA flag to record the paused status of the contract. Certain transitions in the contract cannot be invoked when the contract is paused.
maxcommchangerateUint128Uint128 1The maximum rate change that an SSN is allowed to make across cycles. Set to 1%.
maxcommrateUint128Uint128 1000000000The maximum commission rate that an SSN can charge. Set to 100% but represented as an integer multiplied by 10^7. This prevents SSN from setting commission beyond 100%.
totalstakeamountUint128Uint128 0The total amount (in Qa) that is currently staked in the contract. It only corresponds to the stake with active SSNs that is unbuffered and therefore can be taken into account for reward calculation.

Transitions

Note that each of the transitions in the SSNList contract takes initiator as a parameter which as explained above is the caller that calls the SSNListProxy contract which in turn calls the SSNList contract.

Note: No transition in the SSNList contract can be invoked directly. Any call to the SSNList contract must come from the SSNListProxy contract.

All the transitions in the contract can be categorized into four categories:

  • Housekeeping Transitions: Meant to facilitate basic admin-related tasks.
  • Delegator Transitions: The transitions that the delegators will invoke as a part of the SSN operation.
  • SSN Transitions: The transitions that the SSNs will invoke as a part of the SSN operation.
  • Verifier Transitions: The transitions that the verifier will invoke as a part of the SSN operation.

Each of these category of transitions are presented in further detail below.

Housekeeping Transitions

NameParamsDescriptionCallable when paused?Callable when not paused?
Pauseinitiator : ByStr20Pause the contract temporarily to stop any critical transition from being invoked.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
Unpauseinitiator : ByStr20Un-pause the contract to re-allow the invocation of all transitions.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
UpdateAdminadmin : ByStr20, initiator : ByStr20Set a new stagingcontractadmin by admin.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
ClaimAdmin initiator : ByStr20Claim to be new contract admin.
⚠️Note:initiator must be the current stagingcontractadmin of the contract.
✔️✔️
UpdateVerifierverif : ByStr20, initiator : ByStr20Replace the current verifier by verif.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
UpdateVerifierRewardAddraddr : ByStr20, initiator : ByStr20Replace the current reward receiving address verifier_receiving_addr for the verifier by addr. Since the verifier is currently run by Zilliqa Research, its receiving address is currently updated by the admin not the verifier itself.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
UpdateStakingParametersmin_stake: ByStr20, min_deleg_stake : Uint128, max_comm_change_rate : Uint128, initiator : ByStr20Replace the current values of the fields minstake, mindelegstake, and maxcommchangerate to the input values.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
ChangeBNumReqinput_bnum_req : Uint128, initiator : ByStr20Replace the current value of the field bnum_req.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
UpdateGzilAddrgzil_addr : ByStr20, initiator : ByStr20Replace the gZIL token contract (gziladdr) by the input values.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
AddSSNssnaddr : ByStr20, name : String, urlraw : String, urlapi : String, comm : Uint128, initiator : ByStr20Add a new SSN to the list of available SSNs with the input values. The transition will create a value of type Ssn using the input values and add it to the ssnlist map. Since, this SSN is new, the status field in Ssn type will be False. Similarly, the fields stake_amt, rewards, buff_deposit, comm_rewards in the ssn type will be set to 0. The transition will emit a success event to signal the addition of the new SSN. The event will emit the address of the new SSN.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
UpdateSSNssnaddr : ByStr20, new_name : String, new_urlraw : String, new_urlapi : String, initiator : ByStr20Update name, urlraw and urlapi of a given SSN.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
CleanBuffDepositdeleg_addr_list : List ByStr20, ssn_addr_list : List (Pair ByStr20 ByStr20), initiator : ByStr20Delete empty "{}" maps for buff_deposit_deleg. deleg_addr_list is the list of delegators' addresses that have empty inner SSN maps. ssn_addr_list is a pair of delegator and SSN address that have empty inner deposit maps. To be invoked with staking-tool script
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
CleanDirectDepositdeleg_addr_list : List ByStr20, ssn_addr_list : List (Pair ByStr20 ByStr20), initiator : ByStr20Delete empty "{}" maps for direct_deposit_deleg. To be invoked with staking-tool script
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
CleanDelegStakePerCycledeleg_addr_list : List ByStr20, ssn_addr_list : List (Pair ByStr20 ByStr20), initiator : ByStr20Delete empty "{}" maps for deleg_stake_per_cycle. To be invoked with staking-tool script
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
CleanDepositAmtdeleg_addr_list : List ByStr20, initiator : ByStr20Delete empty "{}" maps for deposit_amt_deleg. deleg_addr_list is the list of delegators' addresses that have empty inner maps. To be invoked with staking-tool script
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
CleanPendingWithdrawaldeleg_addr_list : List ByStr20, initiator : ByStr20Delete empty "{}" maps for withdrawal_pending. To be invoked with staking-tool script
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
CleanLastWithdrawCycledeleg_addr_list : List ByStr20, initiator : ByStr20Delete empty "{}" maps for last_withdraw_cycle_deleg. To be invoked with staking-tool script
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
CleanLastBuffDepositCycledeleg_addr_list : List ByStr20, initiator : ByStr20Delete empty "{}" maps for last_buf_deposit_cycle_deleg. To be invoked with staking-tool script
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️

Delegator Transitions

NameParamsDescriptionCallable when paused?Callable when not paused?
DelegateStakessnaddr : ByStr20, initiator : ByStr20To delegate the stake to an SSN. initiator is the address of the delegator. The stake being delegated is captured in the implicit field _amount. In case of failure to accept the stake, an exception will be thrown and the transaction will be reverted. This stake will be buffered if the SSN is already active else it will be added to the stake pool of the SSN. This transition must update the following fields accordingly: ssnlist (with the updated buffered stake or unbuffered stake), deposit_amt_deleg and ssn_deleg_amt (with the amount deposited by the delegator), buff_deposit_deleg (with the amount deposited in case the SSN was active), direct_deposit_deleg (with the amount deposited in case the SSN was inactive), last_withdraw_cycle_deleg (to record the reward cycle number when the deposit was made for first-time delegators) and last_buf_deposit_cycle_deleg (to record the reward cycle number in case the SSN was active and the stake ended up as buffered deposit). The transition should throw an error in case the amount being delegated is less than mindelegstake.✔️
WithdrawStakeRewardsssnaddr : ByStr20, initiator : ByStr20To withdraw stake rewards from a given SSN. initiator is the address of the delegator. Reward to be given to a delegator can be computed on-the-fly proportional to its unbuffered stake in each cycle. I.e., if the delegator's unbuffered stake at this SSN in a given cycle is d and the total unbuffered stake across all SSNs is D, and the total reward available for all SSNs is R, then the reward earned by this delegator for the cycle will be (R * d)/D. When a delegator calls this transition, the reward is computed for all cycles i such that lastWithdrawnCycle < i <= lastrewardcycle. The transition also mints gZILs and assigns them to the delegator's address. For every ZIL earned as reward, the delegator will earn 0.001 gZIL.✔️
WithdrawStakeAmtssnaddr : ByStr20, amt : Uint128, initiator : ByStr20To withdraw stake amount from a given SSN. initiator is the address of the delegator. No stake amount can be withdrawn if the delegator has unwithdrawn reward or buffered deposit. If the amount withdrawn is less than or equal to the stake deposited, then the withdrawal request is accepted and the field withdrawal_pending is updated accordingly. A delegator may request multiple withdrawals in the same cycle. Once this transition is called, the delegator enters into an unbonding period of 24,000 blocks. Only at the expiry of the unbonding period, the delegator can claim the funds via CompleteWithdrawal transition. During the unbonding period, the delegator will not earn any reward.✔️
CompleteWithdrawalinitiator : ByStr20This is to be called after the delegator has called WithdrawStakeAmt. initiator is the address of the delegator. The transition processing all the pending withdrawals as recorded in withdrawal_pending. Only those pending requests for which the bonding period has expired will be processed. Upon success, all the funds get transferred from the contract to the initiator.✔️
ReDelegateStakessnaddr: ByStr20, to_ssn: ByStr20, amount: Uint128, initiator: ByStr20To re-delagate the stake from a SSN to another SSN. initiator is the address of the delegator. ssnaddr is the original SSN, to_ssn is the new SSN the delegator wants to delegate to. The re-delegate amount is specificed by amount.✔️
RequestDelegatorSwapnew_deleg_addr: ByStr20, initiator: ByStr20Creates a request to another delegator to indicate transferring all existing stakes, rewards, etc., to this new delegator. initiator is the address of the delegator who wants to transfer his/her stakes. new_deleg_addr is the address of the recipient that would be receiving all the staked amount, rewards, pending withdrawals, etc., of the initiator (original owner). The initiator is allowed to change the recipient by sending the request with another new_deleg_addr. The initiator can also revoke the request via RevokeDelegatorSwap. On the recipient end, the new_deleg_addr can either ConfirmDelegatorSwap to accept the swap or RejectDelegatorSwap to reject the swap. To avoid either parties from gaining or losing rewards after the swap, both parties must not have buffered deposits or unwithdrawn rewards at the time of request and confirming. Also, the initiator is not allowed to make a request to new_deleg_addr if there is an existing request made by new_deleg_addr to the initiator; i.e., if there exists a A -> B request, then B cannot make a request to A unless B accepts or rejects the existing request first. However, B can make other swap requests to other delegators. Change is irreversible once the recipient accepts the swap request, please be cautious of the new_deleg_addr.✔️
RevokeDelegatorSwapinitiator: ByStr20Revokes a swap request. This is used only by the initiator who has made an existing swap request and wishes to cancel it.✔️
ConfirmDelegatorSwaprequestor: ByStr20, initiator: ByStr20Accepts a swap request from a requestor. initiator is the new delegator that would be inheriting all the staked amount, withdrawals, rewards from requestor. requestor is the delegator who has initiated a swap request via RequestDelegatorSwap. To avoid either parties from gaining or losing rewards after the swap, both parties must not have buffered deposits or unwithdrawn rewards at the time of comfirming.✔️
RejectDelegatorSwaprequestor: ByStr20, initiator: ByStr20Rejects a swap request from a requestor. Once rejected, the requestor must create the swap request again if he/she wishes to revert the rejection. initiator is the new delegator that would be inheriting all the staked amount, withdrawals, rewards from requestor. requestor is the delegator who has initiated a swap request via RequestDelegatorSwap.✔️

SSN Operation Transitions

NameParamsDescriptionCallable when paused?Callable when not paused?
UpdateCommnew_rate : Uint128, initiator : ByStr20To update the commission rate. initiator is the SSN operator. An operator cannot update twice in the same cycle. The new_rate must also be less that the field maxcommrate and the change in the rate compared from the old one must be less than or equal to maxcommchangerate.✔️
WithdrawComminitiator : ByStr20To withdraw the commission earned. initiator is the SSN operator. On success, the contract transfer the commission to the receiving address.✔️
UpdateReceivingAddrnew_addr : ByStr20, initiator : ByStr20To update the commission receiving address for the SSN. initiator is the address of the SSN.✔️

Verifier Operation Transitions

NameParamsDescriptionCallable when paused?Callable when not paused?
AssignStakeRewardssnreward_list : List (Pair ByStr20 Uint128), initiator : ByStr20To assign reward to each SSN for this cycle. ssnreward_list contains the reward factor for each SSN. In more precise terms, it contains the value (floor((NumberOfDSEpochsInCurrentCycle x 110,000 x VerificationPassed))). This input is then multiplied by (floor(TotalStakeAtSSN / TotalStakeAcrossAllSSNs)) to compute the reward earned by each SSN. initiator is the verifier. The _amount contains the rewards for all SSN as well as verifier. Post this call, any buffered deposit with any SSN must be converted to unbuffered stake deposit. The commission earned by the SSNs must also get updated.✔️

Contract Upgrade Transitions

NameParamsDescriptionCallable when paused?Callable when not paused?
AddSSNAfterUpgradessnaddr: ByStr20, stake_amt: Uint128, rewards: Uint128, name: String, urlraw: String, urlapi: String, buff_deposit: Uint128, comm: Uint128, comm_rewards: Uint128, rec_addr: ByStr20, initiator: ByStr20To add a new SSN to the contract.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
UpdateDelegssnaddr: ByStr20, deleg : ByStr20, stake_amt: Uint128, initiator: ByStr20To add or remove a delegator for an SSN.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️✔️
PopulateStakeSSNPerCyclessn_addr: ByStr20, cycle: Uint32, totalAmt: Uint128, rewards: Uint128, initiator: ByStr20To populate stake_ssn_per_cycle map.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
PopulateLastWithdrawCycleForDelegdeleg_addr: ByStr20, ssn_addr: ByStr20, cycle: Uint32, initiator: ByStr20To populate last_withdraw_cycle_deleg map.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
PopulateLastBufDepositCycleDelegdeleg_addr: ByStr20, ssn_addr: ByStr20, cycle: Uint32, initiator: ByStr20To populate last_buf_deposit_cycle_deleg map.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
PopulateBuffDepositdeleg_addr: ByStr20, ssn_addr: ByStr20, cycle: Uint32, amt: Uint128, initiator: ByStr20To populate buff_deposit_deleg map.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
PopulateDepositAmtDelegdeleg_addr: ByStr20, ssn_addr: ByStr20, amt: Uint128, initiator: ByStr20To populate deposit_amt_deleg and ssn_deleg_amt map.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
PopulateDelegStakePerCycledeleg_addr: ByStr20, ssn_addr: ByStr20, cycle: Uint32, amt: Uint128, initiator: ByStr20To populate deleg_stake_per_cycle map.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
PopulateLastRewardCyclecycle: Uint32, initiator: ByStr20To populate lastrewardcycle .
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
PopulateDirectDepositdeleg_addr: ByStr20, ssn_addr: ByStr20, cycle: Uint32, amt: Uint128, initiator: ByStr20To populate direct_deposit_deleg map.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
PopulateCommForSSNssn_addr: ByStr20, cycle: Uint32, comm: Uint128, initiator: ByStr20To populate comm_for_ssn map.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
PopulateTotalStakeAmtamt: Uint128, initiator: ByStr20To populate totalstakeamount field.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
PopulateDelegSwapRequestrequestor: ByStr20, new_deleg_addr: ByStr20, initiator: ByStr20To populate deleg_swap_Request field.
⚠️Note:initiator must be the current contractadmin of the contract.
✔️

Contract State Migration Transitions

NameParamsDescriptionCallable when paused?Callable when not paused?
MigrateCommForSsninitiator : ByStr20, keys : List ByStr20, old_contract : ByStr20 with contract field comm_for_ssn: Map ByStr20 (Map Uint32 Uint128) endTo migrate the map comm_for_ssn from the old contract to a new contract via the remote state read feature. keys is the list of external keys in the map, i.e. comm_for_ssn[key]
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
MigrateDepositAmtDeleginitiator : ByStr20, keys : List ByStr20, old_contract : ByStr20 with contract field deposit_amt_deleg: Map ByStr20 (Map ByStr20 Uint128) endTo migrate the map deposit_amt_deleg from the old contract to a new contract via the remote state read feature. keys is the list of external keys in the map, i.e. deposit_amt_deleg[key]
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
MigrateSsnDelegAmtinitiator : ByStr20, keys : List ByStr20, old_contract : ByStr20 with contract field ssn_deleg_amt: Map ByStr20 (Map ByStr20 Uint128) endTo migrate the map ssn_deleg_amt from the old contract to a new contract via the remote state read feature. keys is the list of external keys in the map, i.e. ssn_deleg_amt[key]
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
MigrateBuffDepositDeleginitiator : ByStr20, keys : List ByStr20, old_contract : ByStr20 with contract field buff_deposit_deleg: Map ByStr20 (Map ByStr20 (Map Uint32 Uint128)) endTo migrate the map buff_deposit_deleg from the old contract to a new contract via the remote state read feature. keys is the list of external keys in the map, i.e. buff_deposit_deleg[key]
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
MigrateDirectDepositDeleginitiator : ByStr20, keys : List ByStr20, old_contract : ByStr20 with contract field direct_deposit_deleg: Map ByStr20 (Map ByStr20 (Map Uint32 Uint128)) endTo migrate the map direct_deposit_deleg from the old contract to a new contract via the remote state read feature. keys is the list of external keys in the map, i.e. direct_deposit_deleg[key]
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
MigrateLastWithdrawCycleDeleginitiator : ByStr20, keys : List ByStr20, old_contract : ByStr20 with contract field last_withdraw_cycle_deleg: Map ByStr20 (Map ByStr20 Uint32) endTo migrate the map last_withdraw_cycle_deleg from the old contract to a new contract via the remote state read feature. keys is the list of external keys in the map, i.e. last_withdraw_cycle_deleg[key]
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
MigrateLastBufDepositCycleDeleginitiator : ByStr20, keys : List ByStr20, old_contract : ByStr20 with contract field last_buf_deposit_cycle_deleg: Map ByStr20 (Map ByStr20 Uint32) endTo migrate the map last_buf_deposit_cycle_deleg from the old contract to a new contract via the remote state read feature. keys is the list of external keys in the map, i.e. last_buf_deposit_cycle_deleg[key]
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
MigrateDelegStakePerCycleinitiator : ByStr20, keys : List ByStr20, old_contract : ByStr20 with contract field deleg_stake_per_cycle: Map ByStr20 (Map ByStr20 (Map Uint32 Uint128)) endTo migrate the map deleg_stake_per_cycle from the old contract to a new contract via the remote state read feature. keys is the list of external keys in the map, i.e. deleg_stake_per_cycle[key]
⚠️Note:initiator must be the current contractadmin of the contract.
✔️
MigrateWithdrawalPendinginitiator : ByStr20, keys : List ByStr20, old_contract : ByStr20 with contract field withdrawal_pending: Map ByStr20 (Map BNum Uint128) endTo migrate the map withdrawal_pending from the old contract to a new contract via the remote state read feature. keys is the list of external keys in the map, i.e. withdrawal_pending[key]
⚠️Note:initiator must be the current contractadmin of the contract.
✔️

Other Transitions

NameParamsDescriptionCallable when paused?Callable when not paused?
AddFundsinitiator : ByStr20To add funds to the contract. Anyone should be able to add funds to the contract.✔️✔️

SSNListProxy Contract Specification

SSNListProxy contract is a relay contract that redirects calls to it to the SSNList contract.

Roles and Privileges

The table below describes the roles and privileges that this contract defines:

RoleDescription & Privileges
init_adminThe initial admin of the contract which is usually the creator of the contract. init_admin is also the initial value of admin.
adminCurrent admin of the contract initialized to init_admin. Certain critical actions can only be performed by the admin, e.g., changing the current implementation of the SSNList contract.
initiatorThe user who calls the SSNListProxy contract that in turn calls the SSNList contract.

Immutable Parameters

The table below lists the parameters that are defined at the contract deployment time and hence cannot be changed later on.

NameTypeDescription
init_implementationByStr20The address of the SSNList contract.
init_adminByStr20The address of the admin.

Mutable Fields

The table below presents the mutable fields of the contract and their initial values.

NameTypeInitial ValueDescription
implementationByStr20init_implementationAddress of the current implementation of the SSNList contract.
adminByStr20init_ownerCurrent admin of the contract.

Transitions

All the transitions in the contract can be categorized into two categories:

  • Housekeeping Transitions meant to facilitate basic admin related tasks.
  • Relay Transitions to redirect calls to the SSNList contract.

Housekeeping Transitions

NameParamsDescription
UpgradeTonewImplementation : ByStr20Change the current implementation address of the SSNList contract.
⚠️Note: Only the admin can invoke this transition
ChangeProxyAdminnewAdmin : ByStr20Change the current stagingadmin of the contract.
⚠️Note: Only the admin can invoke this transition.
ClaimProxyAdmin``Change the current admin of the contract.
⚠️Note: Only the stagingadmin can invoke this transition.

Relay Transitions

These transitions are meant to redirect calls to the corresponding SSNList contract. While redirecting, the contract prepares the initiator value that is the address of the caller of the SSNListProxy contract. The signature of transitions in the two contracts is exactly the same expect the added last parameter initiator for the SSNList contract.

Transition signature in the SSNListProxy contractTarget transition in the SSNList contract
Pause()Pause(initiator : ByStr20)
UnPause()UnPause(initiator : ByStr20)
UpdateAdmin(new_admin: ByStr20)UpdateAdmin(admin: ByStr20, initiator : ByStr20)
ClaimAdmin()ClaimAdmin(initiator : ByStr20)
UpdateVerifier(verif : ByStr20)UpdateVerifier (verif : ByStr20, initiator: ByStr20)
UpdateVerifierRewardAddr(addr: ByStr20)UpdateVerifierRewardAddr(addr: ByStr20, initiator : ByStr20)
UpdateStakingParameters(min_stake: Uint128, min_deleg_stake: Uint128, max_comm_change_rate: Uint128)UpdateStakingParameters(min_stake: Uint128, min_deleg_stake: Uint128, max_comm_change_rate: Uint128, initiator : ByStr20)
ChangeBNumReq(input_bnum_req: Uint128) ChangeBNumReq(input_bnum_req: Uint128, initiator : ByStr20)
UpdateGzilAddr(gzil_addr: ByStr20)UpdateGzilAddr(gzil_addr: ByStr20, initiator : ByStr20)
AddSSN(ssnaddr: ByStr20, name: String, urlraw: String, urlapi: String, comm: Uint128)AddSSN(ssnaddr: ByStr20, name: String, urlraw: String, urlapi: String, comm: Uint128, initiator : ByStr20)
UpdateSSN(ssnaddr: ByStr20, new_name: String, new_urlraw: String, new_urlapi: String)UpdateSSN(ssnaddr: ByStr20, new_name: String, new_urlraw: String, new_urlapi: String, initiator : ByStr20)
UpdateComm(new_rate: Uint128)UpdateComm(new_rate: Uint128, initiator : ByStr20)
WithdrawComm()WithdrawComm(initiator : ByStr20)
UpdateReceivingAddr(new_addr: ByStr20)UpdateReceivingAddr(new_addr: ByStr20, initiator : ByStr20)
DelegateStake(ssnaddr: ByStr20)DelegateStake(ssnaddr: ByStr20, initiator : ByStr20)
WithdrawStakeRewards(ssnaddr: ByStr20)WithdrawStakeRewards(ssnaddr: ByStr20, initiator : ByStr20)
WithdrawStakeAmt(ssnaddr: ByStr20, amt: Uint128)WithdrawStakeAmt(ssnaddr: ByStr20, amt: Uint128, initiator : ByStr20)
CompleteWithdrawal()CompleteWithdrawal(initiator : ByStr20)
ReDelegateStake(ssnaddr : ByStr20, to_ssn : ByStr20, amount : Uint128)ReDelegateStake(ssnaddr : ByStr20, to_ssn : ByStr20, amount : Uint128, initiator : ByStr20)
RequestDelegatorSwap(new_deleg_addr: ByStr20)RequestDelegatorSwap(new_deleg_addr: ByStr20, initiator: ByStr20)
RevokeDelegatorSwap()RevokeDelegatorSwap(initiator: ByStr20)
ConfirmDelegatorSwap(requestor: ByStr20)ConfirmDelegatorSwap(requestor: ByStr20, initiator: ByStr20)
RejectDelegatorSwap(requestor: ByStr20)RejectDelegatorSwap(requestor: ByStr20, initiator: ByStr20)
AssignStakeReward(ssnreward_list: List (Pair ByStr20 Uint128))AssignStakeReward(ssnreward_list: List (Pair ByStr20 Uint128), initiator : ByStr20)
AddFunds()AddFunds(initiator : ByStr20)
AddSSNAfterUpgrade(ssnaddr: ByStr20, stake_amt: Uint128, rewards: Uint128, name: String, urlraw: String, urlapi: String, buff_deposit: Uint128, comm: Uint128, comm_rewards: Uint128, rec_addr: ByStr20)AddSSNAfterUpgrade(ssnaddr: ByStr20, stake_amt: Uint128, rewards: Uint128, name: String, urlraw: String, urlapi: String, buff_deposit: Uint128, comm: Uint128, comm_rewards: Uint128, rec_addr: ByStr20, initiator : ByStr20)
AddSSNAfterUpgrade(ssnaddr: ByStr20, stake_amt: Uint128, rewards: Uint128, name: String, urlraw: String, urlapi: String, buff_deposit: Uint128, comm: Uint128, comm_rewards: Uint128, rec_addr: ByStr20)AddSSNAfterUpgrade(ssnaddr: ByStr20, stake_amt: Uint128, rewards: Uint128, name: String, urlraw: String, urlapi: String, buff_deposit: Uint128, comm: Uint128, comm_rewards: Uint128, rec_addr: ByStr20, initiator : ByStr20)
UpdateDeleg(ssnaddr: ByStr20, deleg: ByStr20, stake_amt: Uint128)UpdateDeleg(ssnaddr: ByStr20, deleg: ByStr20, stake_amt: Uint128, initiator : ByStr20)
PopulateStakeSSNPerCycle(ssn_addr: ByStr20, cycle: Uint32, totalAmt: Uint128, rewards: Uint128)PopulateStakeSSNPerCycle(ssn_addr: ByStr20, cycle: Uint32, totalAmt: Uint128, rewards: Uint128, initiator : ByStr20)
PopulateLastWithdrawCycleForDeleg(deleg_addr: ByStr20, ssn_addr: ByStr20, cycle: Uint32)PopulateLastWithdrawCycleForDeleg(deleg_addr : ByStr20, ssn_addr: ByStr20, cycle: Uint32, initiator : ByStr20)
PopulateLastBufDepositCycleDeleg(deleg_addr: ByStr20, ssn_addr: ByStr20, cycle: Uint32)PopulateLastBufDepositCycleDeleg(deleg_addr : ByStr20, ssn_addr: ByStr20, cycle: Uint32, initiator : ByStr20)
PopulateBuffDeposit(deleg_addr: ByStr20, ssn_addr: ByStr20, cycle: Uint32, amt: Uint128)PopulateBuffDeposit(deleg_addr: ByStr20, ssn_addr: ByStr20, cycle: Uint32, amt: Uint128, initiator : ByStr20)
PopulateDirectDeposit(deleg_addr: ByStr20, ssn_addr: ByStr20, cycle: Uint32, amt: Uint128)PopulateDirectDeposit(deleg_addr: ByStr20, ssn_addr: ByStr20, cycle: Uint32, amt: Uint128, initiator : ByStr20)
PopulateDepositAmtDeleg(deleg_addr: ByStr20, ssn_addr: ByStr20, amt: Uint128)PopulateDepositAmtDeleg(deleg_addr: ByStr20, ssn_addr: ByStr20, amt: Uint128, initiator : ByStr20)
PopulateDelegStakePerCycle(deleg_addr: ByStr20, ssn_addr: ByStr20, cycle: Uint32, amt: Uint128)PopulateDelegStakePerCycle(deleg_addr: ByStr20, ssn_addr: ByStr20, cycle: Uint32, amt: Uint128, initiator : ByStr20)
PopulateLastRewardCycle(cycle: Uint32)PopulateLastRewardCycle(cycle: Uint32, initiator : ByStr20)
PopulateCommForSSN(ssn_addr: ByStr20, cycle: Uint32, comm: Uint128)PopulateCommForSSN(ssn_addr: ByStr20, cycle: Uint32, comm: Uint128, initiator : ByStr20)
PopulateTotalStakeAmt(amt: Uint128)PopulateTotalStakeAmt(amt: Uint128, initiator : ByStr20)
PopulateDelegSwapRequest(requestor: ByStr20, new_deleg_addr: ByStr20)PopulateDelegSwapRequest(requestor: ByStr20, new_deleg_addr: ByStr20, initiator: ByStr20)
DrainContractBalance(amt: Uint128)DrainContractBalance(amt: Uint128, initiator : ByStr20)
CleanBuffDeposit(deleg_addr_list: List ByStr20, ssn_addr_list: List (Pair ByStr20 ByStr20))CleanBuffDeposit(deleg_addr_list: List ByStr20, ssn_addr_list: List (Pair ByStr20 ByStr20), initiator: ByStr20)
CleanDirectDeposit(deleg_addr_list: List ByStr20, ssn_addr_list: List (Pair ByStr20 ByStr20))CleanDirectDeposit(deleg_addr_list: List ByStr20, ssn_addr_list: List (Pair ByStr20 ByStr20), initiator: ByStr20)
CleanDelegStakePerCycle(deleg_addr_list: List ByStr20, ssn_addr_list: List (Pair ByStr20 ByStr20))CleanDelegStakePerCycle(deleg_addr_list: List ByStr20, ssn_addr_list: List (Pair ByStr20 ByStr20), initiator: ByStr20)
CleanDepositAmt(deleg_addr_list: List ByStr20)CleanDepositAmt(deleg_addr_list: List ByStr20, initiator: ByStr20)
CleanPendingWithdrawal(deleg_addr_list: List ByStr20)CleanPendingWithdrawal(deleg_addr_list: List ByStr20, initiator: ByStr20)
CleanLastWithdrawCycle(deleg_addr_list: List ByStr20)CleanLastWithdrawCycle(deleg_addr_list: List ByStr20, initiator: ByStr20)
CleanLastBuffDepositCycle(deleg_addr_list: List ByStr20)CleanLastBuffDepositCycle(deleg_addr_list: List ByStr20, initiator: ByStr20)
MigrateCommForSsn(keys: List ByStr20, old_contract: ByStr20)MigrateCommForSsn(initiator: ByStr20, keys: List ByStr20, old_contract: ByStr20 with contract field comm_for_ssn: Map ByStr20 (Map Uint32 Uint128) end
MigrateDepositAmtDeleg(keys: List ByStr20, old_contract: ByStr20)MigrateDepositAmtDeleg(initiator: ByStr20, keys: List ByStr20, old_contract: ByStr20 with contract field deposit_amt_deleg: Map ByStr20 (Map ByStr20 Uint128) end
MigrateSsnDelegAmt(keys: List ByStr20, old_contract: ByStr20)MigrateSsnDelegAmt(initiator: ByStr20, keys: List ByStr20, old_contract: ByStr20 with contract field ssn_deleg_amt: Map ByStr20 (Map ByStr20 Uint128) end
MigrateBuffDepositDeleg(keys: List ByStr20, old_contract: ByStr20)MigrateBuffDepositDeleg(initiator: ByStr20, keys: List ByStr20, old_contract: ByStr20 with contract field buff_deposit_deleg: Map ByStr20 (Map ByStr20 (Map Uint32 Uint128)) end
MigrateDirectDepositDeleg(keys: List ByStr20, old_contract: ByStr20)MigrateDirectDepositDeleg(initiator: ByStr20, keys: List ByStr20, old_contract: ByStr20 with contract field direct_deposit_deleg: Map ByStr20 (Map ByStr20 (Map Uint32 Uint128)) end
MigrateLastWithdrawCycleDeleg(keys: List ByStr20, old_contract: ByStr20)MigrateLastWithdrawCycleDeleg(initiator: ByStr20, keys: List ByStr20, old_contract: ByStr20 with contract field last_withdraw_cycle_deleg: Map ByStr20 (Map ByStr20 Uint32) end
MigrateLastBufDepositCycleDeleg(keys: List ByStr20, old_contract: ByStr20)MigrateLastBufDepositCycleDeleg(initiator: ByStr20, keys: List ByStr20, old_contract: ByStr20 with contract field last_buf_deposit_cycle_deleg: Map ByStr20 (Map ByStr20 Uint32) end
MigrateDelegStakePerCycle(keys: List ByStr20, old_contract: ByStr20)MigrateDelegStakePerCycle(initiator: ByStr20, keys: List ByStr20, old_contract: ByStr20 with contract field deleg_stake_per_cycle: Map ByStr20 (Map ByStr20 (Map Uint32 Uint128)) end
MigrateWithdrawalPending(keys: List ByStr20, old_contract: ByStr20)MigrateWithdrawalPending(initiator: ByStr20, keys: List ByStr20, old_contract: ByStr20 with contract field withdrawal_pending: Map ByStr20 (Map BNum Uint128) end

Note: Any transition in SSNList contract that accepts money will have the corresponding transition in SSNListProxy accept the amount and then pass it during the message call.

gZILToken Contract Specification

gZILToken contract is a ZRC-2 compliant token contract with a few minor modifications. The contract defines two extra immutable variables init_minter (of type ByStr20) and end_block (of type BNum). The former is the initial minter of the contract allowed to mint tokens, while the latter stores the block number until which minting is allowed. It also introduces a mutable field minter(of type ByStr20) initialized to init_minter and a transition ChangeMinter(new_minter: ByStr20) to update the address of the minter. Since gZILToken won't require buring, the Burn transition from the ZRC-2 specification is removed.

The modified Mint transition to be called by the minter:

transition Mint(recipient: ByStr20, amount: Uint128)
current_block <-&BLOCKNUMBER;
is_minting_over = builtin blt end_block current_block;
match is_minting_over with|True=>|False=>IsMinter;
AuthorizedMint recipient amount;
(* Prevent sending to a contract address that does not support transfers of token *)
msg_to_recipient = {_tag: "RecipientAcceptMint";_recipient: recipient;_amount: zero;minter: _sender;recipient: recipient;amount: amount};
msgs = one_msg msg_to_recipient;
send msgs
end
end

The ChangeMintertransition to be called by the minter:

transition ChangeMinter(new_minter: ByStr20, initiator: ByStr20)
IsOwner initiator;
minter := new_minter;
e = {_eventname: "ChangedMinter";new_minter: new_minter};
event e end

As tokens are rewarded when a delegator claims its staking rewards within the SSNList contract, the minter of the gZILToken contract will be the address of the SSNList contract.

Multi-signature Wallet Contract Specification

This contract has two main roles. First, it holds funds that can be paid out to arbitrary users, provided that enough people from a pre-defined set of owners have signed off on the payout.

Second, and more generally, it also represents a group of users that can invoke a transition in another contract only if enough people in that group have signed off on it. In the staking context, it represents the admin in the SSNList contract. This provides added security for the privileged admin role.

General Flow

Any transaction request (whether transfer of payments or invocation of a foreign transition) must be added to the contract before signatures can be collected. Once enough signatures are collected, the recipient (in case of payments) and/or any of the owners (in the general case) can ask for the transaction to be executed.

If an owner changes his mind about a transaction, the signature can be revoked until the transaction is executed.

This wallet does not allow adding or removing owners, or changing the number of required signatures. To do any of those, perform the following steps:

  1. Deploy a new wallet with owners and required_signatures set to the new values. MAKE SURE THAT THE NEW WALLET HAS BEEN SUCCESFULLY DEPLOYED WITH THE CORRECT PARAMETERS BEFORE CONTINUING!
  2. Invoke the SubmitTransaction transition on the old wallet with the following parameters:
    • recipient : The address of the new wallet
    • amount : The _balance of the old wallet
    • tag : AddFunds
  3. Have (a sufficient number of) the owners of the old contract invoke the SignTransaction transition on the old wallet. The parameter transactionId should be set to the Id of the transaction created in step 2.
  4. Have one of the owners of the old contract invoke the ExecuteTransaction transition on the old contract. This will cause the entire balance of the old contract to be transferred to the new wallet. Note that no un-executed transactions will be transferred to the new wallet along with the funds.

WARNING: If a sufficient number of owners lose their private keys, or for any other reason are unable or unwilling to sign for new transactions, the funds in the wallet will be locked forever. It is therefore a good idea to set required_signatures to a value strictly less than the number of owners, so that the remaining owners can retrieve the funds should such a scenario occur.

If an owner loses his private key, the remaining owners should move the funds to a new wallet (using the workflow described above) to ensure that funds are not locked if another owner loses his private key. The owner who originally lost his private key can generate a new key, and the corresponding address be added to the new wallet, so that the same set of people own the new wallet.

Roles and Privileges

The table below list the different roles defined in the contract.

NameDescription & Privileges
ownersThe users who own this contract.

Immutable Parameters

The table below lists the parameters that are defined at the contract deployment time and hence cannot be changed later on.

NameTypeDescription
owners_listList ByStr20List of initial owners.
required_signaturesUint32Minimum amount of signatures to execute a transaction.

Mutable Fields

The table below presents the mutable fields of the contract and their initial values.

NameTypeInitial ValueDescription
ownersMap ByStr20 Boolowners_listMap of owners.
transactionCountUint320The number of of transactions requests submitted so far.
signaturesMap Uint32 (Map ByStr20 Bool)Emp Uint32 (Map ByStr20 Bool)Collected signatures for transactions by transaction ID.
signature_countsMap Uint32 Uint32Emp Uint32 Uint32Running count of collected signatures for transactions.
transactionsMap Uint32 TransactionEmp Uint32 TransactionTransactions that have been submitted but not exected yet.

Transitions

All the transitions in the contract can be categorized into three categories:

  • Submit Transitions: Create transactions for future signoff.
  • Action Transitions: Let owners sign, revoke or execute submitted transactions.
  • The _balance field keeps the amount of funds held by the contract and can be freely read within the implementation. AddFunds transition are used for adding native funds(ZIL) to the wallet from incoming messages by using accept keyword.

Submit Transitions

The first transition is meant to submit request for transfer of native ZILs while the other are meant to submit a request to invoke transitions in the SSNListProxy contract.

NameParamsDescription
SubmitNativeTransactionrecipient : ByStr20, amount : Uint128, tag : StringSubmit a request for transfer of native tokens for future signoffs.
SubmitCustomUpgradeToTransactioncalleeContract : ByStr20, newImplementation : ByStr20Submit a request to invoke the UpgradeTo transition in the SSNListProxy contract.
SubmitCustomChangeProxyAdminTransactioncalleeContract : ByStr20, newAdmin : ByStr20Submit a request to invoke the ChangeProxyAdmin transition in the SSNListProxy contract.
SubmitCustomClaimProxyAdminTransactioncalleeContract : ByStr20Submit a request to invoke the ClaimProxyAdmin transition in the SSNListProxy contract.
SubmitCustomChangeMinterTransactioncalleeContract : ByStr20, new_minter : ByStr20Submit a request to invoke the ChangeMinter transition in the gZILToken contract.
SubmitCustomPauseTransactioncalleeContract : ByStr20Submit a request to invoke the Pause transition in the SSNListProxy contract.
SubmitCustomUnpauseTransactioncalleeContract : ByStr20Submit a request to invoke the UnPause transition in the SSNListProxy contract.
SubmitCustomUpdateAdminTransactioncalleeContract : ByStr20, admin : ByStr20Submit a request to invoke the UpdateAdmin transition in the SSNListProxy contract.
SubmitCustomClaimAdminTransaction`calleeContract : ByStr20Submit a request to invoke the ClaimAdmin transition in the SSNListProxy contract.
SubmitCustomUpdateVerifierTransactioncalleeContract : ByStr20, verif : ByStr20Submit a request to invoke the UpdateVerifier transition in the SSNListProxy contract.
SubmitCustomUpdateVerifierRewardAddrTransactioncalleeContract : ByStr20, verif : ByStr20Submit a request to invoke the UpdateVerifierRewardAddr transition in the SSNListProxy contract.
SubmitCustomUpdateStakingParametersTransactioncalleeContract : ByStr20, min_stake : Uint128, min_deleg_stake : Uint128, max_comm_change_rate : Uint128Submit a request to invoke the UpdateStakingParameters transition in the SSNListProxy contract.
SubmitCustomChangeBNumReqTransactioncalleeContract : ByStr20, input_bnum_req : Uint128Submit a request to invoke the ChangeBNumReq transition in the SSNListProxy contract.
SubmitCustomUpdateGzilAddrTransactioncalleeContract : ByStr20, gzil_addr: ByStr20Submit a request to invoke the UpdateGzilAddr transition in the SSNListProxy contract.
SubmitCustomAddSSNTransactioncalleeContract : ByStr20, ssnaddr : ByStr20, stake_amount : Uint128, rewards : Uint128, urlraw : String, urlapi : String, buffered_deposit : Uint128Submit a request to invoke the AddSSN transition in the SSNListProxy contract.
SubmitCustomUpdateSSNTransactioncalleeContract : ByStr20, ssnaddr : ByStr20, new_name : String, new_urlraw : String, new_urlapi : StringSubmit a request to invoke the UpdateSSN transition in the SSNListProxy contract.
SubmitCustomAddSSNAfterUpgradeTransactioncalleeContract: ByStr20, ssnaddr: ByStr20, stake_amt: Uint128, rewards: Uint128, name: String, urlraw: String, urlapi: String, buff_deposit: Uint128, comm: Uint128, comm_rewards: Uint128, rec_addr: ByStr20Submit a request to invoke the AddSSNAfterUpgrade transition in the SSNListProxy contract.
SubmitUpdateDelegTransactioncalleeContract: ByStr20, ssnaddr: ByStr20, deleg: ByStr20, stake_amt: Uint128Submit a request to invoke the UpdateDeleg transition in the SSNListProxy contract.
SubmitPopulateStakeSSNPerCycleTransactioncalleeContract : ByStr20, ssn_address : ByStr20, cycle : Uint32, totalAmt: Uint128, rewards: Uint128Submit a request to invoke the PopulateStakeSSNPerCycle transition in the SSNListProxy contract.
SubmitPopulateLastWithdrawCycleForDelegTransactioncalleeContract : ByStr20, deleg_address : ByStr20, ssn_address : ByStr20, cycle : Uint32Submit a request to invoke the PopulateLastWithdrawCycleForDeleg transition in the SSNListProxy contract.
SubmitPopulateLastBufDepositCycleDelegTransactioncalleeContract : ByStr20, deleg_address : ByStr20, ssn_address : ByStr20, cycle : Uint32Submit a request to invoke the PopulateLastBufDepositCycleDeleg transition in the SSNListProxy contract.
SubmitPopulateBufferedDepositTransactioncalleeContract : ByStr20, deleg_address : ByStr20, ssn_address : ByStr20, cycle : Uint32, amount : Uint128Submit a request to invoke the PopulateBufferedDeposit transition in the SSNListProxy contract.
SubmitPopulateDirectDepositTransactioncalleeContract : ByStr20, deleg_address : ByStr20, ssn_address : ByStr20, cycle : Uint32, amount : Uint128Submit a request to invoke the PopulateDirectDeposit transition in the SSNListProxy contract.
SubmitPopulateDepositAmtDelegTransactioncalleeContract: ByStr20, deleg_addr: ByStr20, ssn_addr: ByStr20, amt: Uint128Submit a request to invoke the PopulateDepositAmt transition in the SSNListProxy contract.
SubmitPopulateDelegStakePerCycleTransactioncalleeContract: ByStr20, deleg_addr: ByStr20, ssn_addr: ByStr20, cycle: Uint32, amt: Uint128Submit a request to invoke the PopulateDelegStakePerCycle transition in the SSNListProxy contract.
SubmitPopulateLastRewardCycleTransactioncalleeContract: ByStr20, cycle: Uint32Submit a request to invoke the PopulateLastRewardCycle transition in the SSNListProxy contract.
SubmitPopulateCommForSSNTransactioncalleeContract : ByStr20, ssn_address : ByStr20, cycle : Uint32, comm : Uint128Submit a request to invoke the PopulateCommForSSN transition in the SSNListProxy contract.
SubmitPopulateTotalStakeAmtTransactioncalleeContract : ByStr20, amt : Uint128Submit a request to invoke the PopulateTotalStakeAmt transition in the SSNListProxy contract.
SubmitPopulatePendingWithdrawalTransactioncalleeContract : ByStr20, ssn_addr : ByStr20, block_number : BNum, stake : Uint128Submit a request to invoke the PopulatePendingWithdrawal transition in the SSNListProxy contract.
SubmitCustomDrainContractBalanceTransactioncalleeContract : ByStr20, amt : Uint128Submit a request to invoke the DrainContractBalance transition in the SSNListProxy contract.

Action Transitions

NameParamsDescription
SignTransactiontransactionId : Uint32Sign off on an existing transaction.
RevokeSignaturetransactionId : Uint32Revoke signature of an existing transaction, if it has not yet been executed.
ExecuteTransactiontransactionId : Uint32Execute signed-off transaction.

About

This repository is the central portal that collates together the contracts, documentations around them, unit tests, and scripts to deploy and run the contracts on the network.

Resources

Stars

19 stars

Watchers

18 watching

Forks

Releases

Packages

Used by

Contributors

Languages