From b5a71fa932e6361450b0dfaa88a27ce1484cc162 Mon Sep 17 00:00:00 2001 From: Servio Date: Wed, 18 Sep 2024 16:29:23 -0300 Subject: [PATCH 1/6] net open interest was added --- proto/elys/perpetual/pool.proto | 26 + x/perpetual/keeper/begin_blocker.go | 6 + x/perpetual/keeper/pool.go | 11 +- .../keeper/update_net_open_interest.go | 22 + x/perpetual/migrations/v6_migration.go | 10 - x/perpetual/migrations/v8_migration.go | 35 + x/perpetual/module.go | 9 +- x/perpetual/types/keys.go | 4 +- x/perpetual/types/pool.pb.go | 669 ++++++++++++++++-- 9 files changed, 728 insertions(+), 64 deletions(-) create mode 100644 x/perpetual/keeper/update_net_open_interest.go create mode 100644 x/perpetual/migrations/v8_migration.go diff --git a/proto/elys/perpetual/pool.proto b/proto/elys/perpetual/pool.proto index daa2c9408..7793b7d84 100644 --- a/proto/elys/perpetual/pool.proto +++ b/proto/elys/perpetual/pool.proto @@ -33,6 +33,28 @@ message PoolAsset { string asset_denom = 7; } +message LegacyPool { + uint64 amm_pool_id = 1; + string health = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + bool enabled = 3; + bool closed = 4; + string borrow_interest_rate = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + repeated PoolAsset pool_assets_long = 6 [(gogoproto.nullable) = false]; + repeated PoolAsset pool_assets_short = 7 [(gogoproto.nullable) = false]; + int64 last_height_borrow_interest_rate_computed = 8; + // funding rate, if positive longs pay shorts, if negative shorts pay longs + string funding_rate = 9 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + message Pool { uint64 amm_pool_id = 1; string health = 2 [ @@ -53,5 +75,9 @@ message Pool { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; + string net_open_interest = 10 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; } diff --git a/x/perpetual/keeper/begin_blocker.go b/x/perpetual/keeper/begin_blocker.go index 4b7b8d770..f8bffe799 100644 --- a/x/perpetual/keeper/begin_blocker.go +++ b/x/perpetual/keeper/begin_blocker.go @@ -66,7 +66,13 @@ func (k Keeper) BeginBlocker(ctx sdk.Context) { FundingRateLong: fundingRateLong, FundingRateShort: fundingRateShort, }) + + err = k.UpdateNetOpenInterest(ctx, &pool) + if err != nil { + ctx.Logger().Error(err.Error()) + } } + k.SetPool(ctx, pool) } } diff --git a/x/perpetual/keeper/pool.go b/x/perpetual/keeper/pool.go index 8e7372734..d62453df8 100644 --- a/x/perpetual/keeper/pool.go +++ b/x/perpetual/keeper/pool.go @@ -60,14 +60,14 @@ func (k Keeper) GetAllPools(ctx sdk.Context) (list []types.Pool) { return } -func (k Keeper) GetAllLegacyPools(ctx sdk.Context) (list []types.Pool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LegacyPoolKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) +func (k Keeper) GetAllLegacyPools(ctx sdk.Context) (list []types.LegacyPool) { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, types.PoolKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var val types.Pool + var val types.LegacyPool k.cdc.MustUnmarshal(iterator.Value(), &val) list = append(list, val) } @@ -77,7 +77,8 @@ func (k Keeper) GetAllLegacyPools(ctx sdk.Context) (list []types.Pool) { func (k Keeper) RemoveLegacyPool(ctx sdk.Context, index uint64) { store := ctx.KVStore(k.storeKey) - store.Delete(types.GetLegacyPoolKey(index)) + key := types.GetLegacyPoolKey(index) + store.Delete(key) } func (k Keeper) SetBorrowRate(ctx sdk.Context, block uint64, pool uint64, interest types.InterestBlock) { diff --git a/x/perpetual/keeper/update_net_open_interest.go b/x/perpetual/keeper/update_net_open_interest.go new file mode 100644 index 000000000..968507c54 --- /dev/null +++ b/x/perpetual/keeper/update_net_open_interest.go @@ -0,0 +1,22 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/perpetual/types" +) + +func (k Keeper) UpdateNetOpenInterest(ctx sdk.Context, pool *types.Pool) error { + assetLiabilitiesLong := sdk.ZeroInt() + assetLiabilitiesShort := sdk.ZeroInt() + + for _, asset := range pool.PoolAssetsLong { + assetLiabilitiesLong = assetLiabilitiesLong.Add(asset.Liabilities) + } + + for _, asset := range pool.PoolAssetsShort { + assetLiabilitiesShort = assetLiabilitiesShort.Add(asset.Liabilities) + } + + pool.NetOpenInterest = assetLiabilitiesLong.Sub(assetLiabilitiesShort) + return nil +} diff --git a/x/perpetual/migrations/v6_migration.go b/x/perpetual/migrations/v6_migration.go index c3e109cc4..abd611cfe 100644 --- a/x/perpetual/migrations/v6_migration.go +++ b/x/perpetual/migrations/v6_migration.go @@ -6,15 +6,5 @@ import ( func (m Migrator) V6Migration(ctx sdk.Context) error { - m.keeper.V6_MTPMigration(ctx) - - allLegacyPools := m.keeper.GetAllLegacyPools(ctx) - for _, pool := range allLegacyPools { - m.keeper.SetPool(ctx, pool) - m.keeper.RemoveLegacyPool(ctx, pool.AmmPoolId) - } - - m.keeper.V6_MigrateWhitelistedAddress(ctx) - return nil } diff --git a/x/perpetual/migrations/v8_migration.go b/x/perpetual/migrations/v8_migration.go new file mode 100644 index 000000000..53d0e9ea2 --- /dev/null +++ b/x/perpetual/migrations/v8_migration.go @@ -0,0 +1,35 @@ +package migrations + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/perpetual/types" +) + +func (m Migrator) V8Migration(ctx sdk.Context) error { + + ctx.Logger().Info("Migrating pool from legacy to new format") + + pools := m.keeper.GetAllLegacyPools(ctx) + + for _, pool := range pools { + + ctx.Logger().Debug("pool", pool) + + newPool := types.Pool{ + AmmPoolId: pool.AmmPoolId, + Health: pool.Health, + Enabled: pool.Enabled, + Closed: pool.Closed, + BorrowInterestRate: pool.BorrowInterestRate, + PoolAssetsLong: pool.PoolAssetsLong, + PoolAssetsShort: pool.PoolAssetsShort, + LastHeightBorrowInterestRateComputed: pool.LastHeightBorrowInterestRateComputed, + FundingRate: pool.FundingRate, + NetOpenInterest: sdk.ZeroInt(), + } + + m.keeper.RemoveLegacyPool(ctx, pool.AmmPoolId) + m.keeper.SetPool(ctx, newPool) + } + return nil +} diff --git a/x/perpetual/module.go b/x/perpetual/module.go index 54b1afcd0..593162462 100644 --- a/x/perpetual/module.go +++ b/x/perpetual/module.go @@ -117,11 +117,8 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) m := migrations.NewMigrator(am.keeper) - err := cfg.RegisterMigration(types.ModuleName, 5, m.V6Migration) - if err != nil { - panic(err) - } - err = cfg.RegisterMigration(types.ModuleName, 6, m.V7Migration) + + err := cfg.RegisterMigration(types.ModuleName, 7, m.V8Migration) if err != nil { panic(err) } @@ -148,7 +145,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 7 } +func (AppModule) ConsensusVersion() uint64 { return 8 } // BeginBlock contains the logic that is automatically triggered at the beginning of each block func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { diff --git a/x/perpetual/types/keys.go b/x/perpetual/types/keys.go index 87ef498cd..946a7fefd 100644 --- a/x/perpetual/types/keys.go +++ b/x/perpetual/types/keys.go @@ -98,8 +98,8 @@ func legacyPoolKey(index uint64) []byte { } func GetLegacyPoolKey(index uint64) []byte { - key := KeyPrefix(LegacyPoolKeyPrefix) - return append(key, legacyPoolKey(index)...) + key := PoolKeyPrefix + return append(key, sdk.Uint64ToBigEndian(index)...) } func GetInterestRateKey(block uint64, pool uint64) []byte { diff --git a/x/perpetual/types/pool.pb.go b/x/perpetual/types/pool.pb.go index eb39f84ff..cfc9f0eda 100644 --- a/x/perpetual/types/pool.pb.go +++ b/x/perpetual/types/pool.pb.go @@ -74,7 +74,7 @@ func (m *PoolAsset) GetAssetDenom() string { return "" } -type Pool struct { +type LegacyPool struct { AmmPoolId uint64 `protobuf:"varint,1,opt,name=amm_pool_id,json=ammPoolId,proto3" json:"amm_pool_id,omitempty"` Health github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=health,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"health"` Enabled bool `protobuf:"varint,3,opt,name=enabled,proto3" json:"enabled,omitempty"` @@ -87,11 +87,100 @@ type Pool struct { FundingRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,9,opt,name=funding_rate,json=fundingRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"funding_rate"` } +func (m *LegacyPool) Reset() { *m = LegacyPool{} } +func (m *LegacyPool) String() string { return proto.CompactTextString(m) } +func (*LegacyPool) ProtoMessage() {} +func (*LegacyPool) Descriptor() ([]byte, []int) { + return fileDescriptor_f2020803d9775cac, []int{1} +} +func (m *LegacyPool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LegacyPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LegacyPool.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LegacyPool) XXX_Merge(src proto.Message) { + xxx_messageInfo_LegacyPool.Merge(m, src) +} +func (m *LegacyPool) XXX_Size() int { + return m.Size() +} +func (m *LegacyPool) XXX_DiscardUnknown() { + xxx_messageInfo_LegacyPool.DiscardUnknown(m) +} + +var xxx_messageInfo_LegacyPool proto.InternalMessageInfo + +func (m *LegacyPool) GetAmmPoolId() uint64 { + if m != nil { + return m.AmmPoolId + } + return 0 +} + +func (m *LegacyPool) GetEnabled() bool { + if m != nil { + return m.Enabled + } + return false +} + +func (m *LegacyPool) GetClosed() bool { + if m != nil { + return m.Closed + } + return false +} + +func (m *LegacyPool) GetPoolAssetsLong() []PoolAsset { + if m != nil { + return m.PoolAssetsLong + } + return nil +} + +func (m *LegacyPool) GetPoolAssetsShort() []PoolAsset { + if m != nil { + return m.PoolAssetsShort + } + return nil +} + +func (m *LegacyPool) GetLastHeightBorrowInterestRateComputed() int64 { + if m != nil { + return m.LastHeightBorrowInterestRateComputed + } + return 0 +} + +type Pool struct { + AmmPoolId uint64 `protobuf:"varint,1,opt,name=amm_pool_id,json=ammPoolId,proto3" json:"amm_pool_id,omitempty"` + Health github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=health,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"health"` + Enabled bool `protobuf:"varint,3,opt,name=enabled,proto3" json:"enabled,omitempty"` + Closed bool `protobuf:"varint,4,opt,name=closed,proto3" json:"closed,omitempty"` + BorrowInterestRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=borrow_interest_rate,json=borrowInterestRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"borrow_interest_rate"` + PoolAssetsLong []PoolAsset `protobuf:"bytes,6,rep,name=pool_assets_long,json=poolAssetsLong,proto3" json:"pool_assets_long"` + PoolAssetsShort []PoolAsset `protobuf:"bytes,7,rep,name=pool_assets_short,json=poolAssetsShort,proto3" json:"pool_assets_short"` + LastHeightBorrowInterestRateComputed int64 `protobuf:"varint,8,opt,name=last_height_borrow_interest_rate_computed,json=lastHeightBorrowInterestRateComputed,proto3" json:"last_height_borrow_interest_rate_computed,omitempty"` + // funding rate, if positive longs pay shorts, if negative shorts pay longs + FundingRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,9,opt,name=funding_rate,json=fundingRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"funding_rate"` + NetOpenInterest github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,10,opt,name=net_open_interest,json=netOpenInterest,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"net_open_interest"` +} + func (m *Pool) Reset() { *m = Pool{} } func (m *Pool) String() string { return proto.CompactTextString(m) } func (*Pool) ProtoMessage() {} func (*Pool) Descriptor() ([]byte, []int) { - return fileDescriptor_f2020803d9775cac, []int{1} + return fileDescriptor_f2020803d9775cac, []int{2} } func (m *Pool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -164,48 +253,52 @@ func (m *Pool) GetLastHeightBorrowInterestRateComputed() int64 { func init() { proto.RegisterType((*PoolAsset)(nil), "elys.perpetual.PoolAsset") + proto.RegisterType((*LegacyPool)(nil), "elys.perpetual.LegacyPool") proto.RegisterType((*Pool)(nil), "elys.perpetual.Pool") } func init() { proto.RegisterFile("elys/perpetual/pool.proto", fileDescriptor_f2020803d9775cac) } var fileDescriptor_f2020803d9775cac = []byte{ - // 560 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0xc7, 0xe3, 0xaf, 0xfe, 0x92, 0x66, 0x53, 0x0a, 0xdd, 0xb6, 0xe0, 0x72, 0x70, 0xa2, 0x0a, - 0xa1, 0x70, 0xa8, 0x2d, 0xc1, 0x13, 0xe0, 0x56, 0x28, 0x11, 0x3d, 0x04, 0xf7, 0x80, 0xc4, 0x81, - 0x65, 0x6d, 0x6f, 0x6c, 0x2b, 0x6b, 0x8f, 0xe5, 0xdd, 0xa8, 0xe4, 0x2d, 0x78, 0x2a, 0x54, 0x6e, - 0x3d, 0x22, 0x0e, 0x15, 0x4a, 0x5e, 0x04, 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 0x7a, 0x78, 0xc7, 0xba, 0x50, 0x71, 0xf8, 0x3d, 0x7a, 0xc1, 0xa9, - 0x90, 0x24, 0x61, 0x69, 0x9c, 0x48, 0xf2, 0x37, 0x15, 0x48, 0x08, 0x59, 0x31, 0x97, 0x2c, 0xb2, - 0xb6, 0x07, 0xc6, 0x70, 0xcb, 0x7f, 0xa6, 0x02, 0x46, 0xda, 0xdf, 0xfb, 0xa3, 0xd1, 0xd3, 0xca, - 0x17, 0xbf, 0x43, 0x3b, 0xd3, 0x79, 0x1e, 0xa5, 0x79, 0xbc, 0x96, 0xb2, 0xdb, 0x48, 0xca, 0x5e, - 0xc5, 0x50, 0x68, 0x6f, 0x74, 0xb5, 0xb4, 0x8d, 0xeb, 0xa5, 0x6d, 0xfc, 0x5c, 0xda, 0xc6, 0x97, - 0x95, 0xdd, 0xba, 0x5e, 0xd9, 0xad, 0xef, 0x2b, 0xbb, 0xf5, 0xc1, 0xa9, 0xe1, 0x94, 0x02, 0x27, - 0x39, 0x93, 0x97, 0x50, 0xce, 0xf4, 0xc2, 0xfd, 0x5c, 0x7b, 0x09, 0x35, 0x3a, 0x68, 0xeb, 0x57, - 0xee, 0xd5, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x34, 0x32, 0xf5, 0xb3, 0x28, 0x05, 0x00, 0x00, + // 605 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x95, 0xd1, 0x4e, 0xdb, 0x3c, + 0x14, 0xc7, 0xdb, 0x8f, 0xd2, 0x52, 0x97, 0x0f, 0x86, 0x81, 0x2d, 0xec, 0x22, 0x20, 0x34, 0x4d, + 0xec, 0x82, 0x54, 0xda, 0x9e, 0x60, 0x05, 0x4d, 0x54, 0x43, 0x1a, 0x0b, 0x17, 0x93, 0xb8, 0x98, + 0xe7, 0x24, 0x87, 0x24, 0xaa, 0xe3, 0x13, 0xc5, 0xae, 0x58, 0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, 0xbd, 0x72, 0x1f, 0xc7, 0xe4, 0x7f, 0x6e, 0xc4, 0x66, 0x01, 0x17, 0x5c, 0x86, 0xe0, 0xcc, + 0xd7, 0x22, 0x2f, 0x5a, 0xc8, 0x60, 0xca, 0xa0, 0x01, 0x59, 0x0f, 0x04, 0x86, 0x23, 0x16, 0x60, + 0x51, 0xe0, 0x19, 0x4b, 0xa5, 0x86, 0x02, 0x94, 0x76, 0xda, 0xb5, 0xe0, 0xab, 0x16, 0x36, 0xb0, + 0xac, 0x61, 0x89, 0xa2, 0x9b, 0xa4, 0x37, 0x6d, 0x3c, 0x02, 0x89, 0x99, 0xd3, 0x31, 0x64, 0x9f, + 0xd8, 0xa9, 0x7d, 0x33, 0xb3, 0xfd, 0xb5, 0x45, 0xc8, 0x21, 0xc4, 0x3c, 0x9c, 0x18, 0x47, 0x51, + 0x97, 0xf4, 0x78, 0x96, 0x31, 0x63, 0x49, 0x96, 0x46, 0xd6, 0x4c, 0x2d, 0xbf, 0xcb, 0xb3, 0xcc, + 0x44, 0x87, 0x11, 0x7d, 0x45, 0xda, 0x09, 0x70, 0xa1, 0x93, 0x1a, 0xce, 0xd8, 0x87, 0xd0, 0x2f, + 0xb3, 0xa9, 0x43, 0x3a, 0x20, 0x79, 0x20, 0x20, 0xb2, 0x46, 0x58, 0xf0, 0x67, 0x43, 0xfa, 0x90, + 0xb4, 0x43, 0x81, 0x0a, 0x22, 0xfb, 0xf5, 0x16, 0xfc, 0x72, 0x44, 0x3f, 0x90, 0xb5, 0x5f, 0x74, + 0x62, 0x05, 0xd7, 0x75, 0xbe, 0x84, 0xe9, 0x83, 0x06, 0x77, 0x74, 0xf2, 0xb9, 0x06, 0x3a, 0x24, + 0x0f, 0xec, 0xbe, 0xad, 0x3a, 0x8a, 0x09, 0x94, 0xb1, 0xd3, 0xde, 0x9a, 0xdb, 0xe9, 0x3d, 0xdf, + 0xf0, 0xee, 0x9e, 0x4b, 0xef, 0xe6, 0xf4, 0x0d, 0x5a, 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oolAsset) Marshal() (dAtA []byte, err error) { @@ -298,6 +391,117 @@ func (m *PoolAsset) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *LegacyPool) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LegacyPool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LegacyPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.FundingRate.Size() + i -= size + if _, err := m.FundingRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + if m.LastHeightBorrowInterestRateComputed != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.LastHeightBorrowInterestRateComputed)) + i-- + dAtA[i] = 0x40 + } + if len(m.PoolAssetsShort) > 0 { + for iNdEx := len(m.PoolAssetsShort) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PoolAssetsShort[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + if len(m.PoolAssetsLong) > 0 { + for iNdEx := len(m.PoolAssetsLong) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PoolAssetsLong[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + { + size := m.BorrowInterestRate.Size() + i -= size + if _, err := m.BorrowInterestRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.Closed { + i-- + if m.Closed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if m.Enabled { + i-- + if m.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + { + size := m.Health.Size() + i -= size + if _, err := m.Health.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.AmmPoolId != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.AmmPoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *Pool) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -318,6 +522,16 @@ func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.NetOpenInterest.Size() + i -= size + if _, err := m.NetOpenInterest.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 { size := m.FundingRate.Size() i -= size @@ -445,6 +659,45 @@ func (m *PoolAsset) Size() (n int) { return n } +func (m *LegacyPool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AmmPoolId != 0 { + n += 1 + sovPool(uint64(m.AmmPoolId)) + } + l = m.Health.Size() + n += 1 + l + sovPool(uint64(l)) + if m.Enabled { + n += 2 + } + if m.Closed { + n += 2 + } + l = m.BorrowInterestRate.Size() + n += 1 + l + sovPool(uint64(l)) + if len(m.PoolAssetsLong) > 0 { + for _, e := range m.PoolAssetsLong { + l = e.Size() + n += 1 + l + sovPool(uint64(l)) + } + } + if len(m.PoolAssetsShort) > 0 { + for _, e := range m.PoolAssetsShort { + l = e.Size() + n += 1 + l + sovPool(uint64(l)) + } + } + if m.LastHeightBorrowInterestRateComputed != 0 { + n += 1 + sovPool(uint64(m.LastHeightBorrowInterestRateComputed)) + } + l = m.FundingRate.Size() + n += 1 + l + sovPool(uint64(l)) + return n +} + func (m *Pool) Size() (n int) { if m == nil { return 0 @@ -481,6 +734,8 @@ func (m *Pool) Size() (n int) { } l = m.FundingRate.Size() n += 1 + l + sovPool(uint64(l)) + l = m.NetOpenInterest.Size() + n += 1 + l + sovPool(uint64(l)) return n } @@ -776,7 +1031,7 @@ func (m *PoolAsset) Unmarshal(dAtA []byte) error { } return nil } -func (m *Pool) Unmarshal(dAtA []byte) error { +func (m *LegacyPool) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -799,10 +1054,10 @@ func (m *Pool) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Pool: wiretype end group for non-group") + return fmt.Errorf("proto: LegacyPool: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Pool: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: LegacyPool: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1074,6 +1329,338 @@ func (m *Pool) Unmarshal(dAtA []byte) error { } return nil } +func (m *Pool) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Pool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Pool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AmmPoolId", wireType) + } + m.AmmPoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AmmPoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Health", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Health.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Enabled = bool(v != 0) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Closed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Closed = bool(v != 0) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BorrowInterestRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BorrowInterestRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolAssetsLong", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PoolAssetsLong = append(m.PoolAssetsLong, PoolAsset{}) + if err := m.PoolAssetsLong[len(m.PoolAssetsLong)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolAssetsShort", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PoolAssetsShort = append(m.PoolAssetsShort, PoolAsset{}) + if err := m.PoolAssetsShort[len(m.PoolAssetsShort)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastHeightBorrowInterestRateComputed", wireType) + } + m.LastHeightBorrowInterestRateComputed = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastHeightBorrowInterestRateComputed |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FundingRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FundingRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetOpenInterest", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.NetOpenInterest.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPool(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPool + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipPool(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From d0385a1e4c569a68512193b9c2306eae6a40be20 Mon Sep 17 00:00:00 2001 From: Servio Date: Wed, 18 Sep 2024 16:48:26 -0300 Subject: [PATCH 2/6] test was fixed --- x/perpetual/types/pool.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/perpetual/types/pool.go b/x/perpetual/types/pool.go index cd3e0b42a..2acf5d8c5 100644 --- a/x/perpetual/types/pool.go +++ b/x/perpetual/types/pool.go @@ -19,6 +19,7 @@ func NewPool(poolId uint64) Pool { PoolAssetsShort: []PoolAsset{}, LastHeightBorrowInterestRateComputed: 0, FundingRate: sdk.ZeroDec(), + NetOpenInterest: sdk.ZeroInt(), } } From 29e091d779f77eb17c4793af666ceced6d68fb01 Mon Sep 17 00:00:00 2001 From: Servio Date: Thu, 19 Sep 2024 12:30:58 -0300 Subject: [PATCH 3/6] logic was migrated to query --- Makefile | 2 +- proto/elys/perpetual/pool.proto | 26 +- proto/elys/perpetual/query.proto | 30 +- x/perpetual/keeper/begin_blocker.go | 6 - ...n_interest.go => get_net_open_interest.go} | 7 +- x/perpetual/keeper/pool.go | 11 +- x/perpetual/keeper/pool_test.go | 21 + x/perpetual/keeper/query_pool.go | 30 +- x/perpetual/keeper/query_pool_test.go | 2 +- x/perpetual/migrations/v6_migration.go | 10 + x/perpetual/migrations/v8_migration.go | 35 - x/perpetual/module.go | 9 +- x/perpetual/types/keys.go | 4 +- x/perpetual/types/pool.go | 1 - x/perpetual/types/pool.pb.go | 669 +-------------- x/perpetual/types/query.pb.go | 803 +++++++++++++++--- 16 files changed, 847 insertions(+), 819 deletions(-) rename x/perpetual/keeper/{update_net_open_interest.go => get_net_open_interest.go} (71%) delete mode 100644 x/perpetual/migrations/v8_migration.go diff --git a/Makefile b/Makefile index 0e3a4d1d8..f222367bd 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ NAME?=elys BINARY?=$(NAME)d COMMIT:=$(shell git log -1 --format='%H') -VERSION:=$(shell git describe --tags --match 'v*' --abbrev=8 | sed 's/-g/-/' | sed 's/-[0-9]*-/-/') +VERSION:=v999.999.999 GOFLAGS:="" # if rocksdb env variable is set, add the tag diff --git a/proto/elys/perpetual/pool.proto b/proto/elys/perpetual/pool.proto index 7793b7d84..b9540db96 100644 --- a/proto/elys/perpetual/pool.proto +++ b/proto/elys/perpetual/pool.proto @@ -33,28 +33,6 @@ message PoolAsset { string asset_denom = 7; } -message LegacyPool { - uint64 amm_pool_id = 1; - string health = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - bool enabled = 3; - bool closed = 4; - string borrow_interest_rate = 5 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - repeated PoolAsset pool_assets_long = 6 [(gogoproto.nullable) = false]; - repeated PoolAsset pool_assets_short = 7 [(gogoproto.nullable) = false]; - int64 last_height_borrow_interest_rate_computed = 8; - // funding rate, if positive longs pay shorts, if negative shorts pay longs - string funding_rate = 9 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; -} - message Pool { uint64 amm_pool_id = 1; string health = 2 [ @@ -75,9 +53,9 @@ message Pool { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - string net_open_interest = 10 [ + /*string net_open_interest = 10 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false - ]; + ];*/ } diff --git a/proto/elys/perpetual/query.proto b/proto/elys/perpetual/query.proto index 584016879..ff0389711 100644 --- a/proto/elys/perpetual/query.proto +++ b/proto/elys/perpetual/query.proto @@ -138,7 +138,7 @@ message QueryGetPoolRequest { } message QueryGetPoolResponse { - Pool pool = 1 [(gogoproto.nullable) = false]; + PoolResponse pool = 1 [(gogoproto.nullable) = false]; } message QueryAllPoolRequest { @@ -146,7 +146,7 @@ message QueryAllPoolRequest { } message QueryAllPoolResponse { - repeated Pool pool = 1 [(gogoproto.nullable) = false]; + repeated PoolResponse pool = 1 [(gogoproto.nullable) = false]; cosmos.base.query.v1beta1.PageResponse pagination = 2; } @@ -196,3 +196,29 @@ message QueryOpenEstimationResponse { ]; string price_impact = 20 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; } + +message PoolResponse { + uint64 amm_pool_id = 1; + string health = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + bool enabled = 3; + bool closed = 4; + string borrow_interest_rate = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + repeated PoolAsset pool_assets_long = 6 [(gogoproto.nullable) = false]; + repeated PoolAsset pool_assets_short = 7 [(gogoproto.nullable) = false]; + int64 last_height_borrow_interest_rate_computed = 8; + // funding rate, if positive longs pay shorts, if negative shorts pay longs + string funding_rate = 9 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string net_open_interest = 10 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} diff --git a/x/perpetual/keeper/begin_blocker.go b/x/perpetual/keeper/begin_blocker.go index f8bffe799..4b7b8d770 100644 --- a/x/perpetual/keeper/begin_blocker.go +++ b/x/perpetual/keeper/begin_blocker.go @@ -66,13 +66,7 @@ func (k Keeper) BeginBlocker(ctx sdk.Context) { FundingRateLong: fundingRateLong, FundingRateShort: fundingRateShort, }) - - err = k.UpdateNetOpenInterest(ctx, &pool) - if err != nil { - ctx.Logger().Error(err.Error()) - } } - k.SetPool(ctx, pool) } } diff --git a/x/perpetual/keeper/update_net_open_interest.go b/x/perpetual/keeper/get_net_open_interest.go similarity index 71% rename from x/perpetual/keeper/update_net_open_interest.go rename to x/perpetual/keeper/get_net_open_interest.go index 968507c54..5e7e8a9cf 100644 --- a/x/perpetual/keeper/update_net_open_interest.go +++ b/x/perpetual/keeper/get_net_open_interest.go @@ -1,11 +1,12 @@ package keeper import ( + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/elys-network/elys/x/perpetual/types" ) -func (k Keeper) UpdateNetOpenInterest(ctx sdk.Context, pool *types.Pool) error { +func (k Keeper) GetNetOpenInterest(pool types.Pool) math.Int { assetLiabilitiesLong := sdk.ZeroInt() assetLiabilitiesShort := sdk.ZeroInt() @@ -17,6 +18,6 @@ func (k Keeper) UpdateNetOpenInterest(ctx sdk.Context, pool *types.Pool) error { assetLiabilitiesShort = assetLiabilitiesShort.Add(asset.Liabilities) } - pool.NetOpenInterest = assetLiabilitiesLong.Sub(assetLiabilitiesShort) - return nil + netOpenInterest := assetLiabilitiesLong.Sub(assetLiabilitiesShort) + return netOpenInterest } diff --git a/x/perpetual/keeper/pool.go b/x/perpetual/keeper/pool.go index d62453df8..8e7372734 100644 --- a/x/perpetual/keeper/pool.go +++ b/x/perpetual/keeper/pool.go @@ -60,14 +60,14 @@ func (k Keeper) GetAllPools(ctx sdk.Context) (list []types.Pool) { return } -func (k Keeper) GetAllLegacyPools(ctx sdk.Context) (list []types.LegacyPool) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.PoolKeyPrefix) +func (k Keeper) GetAllLegacyPools(ctx sdk.Context) (list []types.Pool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LegacyPoolKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var val types.LegacyPool + var val types.Pool k.cdc.MustUnmarshal(iterator.Value(), &val) list = append(list, val) } @@ -77,8 +77,7 @@ func (k Keeper) GetAllLegacyPools(ctx sdk.Context) (list []types.LegacyPool) { func (k Keeper) RemoveLegacyPool(ctx sdk.Context, index uint64) { store := ctx.KVStore(k.storeKey) - key := types.GetLegacyPoolKey(index) - store.Delete(key) + store.Delete(types.GetLegacyPoolKey(index)) } func (k Keeper) SetBorrowRate(ctx sdk.Context, block uint64, pool uint64, interest types.InterestBlock) { diff --git a/x/perpetual/keeper/pool_test.go b/x/perpetual/keeper/pool_test.go index 51e999f30..706ed227e 100644 --- a/x/perpetual/keeper/pool_test.go +++ b/x/perpetual/keeper/pool_test.go @@ -21,6 +21,27 @@ func createNPool(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Pool { return items } +func createNPoolResponse(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.PoolResponse { + items := make([]types.PoolResponse, n) + for i := range items { + items[i] = types.PoolResponse{ + AmmPoolId: uint64(i), + Health: sdk.NewDec(100), + Enabled: true, + Closed: false, + BorrowInterestRate: sdk.MustNewDecFromStr("0.000000000000000001"), + PoolAssetsLong: []types.PoolAsset{}, + PoolAssetsShort: []types.PoolAsset{}, + LastHeightBorrowInterestRateComputed: 0, + FundingRate: sdk.ZeroDec(), + NetOpenInterest: sdk.ZeroInt(), + } + + keeper.SetPool(ctx, types.NewPool(uint64(i))) + } + return items +} + func TestPoolGet(t *testing.T) { keeper, ctx := keepertest.PerpetualKeeper(t) items := createNPool(keeper, ctx, 10) diff --git a/x/perpetual/keeper/query_pool.go b/x/perpetual/keeper/query_pool.go index 5adf314cb..2016a1336 100644 --- a/x/perpetual/keeper/query_pool.go +++ b/x/perpetual/keeper/query_pool.go @@ -16,7 +16,7 @@ func (k Keeper) Pools(goCtx context.Context, req *types.QueryAllPoolRequest) (*t return nil, status.Error(codes.InvalidArgument, "invalid request") } - var pools []types.Pool + var pools []types.PoolResponse ctx := sdk.UnwrapSDKContext(goCtx) store := ctx.KVStore(k.storeKey) @@ -34,7 +34,18 @@ func (k Keeper) Pools(goCtx context.Context, req *types.QueryAllPoolRequest) (*t } if ammPool.PoolParams.UseOracle { - pools = append(pools, pool) + pools = append(pools, types.PoolResponse{ + AmmPoolId: pool.AmmPoolId, + Health: pool.Health, + Enabled: pool.Enabled, + Closed: pool.Closed, + BorrowInterestRate: pool.BorrowInterestRate, + PoolAssetsLong: pool.PoolAssetsLong, + PoolAssetsShort: pool.PoolAssetsShort, + LastHeightBorrowInterestRateComputed: pool.LastHeightBorrowInterestRateComputed, + FundingRate: pool.FundingRate, + NetOpenInterest: k.GetNetOpenInterest(pool), + }) } return nil @@ -60,5 +71,18 @@ func (k Keeper) Pool(goCtx context.Context, req *types.QueryGetPoolRequest) (*ty return nil, status.Error(codes.NotFound, "not found") } - return &types.QueryGetPoolResponse{Pool: val}, nil + pool := types.PoolResponse{ + AmmPoolId: val.AmmPoolId, + Health: val.Health, + Enabled: val.Enabled, + Closed: val.Closed, + BorrowInterestRate: val.BorrowInterestRate, + PoolAssetsLong: val.PoolAssetsLong, + PoolAssetsShort: val.PoolAssetsShort, + LastHeightBorrowInterestRateComputed: val.LastHeightBorrowInterestRateComputed, + FundingRate: val.FundingRate, + NetOpenInterest: k.GetNetOpenInterest(val), + } + + return &types.QueryGetPoolResponse{Pool: pool}, nil } diff --git a/x/perpetual/keeper/query_pool_test.go b/x/perpetual/keeper/query_pool_test.go index 5efe09307..f647e72d3 100644 --- a/x/perpetual/keeper/query_pool_test.go +++ b/x/perpetual/keeper/query_pool_test.go @@ -77,7 +77,7 @@ func TestPools_Success(t *testing.T) { func TestPoolQuerySingle(t *testing.T) { keeper, ctx := keepertest.PerpetualKeeper(t) wctx := sdk.WrapSDKContext(ctx) - msgs := createNPool(keeper, ctx, 2) + msgs := createNPoolResponse(keeper, ctx, 2) tests := []struct { desc string request *types.QueryGetPoolRequest diff --git a/x/perpetual/migrations/v6_migration.go b/x/perpetual/migrations/v6_migration.go index abd611cfe..c3e109cc4 100644 --- a/x/perpetual/migrations/v6_migration.go +++ b/x/perpetual/migrations/v6_migration.go @@ -6,5 +6,15 @@ import ( func (m Migrator) V6Migration(ctx sdk.Context) error { + m.keeper.V6_MTPMigration(ctx) + + allLegacyPools := m.keeper.GetAllLegacyPools(ctx) + for _, pool := range allLegacyPools { + m.keeper.SetPool(ctx, pool) + m.keeper.RemoveLegacyPool(ctx, pool.AmmPoolId) + } + + m.keeper.V6_MigrateWhitelistedAddress(ctx) + return nil } diff --git a/x/perpetual/migrations/v8_migration.go b/x/perpetual/migrations/v8_migration.go deleted file mode 100644 index 53d0e9ea2..000000000 --- a/x/perpetual/migrations/v8_migration.go +++ /dev/null @@ -1,35 +0,0 @@ -package migrations - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/elys-network/elys/x/perpetual/types" -) - -func (m Migrator) V8Migration(ctx sdk.Context) error { - - ctx.Logger().Info("Migrating pool from legacy to new format") - - pools := m.keeper.GetAllLegacyPools(ctx) - - for _, pool := range pools { - - ctx.Logger().Debug("pool", pool) - - newPool := types.Pool{ - AmmPoolId: pool.AmmPoolId, - Health: pool.Health, - Enabled: pool.Enabled, - Closed: pool.Closed, - BorrowInterestRate: pool.BorrowInterestRate, - PoolAssetsLong: pool.PoolAssetsLong, - PoolAssetsShort: pool.PoolAssetsShort, - LastHeightBorrowInterestRateComputed: pool.LastHeightBorrowInterestRateComputed, - FundingRate: pool.FundingRate, - NetOpenInterest: sdk.ZeroInt(), - } - - m.keeper.RemoveLegacyPool(ctx, pool.AmmPoolId) - m.keeper.SetPool(ctx, newPool) - } - return nil -} diff --git a/x/perpetual/module.go b/x/perpetual/module.go index 593162462..54b1afcd0 100644 --- a/x/perpetual/module.go +++ b/x/perpetual/module.go @@ -117,8 +117,11 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) m := migrations.NewMigrator(am.keeper) - - err := cfg.RegisterMigration(types.ModuleName, 7, m.V8Migration) + err := cfg.RegisterMigration(types.ModuleName, 5, m.V6Migration) + if err != nil { + panic(err) + } + err = cfg.RegisterMigration(types.ModuleName, 6, m.V7Migration) if err != nil { panic(err) } @@ -145,7 +148,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 8 } +func (AppModule) ConsensusVersion() uint64 { return 7 } // BeginBlock contains the logic that is automatically triggered at the beginning of each block func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { diff --git a/x/perpetual/types/keys.go b/x/perpetual/types/keys.go index 946a7fefd..87ef498cd 100644 --- a/x/perpetual/types/keys.go +++ b/x/perpetual/types/keys.go @@ -98,8 +98,8 @@ func legacyPoolKey(index uint64) []byte { } func GetLegacyPoolKey(index uint64) []byte { - key := PoolKeyPrefix - return append(key, sdk.Uint64ToBigEndian(index)...) + key := KeyPrefix(LegacyPoolKeyPrefix) + return append(key, legacyPoolKey(index)...) } func GetInterestRateKey(block uint64, pool uint64) []byte { diff --git a/x/perpetual/types/pool.go b/x/perpetual/types/pool.go index 2acf5d8c5..cd3e0b42a 100644 --- a/x/perpetual/types/pool.go +++ b/x/perpetual/types/pool.go @@ -19,7 +19,6 @@ func NewPool(poolId uint64) Pool { PoolAssetsShort: []PoolAsset{}, LastHeightBorrowInterestRateComputed: 0, FundingRate: sdk.ZeroDec(), - NetOpenInterest: sdk.ZeroInt(), } } diff --git a/x/perpetual/types/pool.pb.go b/x/perpetual/types/pool.pb.go index cfc9f0eda..eb39f84ff 100644 --- a/x/perpetual/types/pool.pb.go +++ b/x/perpetual/types/pool.pb.go @@ -74,94 +74,6 @@ func (m *PoolAsset) GetAssetDenom() string { return "" } -type LegacyPool struct { - AmmPoolId uint64 `protobuf:"varint,1,opt,name=amm_pool_id,json=ammPoolId,proto3" json:"amm_pool_id,omitempty"` - Health github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=health,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"health"` - Enabled bool `protobuf:"varint,3,opt,name=enabled,proto3" json:"enabled,omitempty"` - Closed bool `protobuf:"varint,4,opt,name=closed,proto3" json:"closed,omitempty"` - BorrowInterestRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=borrow_interest_rate,json=borrowInterestRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"borrow_interest_rate"` - PoolAssetsLong []PoolAsset `protobuf:"bytes,6,rep,name=pool_assets_long,json=poolAssetsLong,proto3" json:"pool_assets_long"` - PoolAssetsShort []PoolAsset `protobuf:"bytes,7,rep,name=pool_assets_short,json=poolAssetsShort,proto3" json:"pool_assets_short"` - LastHeightBorrowInterestRateComputed int64 `protobuf:"varint,8,opt,name=last_height_borrow_interest_rate_computed,json=lastHeightBorrowInterestRateComputed,proto3" json:"last_height_borrow_interest_rate_computed,omitempty"` - // funding rate, if positive longs pay shorts, if negative shorts pay longs - FundingRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,9,opt,name=funding_rate,json=fundingRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"funding_rate"` -} - -func (m *LegacyPool) Reset() { *m = LegacyPool{} } -func (m *LegacyPool) String() string { return proto.CompactTextString(m) } -func (*LegacyPool) ProtoMessage() {} -func (*LegacyPool) Descriptor() ([]byte, []int) { - return fileDescriptor_f2020803d9775cac, []int{1} -} -func (m *LegacyPool) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LegacyPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LegacyPool.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *LegacyPool) XXX_Merge(src proto.Message) { - xxx_messageInfo_LegacyPool.Merge(m, src) -} -func (m *LegacyPool) XXX_Size() int { - return m.Size() -} -func (m *LegacyPool) XXX_DiscardUnknown() { - xxx_messageInfo_LegacyPool.DiscardUnknown(m) -} - -var xxx_messageInfo_LegacyPool proto.InternalMessageInfo - -func (m *LegacyPool) GetAmmPoolId() uint64 { - if m != nil { - return m.AmmPoolId - } - return 0 -} - -func (m *LegacyPool) GetEnabled() bool { - if m != nil { - return m.Enabled - } - return false -} - -func (m *LegacyPool) GetClosed() bool { - if m != nil { - return m.Closed - } - return false -} - -func (m *LegacyPool) GetPoolAssetsLong() []PoolAsset { - if m != nil { - return m.PoolAssetsLong - } - return nil -} - -func (m *LegacyPool) GetPoolAssetsShort() []PoolAsset { - if m != nil { - return m.PoolAssetsShort - } - return nil -} - -func (m *LegacyPool) GetLastHeightBorrowInterestRateComputed() int64 { - if m != nil { - return m.LastHeightBorrowInterestRateComputed - } - return 0 -} - type Pool struct { AmmPoolId uint64 `protobuf:"varint,1,opt,name=amm_pool_id,json=ammPoolId,proto3" json:"amm_pool_id,omitempty"` Health github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=health,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"health"` @@ -172,15 +84,14 @@ type Pool struct { PoolAssetsShort []PoolAsset `protobuf:"bytes,7,rep,name=pool_assets_short,json=poolAssetsShort,proto3" json:"pool_assets_short"` LastHeightBorrowInterestRateComputed int64 `protobuf:"varint,8,opt,name=last_height_borrow_interest_rate_computed,json=lastHeightBorrowInterestRateComputed,proto3" json:"last_height_borrow_interest_rate_computed,omitempty"` // funding rate, if positive longs pay shorts, if negative shorts pay longs - FundingRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,9,opt,name=funding_rate,json=fundingRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"funding_rate"` - NetOpenInterest github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,10,opt,name=net_open_interest,json=netOpenInterest,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"net_open_interest"` + FundingRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,9,opt,name=funding_rate,json=fundingRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"funding_rate"` } func (m *Pool) Reset() { *m = Pool{} } func (m *Pool) String() string { return proto.CompactTextString(m) } func (*Pool) ProtoMessage() {} func (*Pool) Descriptor() ([]byte, []int) { - return fileDescriptor_f2020803d9775cac, []int{2} + return fileDescriptor_f2020803d9775cac, []int{1} } func (m *Pool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -253,52 +164,48 @@ func (m *Pool) GetLastHeightBorrowInterestRateComputed() int64 { func init() { proto.RegisterType((*PoolAsset)(nil), "elys.perpetual.PoolAsset") - proto.RegisterType((*LegacyPool)(nil), "elys.perpetual.LegacyPool") proto.RegisterType((*Pool)(nil), "elys.perpetual.Pool") } func init() { proto.RegisterFile("elys/perpetual/pool.proto", fileDescriptor_f2020803d9775cac) } var fileDescriptor_f2020803d9775cac = []byte{ - // 605 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x95, 0xd1, 0x4e, 0xdb, 0x3c, - 0x14, 0xc7, 0xdb, 0x8f, 0xd2, 0x52, 0x97, 0x0f, 0x86, 0x81, 0x2d, 0xec, 0x22, 0x20, 0x34, 0x4d, - 0xec, 0x82, 0x54, 0xda, 0x9e, 0x60, 0x05, 0x4d, 0x54, 0x43, 0x1a, 0x0b, 0x17, 0x93, 0xb8, 0x98, - 0xe7, 0x24, 0x87, 0x24, 0xaa, 0xe3, 0x13, 0xc5, 0xae, 0x58, 0xdf, 0x62, 0xcf, 0xb0, 0xa7, 0x61, - 0xd2, 0x2e, 0xb8, 0x9c, 0x76, 0x81, 0x26, 0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 0xe0, 0xcc, - 0xd7, 0x22, 0x2f, 0x5a, 0xc8, 0x60, 0xca, 0xa0, 0x01, 0x59, 0x0f, 0x04, 0x86, 0x23, 0x16, 0x60, - 0x51, 0xe0, 0x19, 0x4b, 0xa5, 0x86, 0x02, 0x94, 0x76, 0xda, 0xb5, 0xe0, 0xab, 0x16, 0x36, 0xb0, - 0xac, 0x61, 0x89, 0xa2, 0x9b, 0xa4, 0x37, 0x6d, 0x3c, 0x02, 0x89, 0x99, 0xd3, 0x31, 0x64, 0x9f, - 0xd8, 0xa9, 0x7d, 0x33, 0xb3, 0xfd, 0xb5, 0x45, 0xc8, 0x21, 0xc4, 0x3c, 0x9c, 0x18, 0x47, 0x51, - 0x97, 0xf4, 0x78, 0x96, 0x31, 0x63, 0x49, 0x96, 0x46, 0xd6, 0x4c, 0x2d, 0xbf, 0xcb, 0xb3, 0xcc, - 0x44, 0x87, 0x11, 0x7d, 0x45, 0xda, 0x09, 0x70, 0xa1, 0x93, 0x1a, 0xce, 0xd8, 0x87, 0xd0, 0x2f, - 0xb3, 0xa9, 0x43, 0x3a, 0x20, 0x79, 0x20, 0x20, 0xb2, 0x46, 0x58, 0xf0, 0x67, 0x43, 0xfa, 0x90, - 0xb4, 0x43, 0x81, 0x0a, 0x22, 0xfb, 0xf5, 0x16, 0xfc, 0x72, 0x44, 0x3f, 0x90, 0xb5, 0x5f, 0x74, - 0x62, 0x05, 0xd7, 0x75, 0xbe, 0x84, 0xe9, 0x83, 0x06, 0x77, 0x74, 0xf2, 0xb9, 0x06, 0x3a, 0x24, - 0x0f, 0xec, 0xbe, 0xad, 0x3a, 0x8a, 0x09, 0x94, 0xb1, 0xd3, 0xde, 0x9a, 0xdb, 0xe9, 0x3d, 0xdf, - 0xf0, 0xee, 0x9e, 0x4b, 0xef, 0xe6, 0xf4, 0x0d, 0x5a, 0xa6, 0xb0, 0xbf, 0x94, 0xcf, 0x26, 0xd4, - 0x21, 0xca, 0x98, 0xbe, 0x26, 0x2b, 0x55, 0x94, 0x4a, 0xb0, 0xd0, 0x4e, 0xe7, 0xef, 0x58, 0xcb, - 0xb7, 0xac, 0x63, 0x93, 0x47, 0xdf, 0x91, 0x67, 0x82, 0x2b, 0xcd, 0x12, 0x48, 0xe3, 0x44, 0xb3, - 0x3f, 0xa9, 0xc0, 0x42, 0xcc, 0xf2, 0xb1, 0x86, 0xc8, 0x59, 0xd8, 0x6a, 0xee, 0xcc, 0xf9, 0x4f, - 0x4c, 0xc2, 0x81, 0x5d, 0x3f, 0xf8, 0x6d, 0xa3, 0x7b, 0xe5, 0x5a, 0xfa, 0x96, 0x2c, 0x9e, 0x8e, - 0x65, 0x94, 0xca, 0x78, 0x2a, 0x65, 0xb7, 0x96, 0x94, 0xbd, 0x92, 0x61, 0xd0, 0xdb, 0x9f, 0xe7, - 0x49, 0xeb, 0xde, 0x48, 0xf7, 0x46, 0xfa, 0x57, 0x23, 0xd1, 0x13, 0xb2, 0x22, 0x41, 0x33, 0xcc, - 0x41, 0xde, 0x5e, 0x8c, 0xa4, 0xd6, 0xc5, 0xb8, 0x2c, 0x41, 0xbf, 0xc9, 0x41, 0xce, 0x5a, 0x1f, - 0x1c, 0x9c, 0x5f, 0xb9, 0xcd, 0x8b, 0x2b, 0xb7, 0xf9, 0xe3, 0xca, 0x6d, 0x7e, 0xba, 0x76, 0x1b, - 0x17, 0xd7, 0x6e, 0xe3, 0xdb, 0xb5, 0xdb, 0x38, 0xf1, 0x2a, 0x48, 0xa3, 0xee, 0xae, 0x04, 0x7d, - 0x86, 0xc5, 0xc8, 0x0e, 0xfa, 0x1f, 0x2b, 0x8f, 0xb6, 0xc5, 0x07, 0x6d, 0xfb, 0x20, 0xbf, 0xf8, - 0x19, 0x00, 0x00, 0xff, 0xff, 0x68, 0xed, 0x3c, 0x9f, 0xd3, 0x07, 0x00, 0x00, + // 560 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9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 0x00, } func (m *PoolAsset) Marshal() (dAtA []byte, err error) { @@ -391,117 +298,6 @@ func (m *PoolAsset) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *LegacyPool) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LegacyPool) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LegacyPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.FundingRate.Size() - i -= size - if _, err := m.FundingRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintPool(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - if m.LastHeightBorrowInterestRateComputed != 0 { - i = encodeVarintPool(dAtA, i, uint64(m.LastHeightBorrowInterestRateComputed)) - i-- - dAtA[i] = 0x40 - } - if len(m.PoolAssetsShort) > 0 { - for iNdEx := len(m.PoolAssetsShort) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PoolAssetsShort[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPool(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - if len(m.PoolAssetsLong) > 0 { - for iNdEx := len(m.PoolAssetsLong) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PoolAssetsLong[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPool(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - { - size := m.BorrowInterestRate.Size() - i -= size - if _, err := m.BorrowInterestRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintPool(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if m.Closed { - i-- - if m.Closed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.Enabled { - i-- - if m.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - { - size := m.Health.Size() - i -= size - if _, err := m.Health.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintPool(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.AmmPoolId != 0 { - i = encodeVarintPool(dAtA, i, uint64(m.AmmPoolId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - func (m *Pool) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -522,16 +318,6 @@ func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size := m.NetOpenInterest.Size() - i -= size - if _, err := m.NetOpenInterest.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintPool(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x52 { size := m.FundingRate.Size() i -= size @@ -659,45 +445,6 @@ func (m *PoolAsset) Size() (n int) { return n } -func (m *LegacyPool) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.AmmPoolId != 0 { - n += 1 + sovPool(uint64(m.AmmPoolId)) - } - l = m.Health.Size() - n += 1 + l + sovPool(uint64(l)) - if m.Enabled { - n += 2 - } - if m.Closed { - n += 2 - } - l = m.BorrowInterestRate.Size() - n += 1 + l + sovPool(uint64(l)) - if len(m.PoolAssetsLong) > 0 { - for _, e := range m.PoolAssetsLong { - l = e.Size() - n += 1 + l + sovPool(uint64(l)) - } - } - if len(m.PoolAssetsShort) > 0 { - for _, e := range m.PoolAssetsShort { - l = e.Size() - n += 1 + l + sovPool(uint64(l)) - } - } - if m.LastHeightBorrowInterestRateComputed != 0 { - n += 1 + sovPool(uint64(m.LastHeightBorrowInterestRateComputed)) - } - l = m.FundingRate.Size() - n += 1 + l + sovPool(uint64(l)) - return n -} - func (m *Pool) Size() (n int) { if m == nil { return 0 @@ -734,8 +481,6 @@ func (m *Pool) Size() (n int) { } l = m.FundingRate.Size() n += 1 + l + sovPool(uint64(l)) - l = m.NetOpenInterest.Size() - n += 1 + l + sovPool(uint64(l)) return n } @@ -1031,7 +776,7 @@ func (m *PoolAsset) Unmarshal(dAtA []byte) error { } return nil } -func (m *LegacyPool) Unmarshal(dAtA []byte) error { +func (m *Pool) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1054,10 +799,10 @@ func (m *LegacyPool) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: LegacyPool: wiretype end group for non-group") + return fmt.Errorf("proto: Pool: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: LegacyPool: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Pool: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1329,338 +1074,6 @@ func (m *LegacyPool) Unmarshal(dAtA []byte) error { } return nil } -func (m *Pool) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Pool: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Pool: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AmmPoolId", wireType) - } - m.AmmPoolId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AmmPoolId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Health", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPool - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPool - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Health.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Enabled = bool(v != 0) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Closed", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Closed = bool(v != 0) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BorrowInterestRate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPool - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPool - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.BorrowInterestRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PoolAssetsLong", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPool - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPool - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PoolAssetsLong = append(m.PoolAssetsLong, PoolAsset{}) - if err := m.PoolAssetsLong[len(m.PoolAssetsLong)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PoolAssetsShort", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPool - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPool - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PoolAssetsShort = append(m.PoolAssetsShort, PoolAsset{}) - if err := m.PoolAssetsShort[len(m.PoolAssetsShort)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LastHeightBorrowInterestRateComputed", wireType) - } - m.LastHeightBorrowInterestRateComputed = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LastHeightBorrowInterestRateComputed |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FundingRate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPool - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPool - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.FundingRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NetOpenInterest", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPool - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPool - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NetOpenInterest.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPool(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPool - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipPool(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/perpetual/types/query.pb.go b/x/perpetual/types/query.pb.go index 7fc6e6390..e854ff5ed 100644 --- a/x/perpetual/types/query.pb.go +++ b/x/perpetual/types/query.pb.go @@ -744,7 +744,7 @@ func (m *QueryGetPoolRequest) GetIndex() uint64 { } type QueryGetPoolResponse struct { - Pool Pool `protobuf:"bytes,1,opt,name=pool,proto3" json:"pool"` + Pool PoolResponse `protobuf:"bytes,1,opt,name=pool,proto3" json:"pool"` } func (m *QueryGetPoolResponse) Reset() { *m = QueryGetPoolResponse{} } @@ -780,11 +780,11 @@ func (m *QueryGetPoolResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryGetPoolResponse proto.InternalMessageInfo -func (m *QueryGetPoolResponse) GetPool() Pool { +func (m *QueryGetPoolResponse) GetPool() PoolResponse { if m != nil { return m.Pool } - return Pool{} + return PoolResponse{} } type QueryAllPoolRequest struct { @@ -832,7 +832,7 @@ func (m *QueryAllPoolRequest) GetPagination() *query.PageRequest { } type QueryAllPoolResponse struct { - Pool []Pool `protobuf:"bytes,1,rep,name=pool,proto3" json:"pool"` + Pool []PoolResponse `protobuf:"bytes,1,rep,name=pool,proto3" json:"pool"` Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -869,7 +869,7 @@ func (m *QueryAllPoolResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAllPoolResponse proto.InternalMessageInfo -func (m *QueryAllPoolResponse) GetPool() []Pool { +func (m *QueryAllPoolResponse) GetPool() []PoolResponse { if m != nil { return m.Pool } @@ -1154,6 +1154,95 @@ func (m *QueryOpenEstimationResponse) GetAvailableLiquidity() types.Coin { return types.Coin{} } +type PoolResponse struct { + AmmPoolId uint64 `protobuf:"varint,1,opt,name=amm_pool_id,json=ammPoolId,proto3" json:"amm_pool_id,omitempty"` + Health github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=health,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"health"` + Enabled bool `protobuf:"varint,3,opt,name=enabled,proto3" json:"enabled,omitempty"` + Closed bool `protobuf:"varint,4,opt,name=closed,proto3" json:"closed,omitempty"` + BorrowInterestRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=borrow_interest_rate,json=borrowInterestRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"borrow_interest_rate"` + PoolAssetsLong []PoolAsset `protobuf:"bytes,6,rep,name=pool_assets_long,json=poolAssetsLong,proto3" json:"pool_assets_long"` + PoolAssetsShort []PoolAsset `protobuf:"bytes,7,rep,name=pool_assets_short,json=poolAssetsShort,proto3" json:"pool_assets_short"` + LastHeightBorrowInterestRateComputed int64 `protobuf:"varint,8,opt,name=last_height_borrow_interest_rate_computed,json=lastHeightBorrowInterestRateComputed,proto3" json:"last_height_borrow_interest_rate_computed,omitempty"` + // funding rate, if positive longs pay shorts, if negative shorts pay longs + FundingRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,9,opt,name=funding_rate,json=fundingRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"funding_rate"` + NetOpenInterest github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,10,opt,name=net_open_interest,json=netOpenInterest,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"net_open_interest"` +} + +func (m *PoolResponse) Reset() { *m = PoolResponse{} } +func (m *PoolResponse) String() string { return proto.CompactTextString(m) } +func (*PoolResponse) ProtoMessage() {} +func (*PoolResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9a2c961615c1b7fe, []int{22} +} +func (m *PoolResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PoolResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PoolResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PoolResponse.Merge(m, src) +} +func (m *PoolResponse) XXX_Size() int { + return m.Size() +} +func (m *PoolResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PoolResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PoolResponse proto.InternalMessageInfo + +func (m *PoolResponse) GetAmmPoolId() uint64 { + if m != nil { + return m.AmmPoolId + } + return 0 +} + +func (m *PoolResponse) GetEnabled() bool { + if m != nil { + return m.Enabled + } + return false +} + +func (m *PoolResponse) GetClosed() bool { + if m != nil { + return m.Closed + } + return false +} + +func (m *PoolResponse) GetPoolAssetsLong() []PoolAsset { + if m != nil { + return m.PoolAssetsLong + } + return nil +} + +func (m *PoolResponse) GetPoolAssetsShort() []PoolAsset { + if m != nil { + return m.PoolAssetsShort + } + return nil +} + +func (m *PoolResponse) GetLastHeightBorrowInterestRateComputed() int64 { + if m != nil { + return m.LastHeightBorrowInterestRateComputed + } + return 0 +} + func init() { proto.RegisterType((*ParamsRequest)(nil), "elys.perpetual.ParamsRequest") proto.RegisterType((*ParamsResponse)(nil), "elys.perpetual.ParamsResponse") @@ -1177,109 +1266,121 @@ func init() { proto.RegisterType((*MTPResponse)(nil), "elys.perpetual.MTPResponse") proto.RegisterType((*QueryOpenEstimationRequest)(nil), "elys.perpetual.QueryOpenEstimationRequest") proto.RegisterType((*QueryOpenEstimationResponse)(nil), "elys.perpetual.QueryOpenEstimationResponse") + proto.RegisterType((*PoolResponse)(nil), "elys.perpetual.PoolResponse") } func init() { proto.RegisterFile("elys/perpetual/query.proto", fileDescriptor_9a2c961615c1b7fe) } var fileDescriptor_9a2c961615c1b7fe = []byte{ - // 1542 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0x4f, 0x6f, 0xdb, 0x46, - 0x16, 0x37, 0xfd, 0x2f, 0xd6, 0xb3, 0x24, 0xdb, 0x63, 0x6f, 0x56, 0x91, 0xb3, 0x4a, 0x96, 0x89, - 0xf3, 0xcf, 0x91, 0xb8, 0x76, 0x8c, 0x0d, 0x76, 0x2f, 0x41, 0x9c, 0xac, 0x13, 0x07, 0x6b, 0xac, - 0xa2, 0x04, 0xd8, 0x85, 0x17, 0x05, 0x3b, 0x12, 0xc7, 0xca, 0xc0, 0x24, 0x87, 0x21, 0x47, 0x76, - 0x9c, 0xc0, 0x45, 0x51, 0xb4, 0xa7, 0x02, 0x4d, 0x8b, 0xf6, 0xde, 0x2f, 0xd0, 0x7b, 0x3f, 0x40, - 0x2f, 0x39, 0x06, 0xe8, 0xa5, 0xe8, 0x21, 0x28, 0x92, 0x9e, 0xda, 0x2f, 0x51, 0xcc, 0x70, 0x48, - 0x53, 0xa2, 0x64, 0x2b, 0xaa, 0x81, 0x1c, 0x7a, 0xb2, 0x35, 0xf3, 0xde, 0xef, 0xfd, 0xe6, 0xcd, - 0x7b, 0x33, 0xf3, 0x23, 0x14, 0x89, 0xbd, 0x17, 0x18, 0x1e, 0xf1, 0x3d, 0xc2, 0x5b, 0xd8, 0x36, - 0x1e, 0xb7, 0x88, 0xbf, 0x57, 0xf1, 0x7c, 0xc6, 0x19, 0xca, 0x8b, 0xb9, 0x4a, 0x3c, 0x57, 0x9c, - 0x6b, 0xb2, 0x26, 0x93, 0x53, 0x86, 0xf8, 0x2f, 0xb4, 0x2a, 0x9e, 0x6e, 0x32, 0xd6, 0xb4, 0x89, - 0x81, 0x3d, 0x6a, 0x60, 0xd7, 0x65, 0x1c, 0x73, 0xca, 0xdc, 0x40, 0xcd, 0x5e, 0x69, 0xb0, 0xc0, - 0x61, 0x81, 0x51, 0xc7, 0x01, 0x09, 0xc1, 0x8d, 0x9d, 0xa5, 0x3a, 0xe1, 0x78, 0xc9, 0xf0, 0x70, - 0x93, 0xba, 0xd2, 0x58, 0xd9, 0xce, 0x77, 0x70, 0xf1, 0xb0, 0x8f, 0x9d, 0x08, 0xa8, 0x93, 0x28, - 0xdf, 0xf3, 0x48, 0x34, 0x77, 0xaa, 0xd3, 0x91, 0x31, 0x5b, 0x4d, 0x95, 0x92, 0xf1, 0xa3, 0xc8, - 0x0d, 0x46, 0x55, 0x4c, 0x7d, 0x0a, 0x72, 0x55, 0x19, 0xa6, 0x46, 0x1e, 0xb7, 0x48, 0xc0, 0xf5, - 0x35, 0xc8, 0x47, 0x03, 0x81, 0xc7, 0xdc, 0x80, 0xa0, 0x15, 0x18, 0x0f, 0x99, 0x14, 0xb4, 0xb3, - 0xda, 0xa5, 0xc9, 0xe5, 0x93, 0x95, 0xf6, 0xbc, 0x54, 0x42, 0xfb, 0xd5, 0xd1, 0x17, 0xaf, 0xce, - 0x0c, 0xd5, 0x94, 0xad, 0xbe, 0x09, 0xd3, 0x55, 0x16, 0x50, 0x99, 0x0b, 0x85, 0x8d, 0xd6, 0x00, - 0x0e, 0x16, 0xad, 0xd0, 0x2e, 0x54, 0x42, 0x86, 0x15, 0xc1, 0xb0, 0x12, 0xa6, 0x5f, 0xf1, 0xac, - 0x54, 0x71, 0x93, 0x28, 0xdf, 0x5a, 0xc2, 0x53, 0xff, 0x44, 0x83, 0x99, 0x04, 0xb8, 0xe2, 0x79, - 0x11, 0x46, 0x1d, 0xee, 0x09, 0x96, 0x23, 0x97, 0x26, 0x97, 0x67, 0x3b, 0x59, 0x6e, 0x3c, 0xac, - 0xd6, 0xa4, 0x01, 0xba, 0xd3, 0x46, 0x63, 0x58, 0xd2, 0xb8, 0x78, 0x24, 0x8d, 0x30, 0x4a, 0x1b, - 0x8f, 0x0f, 0x35, 0x38, 0x19, 0xf3, 0x58,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0x31, 0xb5, 0xf6, 0xd1, 0xd7, 0x1a, - 0xe4, 0xdb, 0xdf, 0xec, 0xe9, 0xce, 0xeb, 0xad, 0xc3, 0xd2, 0x9d, 0x77, 0x88, 0x08, 0xd0, 0x57, - 0x24, 0xc9, 0x0a, 0xba, 0x7a, 0x28, 0x49, 0xf1, 0x5a, 0x2b, 0x93, 0xd8, 0x7b, 0xf5, 0xee, 0x8b, - 0xd7, 0x25, 0xed, 0xe5, 0xeb, 0x92, 0xf6, 0xd3, 0xeb, 0x92, 0xf6, 0xf9, 0x9b, 0xd2, 0xd0, 0xcb, - 0x37, 0xa5, 0xa1, 0x1f, 0xde, 0x94, 0x86, 0x36, 0x2b, 0x89, 0xcb, 0x2b, 0x8d, 0xf8, 0xa4, 0xf3, - 0x1b, 0x6d, 0x7d, 0x5c, 0x7e, 0x69, 0xbd, 0xf6, 0x5b, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xd6, - 0xa6, 0x80, 0x6b, 0x16, 0x00, 0x00, + // 1717 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x59, 0x4f, 0x6f, 0xdb, 0xc8, + 0x15, 0x37, 0xfd, 0x47, 0xb6, 0x9e, 0x25, 0xd9, 0x1a, 0xbb, 0x2e, 0x23, 0xa7, 0xda, 0x2d, 0x63, + 0x27, 0x9b, 0xf5, 0x4a, 0xaa, 0xbd, 0xc6, 0x2e, 0xda, 0xcb, 0x22, 0x76, 0xea, 0xc4, 0x69, 0xdc, + 0x2a, 0x74, 0x80, 0x14, 0x2e, 0x0a, 0x96, 0x12, 0xc7, 0xf2, 0xc0, 0x24, 0x87, 0x21, 0x47, 0x76, + 0x9c, 0xc0, 0x45, 0x51, 0xb4, 0xa7, 0x02, 0xfd, 0x83, 0x16, 0xe8, 0xb1, 0xf7, 0xa2, 0xf7, 0x7e, + 0x80, 0x5e, 0x72, 0x0c, 0xd0,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0xe8, 0x17, 0x0a, 0x4c, 0x8a, 0xac, 0xb8, 0xd1, 0x6d, 0xa4, 0x47, 0xfb, 0xa1, + 0xb4, 0x72, 0xb9, 0x90, 0x24, 0xb2, 0x2e, 0x88, 0xac, 0xa1, 0xdb, 0x03, 0x12, 0x97, 0xe7, 0x81, + 0x68, 0x60, 0x9c, 0xa3, 0x5f, 0x2b, 0x30, 0xc5, 0x31, 0x82, 0x3e, 0x3c, 0x3a, 0x3b, 0x11, 0x7d, + 0x78, 0x74, 0xb5, 0x13, 0xb4, 0xef, 0x08, 0x1e, 0x9b, 0x68, 0x63, 0x08, 0x1e, 0xe9, 0x0c, 0x9c, + 0xd8, 0x7b, 0x5c, 0x47, 0xa5, 0x5e, 0x8f, 0x77, 0x49, 0x62, 0xb9, 0xe7, 0x9c, 0xb4, 0xfd, 0xa5, + 0xb0, 0xbd, 0x8e, 0x6a, 0x83, 0x82, 0x3a, 0x19, 0xc7, 0xc4, 0x3a, 0x47, 0x7f, 0x52, 0xa0, 0xd0, + 0xf9, 0xc0, 0x4c, 0x67, 0x5e, 0xff, 0xa6, 0x41, 0x3a, 0xf3, 0x2e, 0x79, 0xb1, 0x6a, 0x9b, 0x82, + 0x64, 0x15, 0x7d, 0x76, 0x29, 0x49, 0x7e, 0x64, 0x55, 0x70, 0xac, 0xbd, 0x75, 0xff, 0xe5, 0x9b, + 0xb2, 0xf2, 0xea, 0x4d, 0x59, 0xf9, 0xd7, 0x9b, 0xb2, 0xf2, 0xdb, 0xb7, 0xe5, 0xb1, 0x57, 0x6f, + 0xcb, 0x63, 0xff, 0x78, 0x5b, 0x1e, 0x3b, 0xa8, 0x26, 0x0e, 0xb0, 0x34, 0xe2, 0xb3, 0xee, 0x1f, + 0x18, 0x1a, 0x19, 0xf1, 0x33, 0xc1, 0xe7, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xd6, 0xe4, 0x26, + 0xa7, 0x28, 0x19, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2781,6 +2882,127 @@ func (m *QueryOpenEstimationResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } +func (m *PoolResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PoolResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.NetOpenInterest.Size() + i -= size + if _, err := m.NetOpenInterest.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + { + size := m.FundingRate.Size() + i -= size + if _, err := m.FundingRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + if m.LastHeightBorrowInterestRateComputed != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.LastHeightBorrowInterestRateComputed)) + i-- + dAtA[i] = 0x40 + } + if len(m.PoolAssetsShort) > 0 { + for iNdEx := len(m.PoolAssetsShort) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PoolAssetsShort[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + if len(m.PoolAssetsLong) > 0 { + for iNdEx := len(m.PoolAssetsLong) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PoolAssetsLong[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + { + size := m.BorrowInterestRate.Size() + i -= size + if _, err := m.BorrowInterestRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.Closed { + i-- + if m.Closed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if m.Enabled { + i-- + if m.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + { + size := m.Health.Size() + i -= size + if _, err := m.Health.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.AmmPoolId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.AmmPoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -3163,6 +3385,47 @@ func (m *QueryOpenEstimationResponse) Size() (n int) { return n } +func (m *PoolResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AmmPoolId != 0 { + n += 1 + sovQuery(uint64(m.AmmPoolId)) + } + l = m.Health.Size() + n += 1 + l + sovQuery(uint64(l)) + if m.Enabled { + n += 2 + } + if m.Closed { + n += 2 + } + l = m.BorrowInterestRate.Size() + n += 1 + l + sovQuery(uint64(l)) + if len(m.PoolAssetsLong) > 0 { + for _, e := range m.PoolAssetsLong { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if len(m.PoolAssetsShort) > 0 { + for _, e := range m.PoolAssetsShort { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.LastHeightBorrowInterestRateComputed != 0 { + n += 1 + sovQuery(uint64(m.LastHeightBorrowInterestRateComputed)) + } + l = m.FundingRate.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.NetOpenInterest.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -4793,7 +5056,7 @@ func (m *QueryAllPoolResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Pool = append(m.Pool, Pool{}) + m.Pool = append(m.Pool, PoolResponse{}) if err := m.Pool[len(m.Pool)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -5971,6 +6234,338 @@ func (m *QueryOpenEstimationResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *PoolResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PoolResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AmmPoolId", wireType) + } + m.AmmPoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AmmPoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Health", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Health.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Enabled = bool(v != 0) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Closed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Closed = bool(v != 0) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BorrowInterestRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BorrowInterestRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolAssetsLong", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PoolAssetsLong = append(m.PoolAssetsLong, PoolAsset{}) + if err := m.PoolAssetsLong[len(m.PoolAssetsLong)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolAssetsShort", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PoolAssetsShort = append(m.PoolAssetsShort, PoolAsset{}) + if err := m.PoolAssetsShort[len(m.PoolAssetsShort)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastHeightBorrowInterestRateComputed", wireType) + } + m.LastHeightBorrowInterestRateComputed = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastHeightBorrowInterestRateComputed |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FundingRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FundingRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetOpenInterest", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.NetOpenInterest.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From 5c9725aa5d8d125638ed1c098920d33eb3dc311f Mon Sep 17 00:00:00 2001 From: Servio Date: Thu, 19 Sep 2024 12:31:57 -0300 Subject: [PATCH 4/6] logic was migrated to query --- proto/elys/perpetual/pool.proto | 4 ---- 1 file changed, 4 deletions(-) diff --git a/proto/elys/perpetual/pool.proto b/proto/elys/perpetual/pool.proto index b9540db96..daa2c9408 100644 --- a/proto/elys/perpetual/pool.proto +++ b/proto/elys/perpetual/pool.proto @@ -53,9 +53,5 @@ message Pool { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - /*string net_open_interest = 10 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ];*/ } From 01cbff3a1532c15c2219f8c55f8a0d3984cc5966 Mon Sep 17 00:00:00 2001 From: Servio Date: Thu, 19 Sep 2024 12:32:51 -0300 Subject: [PATCH 5/6] logic was migrated to query --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f222367bd..0e3a4d1d8 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ NAME?=elys BINARY?=$(NAME)d COMMIT:=$(shell git log -1 --format='%H') -VERSION:=v999.999.999 +VERSION:=$(shell git describe --tags --match 'v*' --abbrev=8 | sed 's/-g/-/' | sed 's/-[0-9]*-/-/') GOFLAGS:="" # if rocksdb env variable is set, add the tag From 0eb84aa55a698ec029a3342d054811e7b20cac74 Mon Sep 17 00:00:00 2001 From: Servio Date: Thu, 19 Sep 2024 12:58:18 -0300 Subject: [PATCH 6/6] test was fixed --- x/perpetual/client/cli/query_pool_test.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/x/perpetual/client/cli/query_pool_test.go b/x/perpetual/client/cli/query_pool_test.go index 6446bf7fd..b6192d793 100644 --- a/x/perpetual/client/cli/query_pool_test.go +++ b/x/perpetual/client/cli/query_pool_test.go @@ -10,6 +10,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/elys-network/elys/testutil/network" "github.com/elys-network/elys/testutil/nullify" "github.com/elys-network/elys/x/perpetual/client/cli" @@ -32,7 +33,22 @@ func networkWithPoolObjects(t *testing.T, n int) (*network.Network, []types.Pool } func TestShowPool(t *testing.T) { - net, objs := networkWithPoolObjects(t, 2) + net, objspool := networkWithPoolObjects(t, 2) + + objs := make([]types.PoolResponse, len(objspool)) + + for k, v := range objspool { + objs[k].AmmPoolId = v.AmmPoolId + objs[k].BorrowInterestRate = v.BorrowInterestRate + objs[k].Health = v.Health + objs[k].Closed = v.Closed + objs[k].Enabled = v.Enabled + objs[k].FundingRate = v.FundingRate + objs[k].LastHeightBorrowInterestRateComputed = v.LastHeightBorrowInterestRateComputed + objs[k].PoolAssetsLong = v.PoolAssetsLong + objs[k].PoolAssetsShort = v.PoolAssetsShort + objs[k].NetOpenInterest = sdk.ZeroInt() + } ctx := net.Validators[0].ClientCtx common := []string{ @@ -44,7 +60,7 @@ func TestShowPool(t *testing.T) { args []string err error - obj types.Pool + obj types.PoolResponse }{ { desc: "found",