diff --git a/app/upgrades/v6/upgrade.go b/app/upgrades/v6/upgrade.go index 590461515..9dff54a8a 100644 --- a/app/upgrades/v6/upgrade.go +++ b/app/upgrades/v6/upgrade.go @@ -1,7 +1,6 @@ package v6 import ( - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" @@ -21,19 +20,9 @@ import ( slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/notional-labs/composable/v6/x/ratelimit/types" - "github.com/notional-labs/composable/v6/bech32-migration/utils" ) -const ( - // https://github.com/cosmos/chain-registry/blob/master/composable/assetlist.json - uatom = "ibc/EF48E6B1A1A19F47ECAEA62F5670C37C0580E86A9E88498B7E393EB6F49F33C0" - dot = "ibc/3CC19CEC7E5A3E90E78A5A9ECC5A0E2F8F826A375CF1E096F4515CF09DA3E366" - ksm = "ibc/EE9046745AEC0E8302CB7ED9D5AD67F528FB3B7AE044B247FB0FB293DBDA35E9" - usdt = "ibc/F3EC9F834E57DF704FA3AEAF14E8391C2E58397FE56960AD70E67562990D8265" -) - func CreateUpgradeHandler( mm *module.Manager, configurator module.Configurator, @@ -62,153 +51,6 @@ func CreateUpgradeHandler( return false }) - // update rate limit to 50k - rlKeeper := keepers.RatelimitKeeper - // add uatom - uatomRateLimit, found := rlKeeper.GetRateLimit(ctx, uatom, "channel-2") - if !found { - channelValue := rlKeeper.GetChannelValue(ctx, uatom) - // Create and store the rate limit object - path := types.Path{ - Denom: uatom, - ChannelID: "channel-2", - } - quota := types.Quota{ - MaxPercentSend: sdk.NewInt(30), - MaxPercentRecv: sdk.NewInt(30), - DurationHours: 1, - } - flow := types.Flow{ - Inflow: math.ZeroInt(), - Outflow: math.ZeroInt(), - ChannelValue: channelValue, - } - uatomRateLimit = types.RateLimit{ - Path: &path, - Quota: "a, - Flow: &flow, - MinRateLimitAmount: sdk.NewInt(1282_000_000 * 5), // 1282_000_000 * 5 - } - rlKeeper.SetRateLimit(ctx, uatomRateLimit) - } else { - quota := types.Quota{ - MaxPercentSend: sdk.NewInt(30), - MaxPercentRecv: sdk.NewInt(30), - DurationHours: 1, - } - uatomRateLimit.Quota = "a - uatomRateLimit.MinRateLimitAmount = sdk.NewInt(1282_000_000 * 5) - rlKeeper.SetRateLimit(ctx, uatomRateLimit) - } - // add dot - dotRateLimit, found := rlKeeper.GetRateLimit(ctx, dot, "channel-2") - if !found { - channelValue := rlKeeper.GetChannelValue(ctx, dot) - // Create and store the rate limit object - path := types.Path{ - Denom: dot, - ChannelID: "channel-2", - } - quota := types.Quota{ - MaxPercentSend: sdk.NewInt(30), - MaxPercentRecv: sdk.NewInt(30), - DurationHours: 1, - } - flow := types.Flow{ - Inflow: math.ZeroInt(), - Outflow: math.ZeroInt(), - ChannelValue: channelValue, - } - dotRateLimit = types.RateLimit{ - Path: &path, - Quota: "a, - Flow: &flow, - MinRateLimitAmount: sdk.NewInt(22_670_000_000_000 * 5), // 22_670_000_000_000 * 5 - } - rlKeeper.SetRateLimit(ctx, dotRateLimit) - } else { - quota := types.Quota{ - MaxPercentSend: sdk.NewInt(30), - MaxPercentRecv: sdk.NewInt(30), - DurationHours: 1, - } - dotRateLimit.Quota = "a - dotRateLimit.MinRateLimitAmount = sdk.NewInt(22_670_000_000_000 * 5) - rlKeeper.SetRateLimit(ctx, dotRateLimit) - } - // add ksm - ksmRateLimit, found := rlKeeper.GetRateLimit(ctx, ksm, "channel-2") - if !found { - channelValue := rlKeeper.GetChannelValue(ctx, ksm) - // Create and store the rate limit object - path := types.Path{ - Denom: ksm, - ChannelID: "channel-2", - } - quota := types.Quota{ - MaxPercentSend: sdk.NewInt(30), - MaxPercentRecv: sdk.NewInt(30), - DurationHours: 1, - } - flow := types.Flow{ - Inflow: math.ZeroInt(), - Outflow: math.ZeroInt(), - ChannelValue: channelValue, - } - ksmRateLimit = types.RateLimit{ - Path: &path, - Quota: "a, - Flow: &flow, - MinRateLimitAmount: sdk.NewInt(510_000_000_000_000 * 5), // 510_000_000_000_000*5 - } - rlKeeper.SetRateLimit(ctx, ksmRateLimit) - } else { - quota := types.Quota{ - MaxPercentSend: sdk.NewInt(30), - MaxPercentRecv: sdk.NewInt(30), - DurationHours: 1, - } - ksmRateLimit.Quota = "a - ksmRateLimit.MinRateLimitAmount = sdk.NewInt(510_000_000_000_000 * 5) - rlKeeper.SetRateLimit(ctx, ksmRateLimit) - } - // add usdt - usdtRateLimit, found := rlKeeper.GetRateLimit(ctx, usdt, "channel-2") - if !found { - channelValue := rlKeeper.GetChannelValue(ctx, usdt) - // Create and store the rate limit object - path := types.Path{ - Denom: usdt, - ChannelID: "channel-2", - } - quota := types.Quota{ - MaxPercentSend: sdk.NewInt(30), - MaxPercentRecv: sdk.NewInt(30), - DurationHours: 1, - } - flow := types.Flow{ - Inflow: math.ZeroInt(), - Outflow: math.ZeroInt(), - ChannelValue: channelValue, - } - usdtRateLimit = types.RateLimit{ - Path: &path, - Quota: "a, - Flow: &flow, - MinRateLimitAmount: sdk.NewInt(10_000_000_000 * 5), // 10_000_000_000 * 5 - } - rlKeeper.SetRateLimit(ctx, usdtRateLimit) - } else { - quota := types.Quota{ - MaxPercentSend: sdk.NewInt(30), - MaxPercentRecv: sdk.NewInt(30), - DurationHours: 1, - } - usdtRateLimit.Quota = "a - usdtRateLimit.MinRateLimitAmount = sdk.NewInt(10_000_000_000 * 5) - rlKeeper.SetRateLimit(ctx, usdtRateLimit) - } - return mm.RunMigrations(ctx, configurator, vm) } } diff --git a/proposal.json b/proposal.json new file mode 100644 index 000000000..cbefee6e9 --- /dev/null +++ b/proposal.json @@ -0,0 +1,86 @@ +{ + "body": { + "messages": [ + { + "@type": "/cosmos.gov.v1.MsgSubmitProposal", + "messages": [ + { + "@type": "/centauri.ratelimit.v1beta1.MsgUpdateRateLimit", + "authority": "centauri10d07y265gmmuvt4z0w9aw880jnsr700j7g7ejq", + "denom": "ibc/EF48E6B1A1A19F47ECAEA62F5670C37C0580E86A9E88498B7E393EB6F49F33C0", + "min_rate_limit_amount": "30410000000", + "channel_id": "channel-2", + "max_percent_send": "30", + "max_percent_recv": "30", + "duration_hours": "1" + }, + { + "@type": "/centauri.ratelimit.v1beta1.MsgUpdateRateLimit", + "authority": "centauri10d07y265gmmuvt4z0w9aw880jnsr700j7g7ejq", + "denom": "ibc/3CC19CEC7E5A3E90E78A5A9ECC5A0E2F8F826A375CF1E096F4515CF09DA3E366", + "min_rate_limit_amount": "513350000000000", + "channel_id": "channel-2", + "max_percent_send": "30", + "max_percent_recv": "30", + "duration_hours": "1" + }, + { + "@type": "/centauri.ratelimit.v1beta1.MsgUpdateRateLimit", + "authority": "centauri10d07y265gmmuvt4z0w9aw880jnsr700j7g7ejq", + "denom": "ibc/EE9046745AEC0E8302CB7ED9D5AD67F528FB3B7AE044B247FB0FB293DBDA35E9", + "channel_id": "channel-2", + "max_percent_send": "30", + "max_percent_recv": "30", + "min_rate_limit_amount": "12550000000000000", + "duration_hours": "1" + }, + { + "@type": "/centauri.ratelimit.v1beta1.MsgUpdateRateLimit", + "authority": "centauri10d07y265gmmuvt4z0w9aw880jnsr700j7g7ejq", + "denom": "ibc/F3EC9F834E57DF704FA3AEAF14E8391C2E58397FE56960AD70E67562990D8265", + "min_rate_limit_amount": "250000000000", + "channel_id": "channel-2", + "max_percent_send": "30", + "max_percent_recv": "30", + "duration_hours": "1" + }, + { + "@type": "/centauri.ratelimit.v1beta1.MsgUpdateRateLimit", + "authority": "centauri10d07y265gmmuvt4z0w9aw880jnsr700j7g7ejq", + "denom": "ibc/47BD209179859CDE4A2806763D7189B6E6FE13A17880FE2B42DE1E6C1E329E23", + "min_rate_limit_amount": "1", + "channel_id": "channel-2", + "max_percent_send": "30", + "max_percent_recv": "30", + "duration_hours": "1" + } + ], + "initial_deposit": [ + { + "denom": "ppica", + "amount": "500000000000000000" + } + ], + "proposer": "centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m", + "metadata": "Update Transfer RateLimit", + "title": "Update Transfer RateLimit", + "summary": "Update Transfer RateLimit : change the duration to 1 hour " + } + ], + "memo": "", + "timeout_height": "0", + "extension_options": [], + "non_critical_extension_options": [] + }, + "auth_info": { + "signer_infos": [], + "fee": { + "amount": [], + "gas_limit": "2000000", + "payer": "", + "granter": "" + }, + "tip": null + }, + "signatures": [] +} \ No newline at end of file