From a626d10dc65f3de034fe57489a442af5f17b8e41 Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Wed, 17 Jul 2024 17:27:50 -0700 Subject: [PATCH 1/4] Distribution and Staking precompiles doc updates --- .../precompiles/distribution.mdx | 36 +++++++++++++++++++ .../precompiles/staking.mdx | 32 +++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/pages/dev-interoperability/precompiles/distribution.mdx b/pages/dev-interoperability/precompiles/distribution.mdx index fc5b1996..ab4ada4a 100644 --- a/pages/dev-interoperability/precompiles/distribution.mdx +++ b/pages/dev-interoperability/precompiles/distribution.mdx @@ -28,6 +28,42 @@ This precompile enables EVM clients to withdraw distributions and staking reward string memory validator ) external returns (bool success); ``` +- `withdrawMultipleDelegationRewards`: Withdraws delegation rewards from the given validators. +```solidity + /// Withdraws delegation rewards from the given validators. + /// @param validators The Sei addresses of the validators to withdraw rewards from. + /// @return Whether the operation was a success. + function withdrawMultipleDelegationRewards( + string[] memory validators + ) external returns (bool success); + ``` +### Queries + +- `rewards`: Queries rewards available for a given delegator address. +```solidity + struct Coin { + uint256 amount; + uint256 decimals; + string denom; + } + + struct Reward { + Coin[] coins; + string validator_address; + } + + struct Rewards { + Reward[] rewards; + Coin[] total; + } + /// Queries rewards available for a given delegator address. + /// @param delegatorAddress The x0 or Sei address of the delegator. + /// @return the Rewards object. Reewards are usually returned as decimals. + /// To calculate the actual amount, divide the amount by decimals. + function rewards( + address delegatorAddress + ) external view returns (Rewards rewards); + ``` View the distribution precompile source code and the contract ABI diff --git a/pages/dev-interoperability/precompiles/staking.mdx b/pages/dev-interoperability/precompiles/staking.mdx index 138a4d2a..b69f92d3 100644 --- a/pages/dev-interoperability/precompiles/staking.mdx +++ b/pages/dev-interoperability/precompiles/staking.mdx @@ -47,6 +47,38 @@ This precompile allows EVM contracts to interact with Sei's staking module, enab ) external returns (bool success); ``` +### Queries +- `delegattion`: Queries delegation for a given delegator and validator address + ```solidity + struct Delegation { + Balance balance; + DelegationDetails delegation; + } + + struct Balance { + uint256 amount; + string denom; + } + + struct DelegationDetails { + string delegator_address; + uint256 shares; + uint256 decimals; + string validator_address; + } + + /// Queries delegation for a given delegator and validator address. + /// @param delegatorAddress The x0 or Sei address of the delegator. + /// @param valAddress The Sei address of the validator. + /// @return The delegation information. Shares in DelegationDetails are usually returned as decimals. + /// To calculate the actual amount, divide the shares by decimals. + function delegation( + address delegator, + string memory valAddress + ) external view returns (Delegation delegation); + ``` + + View the Staking precompile source code and the contract ABI [here](https://github.com/sei-protocol/sei-chain/tree/evm/precompiles/staking). From 561ffc91a348734d04c6e618a233cdfab79883e2 Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Wed, 17 Jul 2024 17:32:23 -0700 Subject: [PATCH 2/4] remove extra line --- pages/dev-interoperability/precompiles/staking.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/pages/dev-interoperability/precompiles/staking.mdx b/pages/dev-interoperability/precompiles/staking.mdx index b69f92d3..b1ce831f 100644 --- a/pages/dev-interoperability/precompiles/staking.mdx +++ b/pages/dev-interoperability/precompiles/staking.mdx @@ -78,7 +78,6 @@ This precompile allows EVM contracts to interact with Sei's staking module, enab ) external view returns (Delegation delegation); ``` - View the Staking precompile source code and the contract ABI [here](https://github.com/sei-protocol/sei-chain/tree/evm/precompiles/staking). From dea6cabdd4bcd0f3febe551bc95378bf0b35627a Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Thu, 18 Jul 2024 10:51:30 -0700 Subject: [PATCH 3/4] fix typo --- pages/dev-interoperability/precompiles/staking.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/dev-interoperability/precompiles/staking.mdx b/pages/dev-interoperability/precompiles/staking.mdx index b1ce831f..cb8f693a 100644 --- a/pages/dev-interoperability/precompiles/staking.mdx +++ b/pages/dev-interoperability/precompiles/staking.mdx @@ -48,7 +48,7 @@ This precompile allows EVM contracts to interact with Sei's staking module, enab ``` ### Queries -- `delegattion`: Queries delegation for a given delegator and validator address +- `delegation`: Queries delegation for a given delegator and validator address ```solidity struct Delegation { Balance balance; From d1259bda52539b9b977c499495ff254433425bce Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Thu, 18 Jul 2024 11:29:57 -0700 Subject: [PATCH 4/4] fix typo 2 --- pages/dev-interoperability/precompiles/distribution.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/dev-interoperability/precompiles/distribution.mdx b/pages/dev-interoperability/precompiles/distribution.mdx index ab4ada4a..ecedd691 100644 --- a/pages/dev-interoperability/precompiles/distribution.mdx +++ b/pages/dev-interoperability/precompiles/distribution.mdx @@ -58,7 +58,7 @@ This precompile enables EVM clients to withdraw distributions and staking reward } /// Queries rewards available for a given delegator address. /// @param delegatorAddress The x0 or Sei address of the delegator. - /// @return the Rewards object. Reewards are usually returned as decimals. + /// @return the Rewards object. Rewards are usually returned as decimals. /// To calculate the actual amount, divide the amount by decimals. function rewards( address delegatorAddress