Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation updates for distribution and staking precompiles #104

Merged
merged 4 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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. 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);
```

<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
- `delegattion`: Queries delegation for a given delegator and validator address
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

```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
Loading