### Install OpenZeppelin Contracts with Forge Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Installs the necessary OpenZeppelin contracts (upgradeable and standard) using the Forge package manager. These contracts provide essential building blocks for smart contract development. ```bash forge install OpenZeppelin/openzeppelin-contracts-upgradeable forge install OpenZeppelin/openzeppelin-contracts ``` -------------------------------- ### Run End-to-End Tests for Zilliqa Liquid and Non-Liquid Staking Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Executes end-to-end tests on a local Zilliqa network after configuring Docker settings. These tests simulate validator setup, staking, unstaking, reward management, and validator removal. ```bash chmod +x e2e_liquid.sh && ./e2e_liquid.sh ``` ```bash chmod +x e2e_non-liquid.sh && ./e2e_non-liquid.sh ``` -------------------------------- ### Get Additional Steps for Reward Withdrawal Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Retrieves the number of additional staking periods to consider for reward withdrawals. This helps in estimating the maximum 'n' for partial withdrawals. Requires delegation contract address and delegator's address. ```bash cast call 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 "getAdditionalSteps()(uint64)" --from 0xd819fFcE7A58b1E835c25617Db7b46a00888B013 ``` -------------------------------- ### Query LST Balance with Cast Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Command to query the Liquid Staking Token (LST) balance of an account using Cast. It first calls a function to get the LST address and then queries the balance. ```bash cast call $(cast call 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 "getLST()(address)") "balanceOf(address)(uint256)" 0xd819fFcE7A58b1E835c25617Db7b46a00888B013 | sed 's/[[^]]*]//g' ``` -------------------------------- ### Execute Forge Tests for Zilliqa Staking Contracts Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Runs tests for Zilliqa staking contracts using the Forge testing framework. Supports verbose output for debugging. ```bash unset FOUNDRY_ETH_RPC_URL forge test ``` ```bash unset FOUNDRY_ETH_RPC_URL forge test -vv ``` -------------------------------- ### Verify LiquidDelegation Implementation Contract Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Verifies the implementation contract of a LiquidDelegation on Sourcify. Requires the implementation contract address. ```bash forge verify-contract 0x7C623e01c5ce2e313C223ef2aEc1Ae5C6d12D9DD LiquidDelegation --verifier sourcify ``` -------------------------------- ### Query Available Rewards (Non-Liquid Staking) Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Queries the amount of rewards available for withdrawal in non-liquid staking pools. It formats the output to ether units. ```bash cast to-unit $(cast call 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 "rewards()(uint256)" --from 0xd819fFcE7A58b1E835c25617Db7b46a00888B013 --block latest | sed 's/[[^]]*]//g') ether ``` -------------------------------- ### Verify NonLiquidDelegation Implementation Contract Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Verifies the implementation contract of a NonLiquidDelegation on Sourcify. Requires the implementation contract address. ```bash forge verify-contract 0x7C623e01c5ce2e313C223ef2aEc1Ae5C6d12D9DD NonLiquidDelegation --verifier sourcify ``` -------------------------------- ### Upgrade Delegated Staking Contract Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Upgrades an existing delegated staking contract to the latest version. Requires the proxy contract address and the PRIVATE_KEY environment variable to be set. ```bash forge script script/Upgrade.s.sol --broadcast --legacy --sig "run(address payable)" 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 ``` -------------------------------- ### Deploy NonLiquidDelegation Contract Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Deploys the NonLiquidDelegation contract, a variant that allows delegators to withdraw rewards. Requires the PRIVATE_KEY environment variable to be set. ```bash forge script script/Deploy.s.sol --broadcast --legacy --sig "nonLiquidDelegation()" ``` -------------------------------- ### Query Claimable ZIL with Cast Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Command to query the amount of ZIL that can be claimed using Cast. It requires the contract address and the address of the unstaking account. ```bash cast to-unit $(cast call 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 "getClaimable()(uint256)" --from 0xd819fFcE7A58b1E835c25617Db7b46a00888B013 --block latest | sed 's/[[^]]*]//g') ether ``` -------------------------------- ### Deploy LiquidDelegation Contract Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Deploys the LiquidDelegation contract, which manages delegated stakes and interacts with the Zilliqa 2.0 protocol's deposit contract. Requires setting the PRIVATE_KEY environment variable and providing the LST's Name and Symbol. ```bash forge script script/Deploy.s.sol --broadcast --legacy --sig "liquidDelegation(string,string)" Name Symbol ``` -------------------------------- ### Specify Zilliqa 2.0 Contracts in Remappings Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Configures the `remappings.txt` file to specify the local directory containing the Zilliqa 2.0 Solidity contracts. This is crucial for Forge to correctly resolve contract imports during compilation and deployment. ```plaintext @zilliqa/zq2/=/home/user/zq2/zilliqa/src/contracts/ ``` -------------------------------- ### Stake ZIL with Forge Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Command to stake ZIL using Forge, specifying the contract address, amount, and private key. Ensure the account has sufficient balance for fees and the staked amount. Minimum stake is 100 ZIL. ```bash forge script script/Stake.s.sol --broadcast --legacy --sig "run(address payable, uint256)" 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 200000000000000000000 --private-key 0x... ``` -------------------------------- ### Stake Rewards (Liquid Staking) Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Allows node operators to stake accrued rewards in liquid staking pools. Requires the delegation contract address and a private key. ```bash forge script script/StakeRewards.s.sol --broadcast --legacy --sig "run(address payable)" 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 --private-key 0x... ``` -------------------------------- ### Deposit for Initial Validator Node Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Initializes a node as the first validator in a staking pool by submitting a transaction with a stake deposit. This requires the delegation contract address, the node's BLS public key, peer ID, and BLS signature. A minimum stake (e.g., 10 million ZIL) is specified. ```bash cast send --legacy --value 10000000ether --private-key $PRIVATE_KEY \ 0x7a0b7e6d24ede78260c9ddbd98e828b0e11a8ea2 "depositFromPool(bytes,bytes,bytes)" \ 0x92fbe50544dce63cfdcc88301d7412f0edea024c91ae5d6a04c7cd3819edfc1b9d75d9121080af12e00f054d221f876c \ 0x002408011220d5ed74b09dcbe84d3b32a56c01ab721cf82809848b6604535212a219d35c412f \ 0xb14832a866a49ddf8a3104f8ee379d29c136f29aeb8fccec9d7fb17180b99e8ed29bee2ada5ce390cb704bc6fd7f5ce814f914498376c4b8bc14841a57ae22279769ec8614e2673ba7f36edc5a4bf5733aa9d70af626279ee2b2cde939b4bd8a ``` -------------------------------- ### Stake Rewards using stakeRewards.sh Script Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Automatically stakes all accrued rewards for a delegator. Requires the delegator's address and private key. ```bash # stake all rewards accrued so far chmod +x stakeRewards.sh && ./stakeRewards.sh 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 0x... ``` -------------------------------- ### Stake ZIL using stake.sh Script Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Stakes a specified amount of ZIL for a delegator. Requires the delegator's address, a private key, and the amount to stake. ```bash # stake 200 ZIL chmod +x stake.sh && ./stake.sh 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 0x... 200000000000000000000 ``` -------------------------------- ### Replace Delegator Address (Step 1) Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Sets the new delegator address using the private key of the current address. Requires the delegation contract address, the new address, and the current private key. ```bash cast send --legacy --private-key 0x... 0x7a0b7e6d24ede78260c9ddbd98e828b0e11a8ea2 "setNewAddress(address)" 0x092E5E57955437876dA9Df998C96e2BE19341670 ``` -------------------------------- ### Set Foundry RPC URL Environment Variable Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Sets the `FOUNDRY_ETH_RPC_URL` environment variable, which is required for Forge to connect to an Ethereum RPC node. This allows Forge scripts to interact with the blockchain. ```bash export FOUNDRY_ETH_RPC_URL=http://localhost:4202 ``` -------------------------------- ### Claim Unstaked ZIL with Forge Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Command to claim unstaked ZIL after the unbonding period using Forge. Requires the private key of the account that initiated the unstake. ```bash forge script script/Claim.s.sol --broadcast --legacy --sig "run(address payable)" 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 --private-key 0x... ``` -------------------------------- ### Query LST Price with Cast Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Command to query the current price of an LST using Cast. It retrieves the price from the contract and converts it to Ether. ```bash cast to-unit $(cast call 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 "getPrice()(uint256)" --block latest | sed 's/[[^]]*]//g') ether ``` -------------------------------- ### Claim Unstaked ZIL using claim.sh Script Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Claims unstaked ZIL for a delegator. Requires the delegator's address and private key. ```bash # claim the unstaked ZIL chmod +x claim.sh && ./claim.sh 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 0x... ``` -------------------------------- ### Replace Delegator Address (Step 2) Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Replaces the old delegator address with the new one using the private key of the new address. Requires the delegation contract address, the old address, and the new private key. ```bash cast send --legacy --private-key 0x... 0x7a0b7e6d24ede78260c9ddbd98e828b0e11a8ea2 "replaceOldAddress(address)" 0xd819fFcE7A58b1E835c25617Db7b46a00888B013 ``` -------------------------------- ### Verify ERC1967Proxy for LiquidStaking Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Verifies the ERC1967Proxy contract for a LiquidStaking deployment on Sourcify. Requires the proxy address, implementation address, signer address, and token Name/Symbol. ```bash forge verify-contract 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 ERC1967Proxy --verifier sourcify --constructor-args $(cast abi-encode "_(address,bytes)" 0x7C623e01c5ce2e313C223ef2aEc1Ae5C6d12D9DD $(cast calldata "initialize(address,string,string)" 0x15fc323DFE5D5DCfbeEdc25CEcbf57f676634d77 Name Symbol)) ``` -------------------------------- ### Check Delegated Staking Contract Version Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Retrieves the current version of the upgraded delegated staking contract. Requires the proxy contract address. ```bash forge script script/CheckVersion.s.sol --sig "run(address payable)" 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 ``` -------------------------------- ### Deposit Specific Amount using cast send Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md This command allows depositing a specific amount of ZIL (e.g., 10 million) from a delegation contract's available stake. It uses the `depositFromPool(bytes,bytes,bytes,uint256)` function signature and includes the amount as the last argument. The deposit takes effect in the epoch after next. ```bash cast send --legacy --value 5000000ether --private-key $PRIVATE_KEY \ 0x7a0b7e6d24ede78260c9ddbd98e828b0e11a8ea2 "depositFromPool(bytes,bytes,bytes,uint256)" \ 0x92fbe50544dce63cfdcc88301d7412f0edea024c91ae5d6a04c7cd3819edfc1b9d75d9121080af12e00f054d221f876c \ 0x002408011220d5ed74b09dcbe84d3b32a56c01ab721cf82809848b6604535212a219d35c412f \ 0xb14832a866a49ddf8a3104f8ee379d29c136f29aeb8fccec9d7fb17180b99e8ed29bee2ada5ce390cb704bc6fd7f5ce814f914498376c4b8bc14841a57ae22279769ec8614e2673ba7f36edc5a4bf5733aa9d70af626279ee2b2cde939b4bd8a \ 10000000000000000000000000 ``` -------------------------------- ### Deposit Stake to Activate Validator using cast send Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md This command deposits 5 million ZIL to activate a validator. It requires the private key of the sender, the contract address, the function signature, and the peer ID in hex encoding. The deposit takes effect in the epoch after next. ```bash cast send --legacy --value 5000000ether --private-key $PRIVATE_KEY \ 0x7a0b7e6d24ede78260c9ddbd98e828b0e11a8ea2 "depositFromPool(bytes,bytes,bytes)" \ 0x92fbe50544dce63cfdcc88301d7412f0edea024c91ae5d6a04c7cd3819edfc1b9d75d9121080af12e00f054d221f876c \ 0x002408011220d5ed74b09dcbe84d3b32a56c01ab721cf82809848b6604535212a219d35c412f \ 0xb14832a866a49ddf8a3104f8ee379d29c136f29aeb8fccec9d7fb17180b99e8ed29bee2ada5ce390cb704bc6fd7f5ce814f914498376c4b8bc14841a57ae22279769ec8614e2673ba7f36edc5a4bf5733aa9d70af626279ee2b2cde939b4bd8a ``` -------------------------------- ### Verify ERC1967Proxy for NonLiquidStaking Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Verifies the ERC1967Proxy contract for a NonLiquidStaking deployment on Sourcify. Requires the proxy address, implementation address, and signer address. ```bash forge verify-contract 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 ERC1967Proxy --verifier sourcify --constructor-args $(cast abi-encode "_(address,bytes)" 0x7C623e01c5ce2e313C223ef2aEc1Ae5C6d12D9DD $(cast calldata "initialize(address)" 0x15fc323DFE5D5DCfbeEdc25CEcbf57f676634d77)) ``` -------------------------------- ### Convert Key for Validator Deposit Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Generates the necessary BLS public key and signature for depositing into a staking pool. This utility requires the secret key, chain ID, and the delegation contract address as input. ```bash echo '{"secret_key":"...", "chain_id":..., "control_address":"0x7a0b7e6d24ede78260c9ddbd98e828b0e11a8ea2"}' | cargo run --bin convert-key ``` -------------------------------- ### Display Delegator Stake State using state.sh Script Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Queries and displays the current staking state of a delegator from a validator's local node. Requires the delegator's address and the validator's node address. ```bash # display the current state of the stake of the below delegator address chmod +x state.sh && ./state.sh 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 0xd819fFcE7A58b1E835c25617Db7b46a00888B013 ``` -------------------------------- ### Verify NonRebasingLST Contract Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Verifies the NonRebasingLST contract used in LiquidStaking deployments on Sourcify. Requires the LST contract address, Name, and Symbol. ```bash forge verify-contract $(cast call 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 "getLST()(address)") NonRebasingLST --verifier sourcify --constructor-args $(cast abi-encode "_(string,string)" Name Symbol) ``` -------------------------------- ### Unstake ZIL using unstake.sh Script Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Unstakes a specified amount of ZIL or unstakes all staked ZIL for a delegator. Requires the delegator's address, a private key, and optionally the amount to unstake. ```bash # unstake 100 ZIL chmod +x unstake.sh && ./unstake.sh 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 0x... 100000000000000000000 ``` ```bash # unstake all staked ZIL chmod +x unstake.sh && ./unstake.sh 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 0x... ``` -------------------------------- ### Withdraw Specific Amount of Rewards Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Withdraws a specified amount of ZIL (e.g., 1000 ZIL) along with a number of staking periods 'n'. Requires delegation contract address, amount in Wei, number of periods, and a private key. ```bash forge script script/WithdrawRewards.s.sol --broadcast --legacy --sig "run(address payable, string, string)" 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 1000000000000000000000 100 --private-key 0x... ``` -------------------------------- ### Complete Validator Leaving Process Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Completes the process of a validator node leaving a staking pool after any pending withdrawals have been processed and the unbonding period has passed. Requires the node's private key and BLS public key. ```bash cast send --legacy --private-key 0x... \ 0x7a0b7e6d24ede78260c9ddbd98e828b0e11a8ea2 "completeLeaving(bytes)" \ 0x92fbe50544dce63cfdcc88301d7412f0edea024c91ae5d6a04c7cd3819edfc1b9d75d9121080af12e00f054d221f876c ``` -------------------------------- ### Join Staking Pool Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Adds a registered validator node to a staking pool. This action must be performed by the staking pool's contract owner using the node's BLS public key. ```bash cast send --legacy --private-key $PRIVATE_KEY \ 0x7a0b7e6d24ede78260c9ddbd98e828b0e11a8ea2 "joinPool(bytes)" \ 0x92fbe50544dce63cfdcc88301d7412f0edea024c91ae5d6a04c7cd3819edfc1b9d75d9121080af12e00f054d221f876c ``` -------------------------------- ### View Current Commission Rate for Zilliqa Staking Pool Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Queries the current commission rate of a Zilliqa staking pool. The rate is returned as an integer that needs to be divided by the contract's DENOMINATOR. ```bash forge script script/Configure.s.sol --broadcast --legacy --sig "commissionRate(address payable)" 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 ``` -------------------------------- ### Estimate Gas for Full Reward Withdrawal Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Estimates the gas required for withdrawing all rewards without submitting the transaction. Helps prevent gas limit errors. Requires delegation contract address and delegator's address. ```bash cast estimate 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 "withdrawlAllRewards()" --from 0xd819fFcE7A58b1E835c25617Db7b46a00888B013 --gas-limit 84000000 ``` -------------------------------- ### Set Commission Rate for Zilliqa Staking Pool Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Sets the commission rate for rewards earned by validators in a staking pool. The rate is specified as an integer to be divided by a denominator. Restrictions apply if the pool holds delegated stake. ```bash forge script script/Configure.s.sol --broadcast --legacy --sig "commissionRate(address payable, uint16)" 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 1000 ``` -------------------------------- ### Withdraw Partial Rewards (Non-Liquid Staking) Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Withdraws rewards accrued during the next 'n' staking periods. Useful when the total rewards might exceed block gas limits. Requires delegation contract address and delegator's address. ```bash cast to-unit $(cast call 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 "rewards(uint64)(uint256)" 100 --from 0xd819fFcE7A58b1E835c25617Db7b46a00888B013 --block latest | sed 's/[[^]]*]//g') ether ``` -------------------------------- ### Unstake ZIL/LST with Forge Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Command to unstake ZIL or LST using Forge, specifying the contract address, amount, and private key. The amount refers to ZIL for non-liquid staking and LST for liquid staking. Minimum unstake is 100 ZIL/LST, unless unstaking the entire balance. ```bash forge script script/Unstake.s.sol --broadcast --legacy --sig "run(address payable, uint256)" 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 100000000000000000000 --private-key 0x... ``` -------------------------------- ### Withdraw Rewards using withdrawRewards.sh Script Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Withdraws accrued rewards for a delegator. Supports withdrawing all rewards, a specific amount, or rewards accrued within a specific period. ```bash # withdraw all rewards accrued so far chmod +x withdrawRewards.sh && ./withdrawRewards.sh 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 0x... ``` ```bash # withdraw 10 ZIL from the rewards accrued so far chmod +x withdrawRewards.sh && ./withdrawRewards.sh 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 0x... 10000000000000000000 ``` ```bash # withdraw 10 ZIL from the rewards accrued during the next 1000 (un)stakings chmod +x withdrawRewards.sh && ./withdrawRewards.sh 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 0x... 10000000000000000000 1000 ``` -------------------------------- ### Check Delegated Staking Contract Variant Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Determines the variant (LiquidStaking or NonLiquidStaking) of a given delegation contract proxy address. This is useful if the contract type is unknown. ```bash forge script script/CheckVariant.s.sol --sig "run(address payable)" 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 ``` -------------------------------- ### Collect Outstanding Commission for Zilliqa Staking Pool Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Allows the contract owner to request the transfer of any outstanding commission that has not yet been automatically transferred. This is typically run when rewards have accrued but not yet distributed. ```bash forge script script/CollectCommission.s.sol --broadcast --legacy --sig "run(address payable)" 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 ``` -------------------------------- ### Set Commission Receiver for Zilliqa Staking Pool Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Changes the address that will receive the deducted commission. This can be a cold wallet, multisig wallet, or a smart contract for proportional splitting. ```bash forge script script/Configure.s.sol --broadcast --legacy --sig "commissionReceiver(address payable, address)" 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 0xeA78aAE5Be606D2D152F00760662ac321aB8F017 ``` -------------------------------- ### View Commission Change Block for Zilliqa Staking Pool Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Retrieves the block height of the last change made to the commission rate of a Zilliqa staking pool. This is useful for understanding rate change limitations. ```bash forge script script/Configure.s.sol --broadcast --legacy --sig "commissionChange(address payable)" 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 ``` -------------------------------- ### View Current Commission Receiver for Zilliqa Staking Pool Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Retrieves the current address designated to receive commission payments from the Zilliqa staking pool. This helps in verifying the configured recipient. ```bash forge script script/Configure.s.sol --broadcast --legacy --sig "commissionReceiver(address payable)" 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 ``` -------------------------------- ### Retrieve DENOMINATOR from Zilliqa Delegation Contract Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Fetches the DENOMINATOR value from a Zilliqa delegation contract. This value is used to interpret the commission rate values returned by the contract. ```bash cast call 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 "DENOMINATOR()(uint256)" | sed 's/[[^]]*]//g' ``` -------------------------------- ### Leave Staking Pool Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Initiates the process for a validator node to leave a staking pool. This command requires the node's control address private key, BLS public key, and the staking pool's delegation contract address. A validator cannot leave if there are pending stake withdrawals. ```bash cast send --legacy --private-key 0x... \ 0x7a0b7e6d24ede78260c9ddbd98e828b0e11a8ea2 "leavePool(bytes)" \ 0x92fbe50544dce63cfdcc88301d7412f0edea024c91ae5d6a04c7cd3819edfc1b9d75d9121080af12e00f054d221f876c ``` -------------------------------- ### Register Validator Node Control Address Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Registers a validator node's control address with a staking pool. This is a prerequisite for a validator to join a pool. It requires the node's private key and BLS public key. ```bash cast send --legacy --private-key 0x... \ 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 "registerControlAddress(bytes)" \ 0x92fbe50544dce63cfdcc88301d7412f0edea024c91ae5d6a04c7cd3819edfc1b9d75d9121080af12e00f054d221f876c ``` -------------------------------- ### Set Validator Node Control Address Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Sets or updates the control address for a validator node within the staking system. This command is used after registering the control address and requires the private key, BLS public key, and the staking pool's delegation contract address. ```bash cast send --legacy --private-key 0x... \ 0x00000000005a494c4445504f53495450524f5859 "setControlAddress(bytes,address)" \ 0x92fbe50544dce63cfdcc88301d7412f0edea024c91ae5d6a04c7cd3819edfc1b9d75d9121080af12e00f054d221f876c \ 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 ``` -------------------------------- ### Check for Pending Withdrawals Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Queries the staking pool contract to determine if a validator node has any pending stake withdrawals. This is crucial before attempting to leave the pool, as pending withdrawals must be resolved first. Returns a boolean indicating the presence of pending withdrawals. ```bash cast call 0x7a0b7e6d24ede78260c9ddbd98e828b0e11a8ea2 "pendingWithdrawals(bytes)(bool)" \ 0x92fbe50544dce63cfdcc88301d7412f0edea024c91ae5d6a04c7cd3819edfc1b9d75d9121080af12e00f054d221f876c ``` -------------------------------- ### Unregister Validator Node Control Address Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md Cancels the registration of a validator node's control address if the handover to a staking pool has not yet been completed by the pool owner. Requires the same private key and BLS public key used for registration. ```bash cast send --legacy --private-key 0x... \ 0x7A0b7e6D24eDe78260c9ddBD98e828B0e11A8EA2 "unregisterControlAddress(bytes)" \ 0x92fbe50544dce63cfdcc88301d7412f0edea024c91ae5d6a04c7cd3819edfc1b9d75d9121080af12e00f054d221f876c ``` -------------------------------- ### Validator Leaving Event Source: https://github.com/zilliqa/delegated_staking/blob/main/README.md The ValidatorLeaving event emitted by the staking pool contract to indicate the success or failure of a validator's request to leave the pool. It includes the validator's BLS public key and a boolean success status. ```solidity event ValidatorLeaving(bytes indexed blsPubKey, bool success); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.