diff --git a/protocol/app/testdata/default_genesis_state.json b/protocol/app/testdata/default_genesis_state.json index e8fd038a30..7059081190 100644 --- a/protocol/app/testdata/default_genesis_state.json +++ b/protocol/app/testdata/default_genesis_state.json @@ -15,7 +15,28 @@ }, "affiliates": { "affiliate_tiers": { - "tiers": [] + "tiers": [ + { + "req_referred_volume_quote_quantums": "0", + "req_staked_whole_coins": 0, + "taker_fee_share_ppm": 50000 + }, + { + "req_referred_volume_quote_quantums": "1000000000000", + "req_staked_whole_coins": 200, + "taker_fee_share_ppm": 100000 + }, + { + "req_referred_volume_quote_quantums": "5000000000000", + "req_staked_whole_coins": 1000, + "taker_fee_share_ppm": 125000 + }, + { + "req_referred_volume_quote_quantums": "25000000000000", + "req_staked_whole_coins": 5000, + "taker_fee_share_ppm": 150000 + } + ] } }, "auth": { diff --git a/protocol/app/upgrades/v7.0.0/upgrade_container_test.go b/protocol/app/upgrades/v7.0.0/upgrade_container_test.go index e92ee609ca..e0df3171d7 100644 --- a/protocol/app/upgrades/v7.0.0/upgrade_container_test.go +++ b/protocol/app/upgrades/v7.0.0/upgrade_container_test.go @@ -11,6 +11,7 @@ import ( "github.com/dydxprotocol/v4-chain/protocol/dtypes" "github.com/dydxprotocol/v4-chain/protocol/testing/containertest" "github.com/dydxprotocol/v4-chain/protocol/testutil/constants" + affiliatestypes "github.com/dydxprotocol/v4-chain/protocol/x/affiliates/types" vaulttypes "github.com/dydxprotocol/v4-chain/protocol/x/vault/types" "github.com/stretchr/testify/require" ) @@ -48,6 +49,9 @@ func preUpgradeChecks(node *containertest.Node, t *testing.T) { func postUpgradeChecks(node *containertest.Node, t *testing.T) { // Add test for your upgrade handler logic below postUpgradeVaultParamsCheck(node, t) + + // Check that the affiliates module has been initialized with the default tiers. + postUpgradeAffiliatesModuleTiersCheck(node, t) } func postUpgradeVaultParamsCheck(node *containertest.Node, t *testing.T) { @@ -96,3 +100,19 @@ func checkVaultParams( require.Equal(t, expectedStatus, vaultParamsResp.VaultParams.Status) require.Equal(t, expectedQuotingParams, vaultParamsResp.VaultParams.QuotingParams) } + +func postUpgradeAffiliatesModuleTiersCheck(node *containertest.Node, t *testing.T) { + resp, err := containertest.Query( + node, + affiliatestypes.NewQueryClient, + affiliatestypes.QueryClient.AllAffiliateTiers, + &affiliatestypes.AllAffiliateTiersRequest{}, + ) + require.NoError(t, err) + require.NotNil(t, resp) + + affiliateTiersResp := affiliatestypes.AllAffiliateTiersResponse{} + err = proto.UnmarshalText(resp.String(), &affiliateTiersResp) + require.NoError(t, err) + require.Equal(t, affiliatestypes.DefaultAffiliateTiers, affiliateTiersResp.Tiers) +} diff --git a/protocol/scripts/genesis/sample_pregenesis.json b/protocol/scripts/genesis/sample_pregenesis.json index b3d0afbb32..9306afbb09 100644 --- a/protocol/scripts/genesis/sample_pregenesis.json +++ b/protocol/scripts/genesis/sample_pregenesis.json @@ -4,7 +4,28 @@ "app_state": { "affiliates": { "affiliate_tiers": { - "tiers": [] + "tiers": [ + { + "req_referred_volume_quote_quantums": "0", + "req_staked_whole_coins": 0, + "taker_fee_share_ppm": 50000 + }, + { + "req_referred_volume_quote_quantums": "1000000000000", + "req_staked_whole_coins": 200, + "taker_fee_share_ppm": 100000 + }, + { + "req_referred_volume_quote_quantums": "5000000000000", + "req_staked_whole_coins": 1000, + "taker_fee_share_ppm": 125000 + }, + { + "req_referred_volume_quote_quantums": "25000000000000", + "req_staked_whole_coins": 5000, + "taker_fee_share_ppm": 150000 + } + ] } }, "assets": { @@ -3995,7 +4016,7 @@ ] } }, - "app_version": "5.2.1-103-g5c95dd72", + "app_version": "5.2.1-172-g351fcccd", "chain_id": "dydx-sample-1", "consensus": { "params": { diff --git a/protocol/x/affiliates/types/genesis.go b/protocol/x/affiliates/types/genesis.go index 68668b98df..0fac6ad561 100644 --- a/protocol/x/affiliates/types/genesis.go +++ b/protocol/x/affiliates/types/genesis.go @@ -3,9 +3,7 @@ package types // DefaultGenesis returns the default stats genesis state. func DefaultGenesis() *GenesisState { return &GenesisState{ - AffiliateTiers: AffiliateTiers{ - Tiers: []AffiliateTiers_Tier{}, - }, + AffiliateTiers: DefaultAffiliateTiers, } }