Skip to content

Commit

Permalink
Merge pull request #104 from sei-protocol/feature/distribution_stakin…
Browse files Browse the repository at this point in the history
…g_precompile_updates

Documentation updates for distribution and staking precompiles
  • Loading branch information
dssei authored Aug 9, 2024
2 parents 1a8abfe + d1259bd commit 92b28d7
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
36 changes: 36 additions & 0 deletions pages/dev-interoperability/precompiles/distribution.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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. Rewards are usually returned as decimals.
/// To calculate the actual amount, divide the amount by decimals.
function rewards(
address delegatorAddress
) external view returns (Rewards rewards);
```

<Callout type="info">
View the distribution precompile source code and the contract ABI
Expand Down
31 changes: 31 additions & 0 deletions pages/dev-interoperability/precompiles/staking.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,37 @@ This precompile allows EVM contracts to interact with Sei's staking module, enab
) external returns (bool success);
```

### Queries
- `delegation`: 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);
```

<Callout type="info">
View the Staking precompile source code and the contract ABI
[here](https://github.com/sei-protocol/sei-chain/tree/evm/precompiles/staking).
Expand Down

0 comments on commit 92b28d7

Please sign in to comment.