Skip to content

Commit

Permalink
Merge pull request #206 from terra-money/feat/query/unbonding
Browse files Browse the repository at this point in the history
feat: query unbondings that are in progress
  • Loading branch information
emidev98 authored Jun 12, 2023
2 parents 8a1984b + f199f6f commit d08cd0c
Show file tree
Hide file tree
Showing 27 changed files with 5,012 additions and 1,282 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: 1.20.0
- uses: actions/checkout@v3
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ lint: format-tools
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" -not -path "*pb.gw.go" | xargs gofumpt -d

lint-docker:
docker run --rm -v $(PWD):/app -w /app golangci/golangci-lint:v1.52.2-alpine golangci-lint run
docker run --rm -v $(PWD):/app -w /app golangci/golangci-lint:v1.52.2-alpine golangci-lint run --timeout 10m

format: format-tools
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" -not -path "*pb.gw.go" | xargs gofumpt -w
Expand Down
1 change: 1 addition & 0 deletions app/simulation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli"

"github.com/stretchr/testify/require"

"github.com/terra-money/alliance/app"
)

Expand Down
253 changes: 218 additions & 35 deletions docs/proto/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
- [alliance/delegations.proto](#alliance/delegations.proto)
- [AllianceValidatorInfo](#alliance.AllianceValidatorInfo)
- [Delegation](#alliance.Delegation)
- [QueuedRedelegation](#alliance.QueuedRedelegation)
- [QueuedUndelegation](#alliance.QueuedUndelegation)
- [Redelegation](#alliance.Redelegation)
- [Undelegation](#alliance.Undelegation)

- [alliance/events.proto](#alliance/events.proto)
Expand All @@ -27,6 +25,11 @@
- [RedelegateAllianceEvent](#alliance.RedelegateAllianceEvent)
- [UndelegateAllianceEvent](#alliance.UndelegateAllianceEvent)

- [alliance/redelegations.proto](#alliance/redelegations.proto)
- [QueuedRedelegation](#alliance.QueuedRedelegation)
- [Redelegation](#alliance.Redelegation)
- [RedelegationEntry](#alliance.RedelegationEntry)

- [alliance/genesis.proto](#alliance/genesis.proto)
- [GenesisState](#alliance.GenesisState)
- [RedelegationState](#alliance.RedelegationState)
Expand All @@ -39,6 +42,9 @@
- [MsgDeleteAllianceProposal](#alliance.MsgDeleteAllianceProposal)
- [MsgUpdateAllianceProposal](#alliance.MsgUpdateAllianceProposal)

- [alliance/unbonding.proto](#alliance/unbonding.proto)
- [UnbondingDelegation](#alliance.UnbondingDelegation)

- [alliance/query.proto](#alliance/query.proto)
- [DelegationResponse](#alliance.DelegationResponse)
- [QueryAllAllianceValidatorsRequest](#alliance.QueryAllAllianceValidatorsRequest)
Expand All @@ -47,8 +53,14 @@
- [QueryAllianceDelegationResponse](#alliance.QueryAllianceDelegationResponse)
- [QueryAllianceDelegationRewardsRequest](#alliance.QueryAllianceDelegationRewardsRequest)
- [QueryAllianceDelegationRewardsResponse](#alliance.QueryAllianceDelegationRewardsResponse)
- [QueryAllianceRedelegationsRequest](#alliance.QueryAllianceRedelegationsRequest)
- [QueryAllianceRedelegationsResponse](#alliance.QueryAllianceRedelegationsResponse)
- [QueryAllianceRequest](#alliance.QueryAllianceRequest)
- [QueryAllianceResponse](#alliance.QueryAllianceResponse)
- [QueryAllianceUnbondingsByDenomAndDelegatorRequest](#alliance.QueryAllianceUnbondingsByDenomAndDelegatorRequest)
- [QueryAllianceUnbondingsByDenomAndDelegatorResponse](#alliance.QueryAllianceUnbondingsByDenomAndDelegatorResponse)
- [QueryAllianceUnbondingsRequest](#alliance.QueryAllianceUnbondingsRequest)
- [QueryAllianceUnbondingsResponse](#alliance.QueryAllianceUnbondingsResponse)
- [QueryAllianceValidatorRequest](#alliance.QueryAllianceValidatorRequest)
- [QueryAllianceValidatorResponse](#alliance.QueryAllianceValidatorResponse)
- [QueryAllianceValidatorsResponse](#alliance.QueryAllianceValidatorsResponse)
Expand Down Expand Up @@ -247,21 +259,6 @@ key: denom value: AllianceAsset



<a name="alliance.QueuedRedelegation"></a>

### QueuedRedelegation



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `entries` | [Redelegation](#alliance.Redelegation) | repeated | |






<a name="alliance.QueuedUndelegation"></a>

### QueuedUndelegation
Expand All @@ -277,24 +274,6 @@ key: denom value: AllianceAsset



<a name="alliance.Redelegation"></a>

### Redelegation



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `delegator_address` | [string](#string) | | |
| `src_validator_address` | [string](#string) | | |
| `dst_validator_address` | [string](#string) | | |
| `balance` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | |






<a name="alliance.Undelegation"></a>

### Undelegation
Expand Down Expand Up @@ -399,6 +378,74 @@ key: denom value: AllianceAsset



<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="alliance/redelegations.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## alliance/redelegations.proto



<a name="alliance.QueuedRedelegation"></a>

### QueuedRedelegation
Used internally to keep track of redelegations


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `entries` | [Redelegation](#alliance.Redelegation) | repeated | |






<a name="alliance.Redelegation"></a>

### Redelegation



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `delegator_address` | [string](#string) | | internal or external user address |
| `src_validator_address` | [string](#string) | | redelegation source validator |
| `dst_validator_address` | [string](#string) | | redelegation destination validator |
| `balance` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount to redelegate |






<a name="alliance.RedelegationEntry"></a>

### RedelegationEntry
Used on QueryServer


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `delegator_address` | [string](#string) | | internal or external user address |
| `src_validator_address` | [string](#string) | | redelegation source validator |
| `dst_validator_address` | [string](#string) | | redelegation destination validator |
| `balance` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount to redelegate |
| `completion_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | completion_time defines the unix time for redelegation completion. |





<!-- end messages -->

<!-- end enums -->
Expand Down Expand Up @@ -578,6 +625,39 @@ GenesisState defines the module's genesis state.



<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="alliance/unbonding.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## alliance/unbonding.proto



<a name="alliance.UnbondingDelegation"></a>

### UnbondingDelegation
UnbondingDelegation defines an unbonding object with relevant metadata.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `completion_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | completion_time is the unix time for unbonding completion. |
| `validator_address` | [string](#string) | | validator_address is the bech32-encoded address of the validator. |
| `amount` | [string](#string) | | amount defines the tokens to receive at completion. |





<!-- end messages -->

<!-- end enums -->
Expand Down Expand Up @@ -708,6 +788,39 @@ AllianceDelegation



<a name="alliance.QueryAllianceRedelegationsRequest"></a>

### QueryAllianceRedelegationsRequest
Redelegations


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `denom` | [string](#string) | | |
| `delegator_addr` | [string](#string) | | |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | |






<a name="alliance.QueryAllianceRedelegationsResponse"></a>

### QueryAllianceRedelegationsResponse



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `redelegations` | [RedelegationEntry](#alliance.RedelegationEntry) | repeated | |
| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | |






<a name="alliance.QueryAllianceRequest"></a>

### QueryAllianceRequest
Expand Down Expand Up @@ -738,6 +851,73 @@ Alliance



<a name="alliance.QueryAllianceUnbondingsByDenomAndDelegatorRequest"></a>

### QueryAllianceUnbondingsByDenomAndDelegatorRequest
AllianceDelegation


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `denom` | [string](#string) | | |
| `delegator_addr` | [string](#string) | | |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | |






<a name="alliance.QueryAllianceUnbondingsByDenomAndDelegatorResponse"></a>

### QueryAllianceUnbondingsByDenomAndDelegatorResponse



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `unbondings` | [UnbondingDelegation](#alliance.UnbondingDelegation) | repeated | |
| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | |






<a name="alliance.QueryAllianceUnbondingsRequest"></a>

### QueryAllianceUnbondingsRequest



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `denom` | [string](#string) | | |
| `delegator_addr` | [string](#string) | | |
| `validator_addr` | [string](#string) | | |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | |






<a name="alliance.QueryAllianceUnbondingsResponse"></a>

### QueryAllianceUnbondingsResponse



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `unbondings` | [UnbondingDelegation](#alliance.UnbondingDelegation) | repeated | |
| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | |






<a name="alliance.QueryAllianceValidatorRequest"></a>

### QueryAllianceValidatorRequest
Expand Down Expand Up @@ -968,6 +1148,9 @@ Params
| `IBCAllianceDelegation` | [QueryIBCAllianceDelegationRequest](#alliance.QueryIBCAllianceDelegationRequest) | [QueryAllianceDelegationResponse](#alliance.QueryAllianceDelegationResponse) | Query a delegation to an alliance by delegator addr, validator_addr and denom @deprecated: this endpoint will be replaced for by the encoded version of the denom e.g.: GET:/terra/alliances/terradr1231/terravaloper41234/ibc%2Falliance | GET|/terra/alliances/delegations/{delegator_addr}/{validator_addr}/ibc/{hash}|
| `AllianceDelegationRewards` | [QueryAllianceDelegationRewardsRequest](#alliance.QueryAllianceDelegationRewardsRequest) | [QueryAllianceDelegationRewardsResponse](#alliance.QueryAllianceDelegationRewardsResponse) | Query for rewards by delegator addr, validator_addr and denom | GET|/terra/alliances/rewards/{delegator_addr}/{validator_addr}/{denom}|
| `IBCAllianceDelegationRewards` | [QueryIBCAllianceDelegationRewardsRequest](#alliance.QueryIBCAllianceDelegationRewardsRequest) | [QueryAllianceDelegationRewardsResponse](#alliance.QueryAllianceDelegationRewardsResponse) | Query for rewards by delegator addr, validator_addr and denom @deprecated: this endpoint will be replaced for by the encoded version of the denom e.g.: GET:/terra/alliances/terradr1231/terravaloper41234/ibc%2Falliance | GET|/terra/alliances/rewards/{delegator_addr}/{validator_addr}/ibc/{hash}|
| `AllianceUnbondingsByDenomAndDelegator` | [QueryAllianceUnbondingsByDenomAndDelegatorRequest](#alliance.QueryAllianceUnbondingsByDenomAndDelegatorRequest) | [QueryAllianceUnbondingsByDenomAndDelegatorResponse](#alliance.QueryAllianceUnbondingsByDenomAndDelegatorResponse) | Query for rewards by delegator addr, validator_addr and denom | GET|/terra/alliances/unbondings/{denom}/{delegator_addr}|
| `AllianceUnbondings` | [QueryAllianceUnbondingsRequest](#alliance.QueryAllianceUnbondingsRequest) | [QueryAllianceUnbondingsResponse](#alliance.QueryAllianceUnbondingsResponse) | Query for rewards by delegator addr, validator_addr and denom | GET|/terra/alliances/unbondings/{denom}/{delegator_addr}/{validator_addr}|
| `AllianceRedelegations` | [QueryAllianceRedelegationsRequest](#alliance.QueryAllianceRedelegationsRequest) | [QueryAllianceRedelegationsResponse](#alliance.QueryAllianceRedelegationsResponse) | Query redelegations by denom and delegator address | GET|/terra/alliances/redelegations/{denom}/{delegator_addr}|
| `Alliance` | [QueryAllianceRequest](#alliance.QueryAllianceRequest) | [QueryAllianceResponse](#alliance.QueryAllianceResponse) | Query a specific alliance by denom | GET|/terra/alliances/{denom}|

<!-- end services -->
Expand Down
16 changes: 0 additions & 16 deletions proto/alliance/delegations.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,6 @@ message Delegation {
uint64 last_reward_claim_height = 6;
}

message Redelegation {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string src_validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string dst_validator_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
cosmos.base.v1beta1.Coin balance = 4 [(gogoproto.nullable) = false];
}

message QueuedRedelegation {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
repeated Redelegation entries = 1;
}

message Undelegation {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
Expand Down
1 change: 1 addition & 0 deletions proto/alliance/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "gogoproto/gogo.proto";
import "alliance/alliance.proto";
import "alliance/params.proto";
import "alliance/delegations.proto";
import "alliance/redelegations.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.com/terra-money/alliance/x/alliance/types";
Expand Down
Loading

0 comments on commit d08cd0c

Please sign in to comment.