-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb03e0d
commit 9be3314
Showing
81 changed files
with
12,797 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package v3 | ||
|
||
// allocation data for airdrop users in csv format | ||
var allocations = `identifier,address,weight | ||
stride,stride1g7yxhuppp5x3yqkah5mw29eqq5s4sv2f222xmk,0.5 | ||
stride,stride1h4astdfzjhcwahtfrh24qtvndzzh49xvqtfftk,0.3` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package v3 | ||
|
||
import ( | ||
"time" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
|
||
claimkeeper "github.com/Stride-Labs/stride/x/claim/keeper" | ||
claimtypes "github.com/Stride-Labs/stride/x/claim/types" | ||
) | ||
|
||
// Note: ensure these values are properly set before running upgrade | ||
var ( | ||
UpgradeName = "v3" | ||
airdropDistributors = []string{ | ||
"stride1thl8e7smew8q7jrz8at4f64wrjjl8mwan3nc4l", | ||
"stride104az7rd5yh3p8qn4ary8n3xcwquuwgee4vnvvc", | ||
"stride17kvetgthwt6caku5qjs2rx2njgh26vmg448r5u", | ||
"stride1swvv9kpp75e60pvlv5x6mcw5f54qgpph239e5s", | ||
"stride1ywrhas3ae7z3ljqxmgdzjx8wyaf3djwuh4hdlj", | ||
} | ||
airdropIdentifiers = []string{"stride", "gaia", "osmosis", "juno", "stars"} | ||
airdropDuration = time.Hour * 24 * 30 * 12 * 3 // 3 years | ||
) | ||
|
||
// CreateUpgradeHandler creates an SDK upgrade handler for v3 | ||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
ck claimkeeper.Keeper, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
newVm, err := mm.RunMigrations(ctx, configurator, vm) | ||
if err != nil { | ||
return newVm, err | ||
} | ||
|
||
// total number of airdrop distributors must be equal to identifiers | ||
if len(airdropDistributors) == len(airdropIdentifiers) { | ||
for idx, airdropDistributor := range airdropDistributors { | ||
err = ck.CreateAirdropAndEpoch(ctx, airdropDistributor, claimtypes.DefaultClaimDenom, uint64(ctx.BlockTime().Unix()), uint64(airdropDuration.Seconds()), airdropIdentifiers[idx]) | ||
if err != nil { | ||
return newVm, err | ||
} | ||
} | ||
} | ||
ck.LoadAllocationData(ctx, allocations) | ||
return newVm, nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
syntax = "proto3"; | ||
package Stridelabs.stride.claim.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
import "cosmos/bank/v1beta1/genesis.proto"; | ||
|
||
option go_package = "github.com/Stride-Labs/stride/x/claim/types"; | ||
|
||
enum Action { | ||
option (gogoproto.goproto_enum_prefix) = false; | ||
|
||
ActionFree = 0; | ||
ActionLiquidStake = 1; | ||
ActionDelegateStake = 2; | ||
} | ||
|
||
// A Claim Records is the metadata of claim data per address | ||
message ClaimRecord { | ||
// airdrop identifier | ||
string airdrop_identifier = 1 [ (gogoproto.moretags) = "yaml:\"airdrop_identifier\"" ]; | ||
|
||
// address of claim user | ||
string address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; | ||
|
||
// weight that represent the portion from total allocation | ||
string weight = 3 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"weight\"" | ||
]; | ||
|
||
// true if action is completed | ||
// index of bool in array refers to action enum # | ||
repeated bool action_completed = 4 [ | ||
(gogoproto.moretags) = "yaml:\"action_completed\"" | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
syntax = "proto3"; | ||
package Stridelabs.stride.claim.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
import "cosmos/bank/v1beta1/genesis.proto"; | ||
import "google/protobuf/duration.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
import "claim/v1beta1/claim.proto"; | ||
import "claim/v1beta1/params.proto"; | ||
|
||
option go_package = "github.com/Stride-Labs/stride/x/claim/types"; | ||
|
||
// GenesisState defines the claim module's genesis state. | ||
message GenesisState { | ||
// params defines all the parameters of the module. | ||
Params params = 1 [ | ||
(gogoproto.moretags) = "yaml:\"params\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
// list of claim records, one for every airdrop recipient | ||
repeated ClaimRecord claim_records = 2 [ | ||
(gogoproto.moretags) = "yaml:\"claim_records\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
syntax = "proto3"; | ||
package Stridelabs.stride.claim.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/protobuf/duration.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
option go_package = "github.com/Stride-Labs/stride/x/claim/types"; | ||
|
||
// Params defines the claim module's parameters. | ||
message Params { | ||
repeated Airdrop airdrops = 1; | ||
} | ||
|
||
message Airdrop { | ||
string airdrop_identifier = 1 [ (gogoproto.moretags) = "yaml:\"airdrop_identifier\"" ]; | ||
// seconds | ||
google.protobuf.Timestamp airdrop_start_time = 2 [ | ||
(gogoproto.stdtime) = true, | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"airdrop_start_time\"" | ||
]; | ||
// seconds | ||
google.protobuf.Duration airdrop_duration = 3 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.stdduration) = true, | ||
(gogoproto.jsontag) = "airdrop_duration,omitempty", | ||
(gogoproto.moretags) = "yaml:\"airdrop_duration\"" | ||
]; | ||
// denom of claimable asset | ||
string claim_denom = 4; | ||
// airdrop distribution account | ||
string distributor_address = 5; | ||
} |
Oops, something went wrong.