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

imp(staking): replace bech32 address with evm hex address for staking precompile contract #2200

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 20 additions & 20 deletions precompiles/staking/StakingI.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct Commission {

/// @dev Represents a validator in the staking module.
struct Validator {
string operatorAddress;
address operatorAddress;
string consensusPubkey;
bool jailed;
BondStatus status;
Expand All @@ -65,9 +65,9 @@ struct RedelegationResponse {

/// @dev Represents a redelegation between a delegator and a validator.
struct Redelegation {
string delegatorAddress;
string validatorSrcAddress;
string validatorDstAddress;
address delegatorAddress;
address validatorSrcAddress;
address validatorDstAddress;
RedelegationEntry[] entries;
}

Expand All @@ -87,9 +87,9 @@ struct RedelegationEntry {

/// @dev Represents the output of the Redelegation query.
struct RedelegationOutput {
string delegatorAddress;
string validatorSrcAddress;
string validatorDstAddress;
address delegatorAddress;
address validatorSrcAddress;
address validatorDstAddress;
RedelegationEntry[] entries;
}

Expand All @@ -105,8 +105,8 @@ struct UnbondingDelegationEntry {

/// @dev Represents the output of the UnbondingDelegation query.
struct UnbondingDelegationOutput {
string delegatorAddress;
string validatorAddress;
address delegatorAddress;
address validatorAddress;
UnbondingDelegationEntry[] entries;
}

Expand Down Expand Up @@ -149,7 +149,7 @@ interface StakingI is authorization.AuthorizationI {
/// @return success Whether or not the delegate was successful
function delegate(
address delegatorAddress,
string memory validatorAddress,
address validatorAddress,
uint256 amount
) external returns (bool success);

Expand All @@ -160,7 +160,7 @@ interface StakingI is authorization.AuthorizationI {
/// @return completionTime The time when the undelegation is completed
function undelegate(
address delegatorAddress,
string memory validatorAddress,
address validatorAddress,
uint256 amount
) external returns (int64 completionTime);

Expand All @@ -173,8 +173,8 @@ interface StakingI is authorization.AuthorizationI {
/// @return completionTime The time when the redelegation is completed
function redelegate(
address delegatorAddress,
string memory validatorSrcAddress,
string memory validatorDstAddress,
address validatorSrcAddress,
address validatorDstAddress,
uint256 amount
) external returns (int64 completionTime);

Expand All @@ -187,7 +187,7 @@ interface StakingI is authorization.AuthorizationI {
/// @return success Whether or not the unbonding delegation was cancelled
function cancelUnbondingDelegation(
address delegatorAddress,
string memory validatorAddress,
address validatorAddress,
uint256 amount,
uint256 creationHeight
) external returns (bool success);
Expand All @@ -199,7 +199,7 @@ interface StakingI is authorization.AuthorizationI {
/// @return balance The amount in Coin, that the delegator has delegated to the given validator.
function delegation(
address delegatorAddress,
string memory validatorAddress
address validatorAddress
) external view returns (uint256 shares, Coin calldata balance);

/// @dev Returns the delegation shares and coins, that are currently
Expand All @@ -209,7 +209,7 @@ interface StakingI is authorization.AuthorizationI {
/// @return unbondingDelegation The delegations that are currently unbonding.
function unbondingDelegation(
address delegatorAddress,
string memory validatorAddress
address validatorAddress
) external view returns (UnbondingDelegationOutput calldata unbondingDelegation);

/// @dev Queries validator info for a given validator address.
Expand Down Expand Up @@ -240,8 +240,8 @@ interface StakingI is authorization.AuthorizationI {
/// @return redelegation The active redelegations for the given delegator, source and destination validator combination.
function redelegation(
address delegatorAddress,
string memory srcValidatorAddress,
string memory dstValidatorAddress
address srcValidatorAddress,
address dstValidatorAddress
) external view returns (RedelegationOutput calldata redelegation);

/// @dev Queries all redelegations based on the specified criteria:
Expand All @@ -255,8 +255,8 @@ interface StakingI is authorization.AuthorizationI {
/// @return response Holds the redelegations for the given delegator, source and destination validator combination.
function redelegations(
address delegatorAddress,
string memory srcValidatorAddress,
string memory dstValidatorAddress,
address srcValidatorAddress,
address dstValidatorAddress,
PageRequest calldata pageRequest
)
external
Expand Down
84 changes: 42 additions & 42 deletions precompiles/staking/abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "validatorAddress",
"type": "string"
"type": "address"
},
{
"internalType": "uint256",
Expand Down Expand Up @@ -452,9 +452,9 @@
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "validatorAddress",
"type": "string"
"type": "address"
},
{
"internalType": "uint256",
Expand All @@ -481,9 +481,9 @@
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "validatorAddress",
"type": "string"
"type": "address"
}
],
"name": "delegation",
Expand Down Expand Up @@ -551,14 +551,14 @@
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "validatorSrcAddress",
"type": "string"
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "validatorDstAddress",
"type": "string"
"type": "address"
},
{
"internalType": "uint256",
Expand All @@ -585,34 +585,34 @@
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "srcValidatorAddress",
"type": "string"
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "dstValidatorAddress",
"type": "string"
"type": "address"
}
],
"name": "redelegation",
"outputs": [
{
"components": [
{
"internalType": "string",
"internalType": "address",
"name": "delegatorAddress",
"type": "string"
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "validatorSrcAddress",
"type": "string"
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "validatorDstAddress",
"type": "string"
"type": "address"
},
{
"components": [
Expand Down Expand Up @@ -658,14 +658,14 @@
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "srcValidatorAddress",
"type": "string"
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "dstValidatorAddress",
"type": "string"
"type": "address"
},
{
"components": [
Expand Down Expand Up @@ -707,19 +707,19 @@
{
"components": [
{
"internalType": "string",
"internalType": "address",
"name": "delegatorAddress",
"type": "string"
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "validatorSrcAddress",
"type": "string"
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "validatorDstAddress",
"type": "string"
"type": "address"
},
{
"components": [
Expand Down Expand Up @@ -850,24 +850,24 @@
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "validatorAddress",
"type": "string"
"type": "address"
}
],
"name": "unbondingDelegation",
"outputs": [
{
"components": [
{
"internalType": "string",
"internalType": "address",
"name": "delegatorAddress",
"type": "string"
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "validatorAddress",
"type": "string"
"type": "address"
},
{
"components": [
Expand Down Expand Up @@ -923,9 +923,9 @@
"type": "address"
},
{
"internalType": "string",
"internalType": "address",
"name": "validatorAddress",
"type": "string"
"type": "address"
},
{
"internalType": "uint256",
Expand Down Expand Up @@ -957,9 +957,9 @@
{
"components": [
{
"internalType": "string",
"internalType": "address",
"name": "operatorAddress",
"type": "string"
"type": "address"
},
{
"internalType": "string",
Expand Down Expand Up @@ -1065,9 +1065,9 @@
{
"components": [
{
"internalType": "string",
"internalType": "address",
"name": "operatorAddress",
"type": "string"
"type": "address"
},
{
"internalType": "string",
Expand Down