diff --git a/proto/elys/margin/types.proto b/proto/elys/margin/types.proto index b2187efc8..b15a51a9c 100644 --- a/proto/elys/margin/types.proto +++ b/proto/elys/margin/types.proto @@ -16,30 +16,36 @@ enum Position { message MTP { string address = 1; repeated cosmos.base.v1beta1.Coin collaterals = 2 [ - (gogoproto.nullable) = false + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; string liabilities = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; repeated cosmos.base.v1beta1.Coin borrow_interest_paid_collaterals = 4 [ - (gogoproto.nullable) = false + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; repeated cosmos.base.v1beta1.Coin borrow_interest_paid_custodies = 5 [ - (gogoproto.nullable) = false + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; repeated cosmos.base.v1beta1.Coin borrow_interest_unpaid_collaterals = 6 [ - (gogoproto.nullable) = false + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; repeated cosmos.base.v1beta1.Coin custodies = 7 [ - (gogoproto.nullable) = false + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; string take_profit_liabilities = 8 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; repeated cosmos.base.v1beta1.Coin take_profit_custodies = 9 [ - (gogoproto.nullable) = false + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; repeated string leverages = 10 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", @@ -70,17 +76,21 @@ message MTP { ]; // funding fee paid repeated cosmos.base.v1beta1.Coin funding_fee_paid_collaterals = 19 [ - (gogoproto.nullable) = false + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; repeated cosmos.base.v1beta1.Coin funding_fee_paid_custodies = 20 [ - (gogoproto.nullable) = false + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; // funding fee received repeated cosmos.base.v1beta1.Coin funding_fee_received_collaterals = 21 [ - (gogoproto.nullable) = false + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; repeated cosmos.base.v1beta1.Coin funding_fee_received_custodies = 22 [ - (gogoproto.nullable) = false + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } diff --git a/x/margin/keeper/calc_mtp_interest_liabilities.go b/x/margin/keeper/calc_mtp_interest_liabilities.go index 86a87e36d..fcb6dfbd2 100644 --- a/x/margin/keeper/calc_mtp_interest_liabilities.go +++ b/x/margin/keeper/calc_mtp_interest_liabilities.go @@ -18,14 +18,13 @@ func (k Keeper) CalcMTPBorrowInterestLiabilities(ctx sdk.Context, mtp *types.MTP rate.SetFloat64(borrowInterestRate.MustFloat64()) - collateralIndex, _ := types.GetMTPAssetIndex(mtp, collateralAsset, "") unpaidCollaterals := sdk.ZeroInt() // Calculate collateral borrow interests in base currency - if mtp.Collaterals[collateralIndex].Denom == baseCurrency { - unpaidCollaterals = unpaidCollaterals.Add(mtp.BorrowInterestUnpaidCollaterals[collateralIndex].Amount) + if collateralAsset == baseCurrency { + unpaidCollaterals = unpaidCollaterals.Add(mtp.BorrowInterestUnpaidCollaterals.AmountOf(collateralAsset)) } else { // Liability is in base currency, so convert it to base currency - unpaidCollateralIn := sdk.NewCoin(mtp.Collaterals[collateralIndex].Denom, mtp.BorrowInterestUnpaidCollaterals[collateralIndex].Amount) + unpaidCollateralIn := sdk.NewCoin(collateralAsset, mtp.BorrowInterestUnpaidCollaterals.AmountOf(collateralAsset)) C, err := k.EstimateSwapGivenOut(ctx, unpaidCollateralIn, baseCurrency, ammPool) if err != nil { return sdk.ZeroInt(), err diff --git a/x/margin/keeper/estimate_and_repay.go b/x/margin/keeper/estimate_and_repay.go index 52d4c146c..51163fc11 100644 --- a/x/margin/keeper/estimate_and_repay.go +++ b/x/margin/keeper/estimate_and_repay.go @@ -7,9 +7,11 @@ import ( ) func (k Keeper) EstimateAndRepay(ctx sdk.Context, mtp types.MTP, pool types.Pool, ammPool ammtypes.Pool, collateralAsset string, custodyAsset string) (sdk.Int, error) { - collateralIndex, custodyIndex := types.GetMTPAssetIndex(&mtp, collateralAsset, custodyAsset) - cutodyAmtTokenIn := sdk.NewCoin(mtp.Custodies[custodyIndex].Denom, mtp.Custodies[custodyIndex].Amount) - repayAmount, err := k.EstimateSwap(ctx, cutodyAmtTokenIn, mtp.Collaterals[collateralIndex].Denom, ammPool) + ok, custodyAmtTokemIn := mtp.Custodies.Find(custodyAsset) + if !ok { + return sdk.ZeroInt(), types.ErrDenomNotFound + } + repayAmount, err := k.EstimateSwap(ctx, custodyAmtTokemIn, collateralAsset, ammPool) if err != nil { return sdk.ZeroInt(), err } diff --git a/x/margin/keeper/handle_borrow_interest_payment.go b/x/margin/keeper/handle_borrow_interest_payment.go index 504eeb593..6c79106ba 100644 --- a/x/margin/keeper/handle_borrow_interest_payment.go +++ b/x/margin/keeper/handle_borrow_interest_payment.go @@ -18,24 +18,22 @@ func (k Keeper) HandleBorrowInterestPayment(ctx sdk.Context, collateralAsset str return finalBorrowInterestPayment } } else { // else update unpaid mtp interest - collateralIndex, _ := types.GetMTPAssetIndex(mtp, collateralAsset, "") - if collateralIndex < 0 { - return sdk.ZeroInt() - } - - // collateralAsset is in base currency - if mtp.Collaterals[collateralIndex].Denom == baseCurrency { - mtp.BorrowInterestUnpaidCollaterals[collateralIndex].Amount = borrowInterestPayment - } else { + // collateralAsset is not in base currency + if collateralAsset != baseCurrency { // swap amtTokenIn := sdk.NewCoin(baseCurrency, borrowInterestPayment) - borrowInterestPayment, err := k.EstimateSwap(ctx, amtTokenIn, collateralAsset, ammPool) // may need spot price here to not deduct fee + var err error + borrowInterestPayment, err = k.EstimateSwap(ctx, amtTokenIn, collateralAsset, ammPool) // may need spot price here to not deduct fee if err != nil { return sdk.ZeroInt() } - - mtp.BorrowInterestUnpaidCollaterals[collateralIndex].Amount = borrowInterestPayment } + + mtp.BorrowInterestUnpaidCollaterals = mtp.BorrowInterestUnpaidCollaterals.Sub( + sdk.NewCoin(collateralAsset, mtp.BorrowInterestUnpaidCollaterals.AmountOf(collateralAsset)), + ).Add( + sdk.NewCoin(collateralAsset, borrowInterestPayment), + ) } return sdk.ZeroInt() } diff --git a/x/margin/keeper/handle_funding_fee_collection.go b/x/margin/keeper/handle_funding_fee_collection.go index f4e624e3d..88c8fbb4f 100644 --- a/x/margin/keeper/handle_funding_fee_collection.go +++ b/x/margin/keeper/handle_funding_fee_collection.go @@ -21,11 +21,14 @@ func (k Keeper) HandleFundingFeeCollection(ctx sdk.Context, mtp *types.MTP, pool return nil } - // get indexes - collateralIndex, custodyIndex := types.GetMTPAssetIndex(mtp, collateralAsset, custodyAsset) + // get custody coin + ok, custodyAmt := mtp.Custodies.Find(custodyAsset) + if !ok { + return types.ErrDenomNotFound + } // Calculate the take amount in custody asset - takeAmountCustody := types.CalcTakeAmount(mtp.Custodies[custodyIndex], custodyAsset, fundingRate) + takeAmountCustody := types.CalcTakeAmount(custodyAmt, custodyAsset, fundingRate) // Swap the take amount to collateral asset takeAmountCollateralAmount, err := k.EstimateSwap(ctx, takeAmountCustody, collateralAsset, ammPool) @@ -46,13 +49,13 @@ func (k Keeper) HandleFundingFeeCollection(ctx sdk.Context, mtp *types.MTP, pool } // update mtp custody - mtp.Custodies[custodyIndex] = mtp.Custodies[custodyIndex].Sub(takeAmountCustody) + mtp.Custodies = mtp.Custodies.Sub(takeAmountCustody) // add payment to total funding fee paid in collateral asset - mtp.FundingFeePaidCollaterals[collateralIndex] = mtp.FundingFeePaidCollaterals[collateralIndex].Add(takeAmountCollateral) + mtp.FundingFeePaidCollaterals = mtp.FundingFeePaidCollaterals.Add(takeAmountCollateral) // add payment to total funding fee paid in custody asset - mtp.FundingFeePaidCustodies[custodyIndex] = mtp.FundingFeePaidCustodies[custodyIndex].Add(takeAmountCustody) + mtp.FundingFeePaidCustodies = mtp.FundingFeePaidCustodies.Add(takeAmountCustody) // emit event if !takeAmountCollateral.IsZero() { diff --git a/x/margin/keeper/keeper.go b/x/margin/keeper/keeper.go index a0a891955..6b1ea06ed 100644 --- a/x/margin/keeper/keeper.go +++ b/x/margin/keeper/keeper.go @@ -166,14 +166,9 @@ func (k Keeper) Borrow(ctx sdk.Context, collateralAsset string, custodyAsset str liabilitiesDec = sdk.NewDecFromInt(liabilityAmt) } - collateralIndex, custodyIndex := types.GetMTPAssetIndex(mtp, collateralAsset, custodyAsset) - if collateralIndex < 0 || custodyIndex < 0 { - return sdkerrors.Wrap(types.ErrBalanceNotAvailable, "MTP collateral or custody invalid!") - } - - mtp.Collaterals[collateralIndex].Amount = mtp.Collaterals[collateralIndex].Amount.Add(collateralAmount) + mtp.Collaterals = mtp.Collaterals.Add(sdk.NewCoin(collateralAsset, collateralAmount)) mtp.Liabilities = mtp.Liabilities.Add(sdk.NewIntFromBigInt(liabilitiesDec.TruncateInt().BigInt())) - mtp.Custodies[custodyIndex].Amount = mtp.Custodies[custodyIndex].Amount.Add(custodyAmount) + mtp.Custodies = mtp.Custodies.Add(sdk.NewCoin(custodyAsset, custodyAmount)) // calculate mtp take profit custody, delta y_tp_c = delta x_l / take profit price (take profit custody = liabilities / take profit price) mtp.TakeProfitCustodies = types.CalcMTPTakeProfitCustodies(mtp) @@ -186,9 +181,6 @@ func (k Keeper) Borrow(ctx sdk.Context, collateralAsset string, custodyAsset str mtp.Leverages = append(mtp.Leverages, eta.Add(sdk.OneDec())) - // print mtp.CustodyAmount - ctx.Logger().Info(fmt.Sprintf("mtp.CustodyAmount: %s", mtp.Custodies[custodyIndex].Amount.String())) - h, err := k.UpdateMTPHealth(ctx, *mtp, *ammPool, baseCurrency) // set mtp in func or return h? if err != nil { return err @@ -225,7 +217,7 @@ func (k Keeper) Borrow(ctx sdk.Context, collateralAsset string, custodyAsset str } // All take profit custody has to be in base currency - err = pool.UpdateTakeProfitCustody(ctx, baseCurrency, mtp.TakeProfitCustodies[custodyIndex].Amount, true, mtp.Position) + err = pool.UpdateTakeProfitCustody(ctx, baseCurrency, mtp.TakeProfitCustodies.AmountOf(custodyAsset), true, mtp.Position) if err != nil { return err } @@ -296,15 +288,13 @@ func (k Keeper) TakeInCustody(ctx sdk.Context, mtp types.MTP, pool *types.Pool) } func (k Keeper) IncrementalBorrowInterestPayment(ctx sdk.Context, collateralAsset string, custodyAsset string, borrowInterestPayment sdk.Int, mtp *types.MTP, pool *types.Pool, ammPool ammtypes.Pool, baseCurrency string) (sdk.Int, error) { - collateralIndex, custodyIndex := types.GetMTPAssetIndex(mtp, collateralAsset, custodyAsset) - // if mtp has unpaid borrow interest, add to payment // convert it into base currency - if mtp.BorrowInterestUnpaidCollaterals[collateralIndex].Amount.GT(sdk.ZeroInt()) { - if mtp.Collaterals[collateralIndex].Denom == baseCurrency { - borrowInterestPayment = borrowInterestPayment.Add(mtp.BorrowInterestUnpaidCollaterals[collateralIndex].Amount) + if mtp.BorrowInterestUnpaidCollaterals.AmountOf(collateralAsset).IsPositive() { + if collateralAsset == baseCurrency { + borrowInterestPayment = borrowInterestPayment.Add(mtp.BorrowInterestUnpaidCollaterals.AmountOf(collateralAsset)) } else { - unpaidCollateralIn := sdk.NewCoin(mtp.Collaterals[collateralIndex].Denom, mtp.BorrowInterestUnpaidCollaterals[collateralIndex].Amount) + unpaidCollateralIn := sdk.NewCoin(collateralAsset, mtp.BorrowInterestUnpaidCollaterals.AmountOf(collateralAsset)) C, err := k.EstimateSwapGivenOut(ctx, unpaidCollateralIn, baseCurrency, ammPool) if err != nil { return sdk.ZeroInt(), err @@ -316,7 +306,7 @@ func (k Keeper) IncrementalBorrowInterestPayment(ctx sdk.Context, collateralAsse borrowInterestPaymentTokenIn := sdk.NewCoin(baseCurrency, borrowInterestPayment) // swap borrow interest payment to custody asset for payment - borrowInterestPaymentCustody, err := k.EstimateSwap(ctx, borrowInterestPaymentTokenIn, mtp.Custodies[custodyIndex].Denom, ammPool) + borrowInterestPaymentCustody, err := k.EstimateSwap(ctx, borrowInterestPaymentTokenIn, custodyAsset, ammPool) if err != nil { return sdk.ZeroInt(), err } @@ -332,49 +322,55 @@ func (k Keeper) IncrementalBorrowInterestPayment(ctx sdk.Context, collateralAsse } // if paying unpaid borrow interest reset to 0 - mtp.BorrowInterestUnpaidCollaterals[collateralIndex].Amount = sdk.ZeroInt() + mtp.BorrowInterestUnpaidCollaterals = mtp.BorrowInterestUnpaidCollaterals.Sub( + sdk.NewCoin(collateralAsset, mtp.BorrowInterestUnpaidCollaterals.AmountOf(collateralAsset)), + ) // edge case, not enough custody to cover payment - if borrowInterestPaymentCustody.GT(mtp.Custodies[custodyIndex].Amount) { + if borrowInterestPaymentCustody.GT(mtp.Custodies.AmountOf(custodyAsset)) { // swap custody amount to collateral for updating borrow interest unpaid - custodyAmtTokenIn := sdk.NewCoin(mtp.Custodies[custodyIndex].Denom, mtp.Custodies[custodyIndex].Amount) + custodyAmtTokenIn := sdk.NewCoin(custodyAsset, mtp.Custodies.AmountOf(custodyAsset)) custodyAmountCollateral, err := k.EstimateSwap(ctx, custodyAmtTokenIn, collateralAsset, ammPool) // may need spot price here to not deduct fee if err != nil { return sdk.ZeroInt(), err } - mtp.BorrowInterestUnpaidCollaterals[collateralIndex].Amount = borrowInterestPayment.Sub(custodyAmountCollateral) + mtp.BorrowInterestUnpaidCollaterals = mtp.BorrowInterestUnpaidCollaterals.Add( + sdk.NewCoin(collateralAsset, borrowInterestPayment), + ).Sub( + sdk.NewCoin(collateralAsset, custodyAmountCollateral), + ) borrowInterestPayment = custodyAmountCollateral - borrowInterestPaymentCustody = mtp.Custodies[custodyIndex].Amount + borrowInterestPaymentCustody = mtp.Custodies.AmountOf(custodyAsset) } // add payment to total paid - collateral - mtp.BorrowInterestPaidCollaterals[collateralIndex].Amount = mtp.BorrowInterestPaidCollaterals[collateralIndex].Amount.Add(borrowInterestPayment) + mtp.BorrowInterestPaidCollaterals = mtp.BorrowInterestPaidCollaterals.Add(sdk.NewCoin(collateralAsset, borrowInterestPayment)) // add payment to total paid - custody - mtp.BorrowInterestPaidCustodies[custodyIndex].Amount = mtp.BorrowInterestPaidCustodies[custodyIndex].Amount.Add(borrowInterestPaymentCustody) + mtp.BorrowInterestPaidCustodies = mtp.BorrowInterestPaidCustodies.Add(sdk.NewCoin(custodyAsset, borrowInterestPaymentCustody)) // deduct borrow interest payment from custody amount - mtp.Custodies[custodyIndex].Amount = mtp.Custodies[custodyIndex].Amount.Sub(borrowInterestPaymentCustody) + mtp.Custodies = mtp.Custodies.Sub(sdk.NewCoin(custodyAsset, borrowInterestPaymentCustody)) takePercentage := k.GetIncrementalBorrowInterestPaymentFundPercentage(ctx) fundAddr := k.GetIncrementalBorrowInterestPaymentFundAddress(ctx) - takeAmount, err := k.TakeFundPayment(ctx, borrowInterestPaymentCustody, mtp.Custodies[custodyIndex].Denom, takePercentage, fundAddr, &ammPool) + takeAmount, err := k.TakeFundPayment(ctx, borrowInterestPaymentCustody, custodyAsset, takePercentage, fundAddr, &ammPool) if err != nil { return sdk.ZeroInt(), err } actualBorrowInterestPaymentCustody := borrowInterestPaymentCustody.Sub(takeAmount) if !takeAmount.IsZero() { - k.EmitFundPayment(ctx, mtp, takeAmount, mtp.Custodies[custodyIndex].Denom, types.EventIncrementalPayFund) + k.EmitFundPayment(ctx, mtp, takeAmount, custodyAsset, types.EventIncrementalPayFund) } - err = pool.UpdateCustody(ctx, mtp.Custodies[custodyIndex].Denom, borrowInterestPaymentCustody, false, mtp.Position) + err = pool.UpdateCustody(ctx, custodyAsset, borrowInterestPaymentCustody, false, mtp.Position) if err != nil { return sdk.ZeroInt(), err } - err = pool.UpdateBalance(ctx, mtp.Custodies[custodyIndex].Denom, actualBorrowInterestPaymentCustody, true, mtp.Position) + err = pool.UpdateBalance(ctx, custodyAsset, actualBorrowInterestPaymentCustody, true, mtp.Position) if err != nil { return sdk.ZeroInt(), err } diff --git a/x/margin/keeper/repay.go b/x/margin/keeper/repay.go index 86ecaaf46..968c47b5c 100644 --- a/x/margin/keeper/repay.go +++ b/x/margin/keeper/repay.go @@ -10,11 +10,13 @@ import ( ) func (k Keeper) Repay(ctx sdk.Context, mtp *types.MTP, pool *types.Pool, ammPool ammtypes.Pool, repayAmount sdk.Int, takeFundPayment bool, collateralAsset string) error { - collateralIndex, _ := types.GetMTPAssetIndex(mtp, collateralAsset, "") // nolint:staticcheck,ineffassign returnAmount := sdk.ZeroInt() Liabilities := mtp.Liabilities - BorrowInterestUnpaidCollateral := mtp.BorrowInterestUnpaidCollaterals[collateralIndex] + ok, BorrowInterestUnpaidCollateral := mtp.BorrowInterestUnpaidCollaterals.Find(collateralAsset) + if !ok { + return types.ErrDenomNotFound + } entry, found := k.apKeeper.GetEntry(ctx, ptypes.BaseCurrency) if !found { @@ -24,7 +26,7 @@ func (k Keeper) Repay(ctx sdk.Context, mtp *types.MTP, pool *types.Pool, ammPool if collateralAsset != baseCurrency { // swap to base currency - unpaidCollateralIn := sdk.NewCoin(mtp.Collaterals[collateralIndex].Denom, mtp.BorrowInterestUnpaidCollaterals[collateralIndex].Amount) + unpaidCollateralIn := sdk.NewCoin(collateralAsset, mtp.BorrowInterestUnpaidCollaterals.AmountOf(collateralAsset)) C, err := k.EstimateSwapGivenOut(ctx, unpaidCollateralIn, baseCurrency, ammPool) if err != nil { return err @@ -115,7 +117,7 @@ func (k Keeper) Repay(ctx sdk.Context, mtp *types.MTP, pool *types.Pool, ammPool returnAmount = C } - err = pool.UpdateBalance(ctx, mtp.Collaterals[collateralIndex].Denom, returnAmount, false, mtp.Position) + err = pool.UpdateBalance(ctx, collateralAsset, returnAmount, false, mtp.Position) if err != nil { return err } @@ -131,7 +133,7 @@ func (k Keeper) Repay(ctx sdk.Context, mtp *types.MTP, pool *types.Pool, ammPool return err } - err = pool.UpdateTakeProfitCustody(ctx, baseCurrency, mtp.TakeProfitCustodies[collateralIndex].Amount, false, mtp.Position) + err = pool.UpdateTakeProfitCustody(ctx, baseCurrency, mtp.TakeProfitCustodies.AmountOf(collateralAsset), false, mtp.Position) if err != nil { return err } diff --git a/x/margin/keeper/take_out_custody.go b/x/margin/keeper/take_out_custody.go index 29da42f97..a7fb69c07 100644 --- a/x/margin/keeper/take_out_custody.go +++ b/x/margin/keeper/take_out_custody.go @@ -6,13 +6,12 @@ import ( ) func (k Keeper) TakeOutCustody(ctx sdk.Context, mtp types.MTP, pool *types.Pool, custodyAsset string) error { - _, custodyIndex := types.GetMTPAssetIndex(&mtp, "", custodyAsset) - err := pool.UpdateBalance(ctx, mtp.Custodies[custodyIndex].Denom, mtp.Custodies[custodyIndex].Amount, true, mtp.Position) + err := pool.UpdateBalance(ctx, custodyAsset, mtp.Custodies.AmountOf(custodyAsset), true, mtp.Position) if err != nil { return err } - err = pool.UpdateCustody(ctx, mtp.Custodies[custodyIndex].Denom, mtp.Custodies[custodyIndex].Amount, false, mtp.Position) + err = pool.UpdateCustody(ctx, custodyAsset, mtp.Custodies.AmountOf(custodyAsset), false, mtp.Position) if err != nil { return err } diff --git a/x/margin/types/errors.go b/x/margin/types/errors.go index 366c2cc49..a15a40d15 100644 --- a/x/margin/types/errors.go +++ b/x/margin/types/errors.go @@ -26,4 +26,5 @@ var ( ErrBalanceNotAvailable = sdkerrors.Register(ModuleName, 18, "user does not have enough balance of the required coin") ErrAmountTooLow = sdkerrors.Register(ModuleName, 32, "Tx amount is too low") ErrMarginDisabled = sdkerrors.Register(ModuleName, 33, "margin disabled pool") + ErrDenomNotFound = sdkerrors.Register(ModuleName, 34, "denom not found") ) diff --git a/x/margin/types/get_mtp_asset_index.go b/x/margin/types/get_mtp_asset_index.go deleted file mode 100644 index 2c65de212..000000000 --- a/x/margin/types/get_mtp_asset_index.go +++ /dev/null @@ -1,22 +0,0 @@ -package types - -// Get Assets Index -func GetMTPAssetIndex(mtp *MTP, collateralAsset string, borrowAsset string) (int, int) { - collateralIndex := -1 - borrowIndex := -1 - for i, asset := range mtp.Collaterals { - if asset.Denom == collateralAsset { - collateralIndex = i - break - } - } - - for i, asset := range mtp.Custodies { - if asset.Denom == borrowAsset { - borrowIndex = i - break - } - } - - return collateralIndex, borrowIndex -} diff --git a/x/margin/types/types.pb.go b/x/margin/types/types.pb.go index 3e3404b11..671c4f057 100644 --- a/x/margin/types/types.pb.go +++ b/x/margin/types/types.pb.go @@ -55,14 +55,14 @@ func (Position) EnumDescriptor() ([]byte, []int) { type MTP struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Collaterals []types.Coin `protobuf:"bytes,2,rep,name=collaterals,proto3" json:"collaterals"` + Collaterals github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=collaterals,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"collaterals"` Liabilities github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=liabilities,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"liabilities"` - BorrowInterestPaidCollaterals []types.Coin `protobuf:"bytes,4,rep,name=borrow_interest_paid_collaterals,json=borrowInterestPaidCollaterals,proto3" json:"borrow_interest_paid_collaterals"` - BorrowInterestPaidCustodies []types.Coin `protobuf:"bytes,5,rep,name=borrow_interest_paid_custodies,json=borrowInterestPaidCustodies,proto3" json:"borrow_interest_paid_custodies"` - BorrowInterestUnpaidCollaterals []types.Coin `protobuf:"bytes,6,rep,name=borrow_interest_unpaid_collaterals,json=borrowInterestUnpaidCollaterals,proto3" json:"borrow_interest_unpaid_collaterals"` - Custodies []types.Coin `protobuf:"bytes,7,rep,name=custodies,proto3" json:"custodies"` + BorrowInterestPaidCollaterals github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=borrow_interest_paid_collaterals,json=borrowInterestPaidCollaterals,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"borrow_interest_paid_collaterals"` + BorrowInterestPaidCustodies github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,5,rep,name=borrow_interest_paid_custodies,json=borrowInterestPaidCustodies,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"borrow_interest_paid_custodies"` + BorrowInterestUnpaidCollaterals github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=borrow_interest_unpaid_collaterals,json=borrowInterestUnpaidCollaterals,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"borrow_interest_unpaid_collaterals"` + Custodies github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,7,rep,name=custodies,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"custodies"` TakeProfitLiabilities github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,8,opt,name=take_profit_liabilities,json=takeProfitLiabilities,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"take_profit_liabilities"` - TakeProfitCustodies []types.Coin `protobuf:"bytes,9,rep,name=take_profit_custodies,json=takeProfitCustodies,proto3" json:"take_profit_custodies"` + TakeProfitCustodies github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,9,rep,name=take_profit_custodies,json=takeProfitCustodies,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"take_profit_custodies"` Leverages []github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,10,rep,name=leverages,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"leverages"` MtpHealth github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,11,opt,name=mtp_health,json=mtpHealth,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"mtp_health"` Position Position `protobuf:"varint,12,opt,name=position,proto3,enum=elys.margin.Position" json:"position,omitempty"` @@ -73,11 +73,11 @@ type MTP struct { TakeProfitPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,17,opt,name=take_profit_price,json=takeProfitPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"take_profit_price"` TakeProfitBorrowRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,18,opt,name=take_profit_borrow_rate,json=takeProfitBorrowRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"take_profit_borrow_rate"` // funding fee paid - FundingFeePaidCollaterals []types.Coin `protobuf:"bytes,19,rep,name=funding_fee_paid_collaterals,json=fundingFeePaidCollaterals,proto3" json:"funding_fee_paid_collaterals"` - FundingFeePaidCustodies []types.Coin `protobuf:"bytes,20,rep,name=funding_fee_paid_custodies,json=fundingFeePaidCustodies,proto3" json:"funding_fee_paid_custodies"` + FundingFeePaidCollaterals github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,19,rep,name=funding_fee_paid_collaterals,json=fundingFeePaidCollaterals,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funding_fee_paid_collaterals"` + FundingFeePaidCustodies github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,20,rep,name=funding_fee_paid_custodies,json=fundingFeePaidCustodies,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funding_fee_paid_custodies"` // funding fee received - FundingFeeReceivedCollaterals []types.Coin `protobuf:"bytes,21,rep,name=funding_fee_received_collaterals,json=fundingFeeReceivedCollaterals,proto3" json:"funding_fee_received_collaterals"` - FundingFeeReceivedCustodies []types.Coin `protobuf:"bytes,22,rep,name=funding_fee_received_custodies,json=fundingFeeReceivedCustodies,proto3" json:"funding_fee_received_custodies"` + FundingFeeReceivedCollaterals github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,21,rep,name=funding_fee_received_collaterals,json=fundingFeeReceivedCollaterals,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funding_fee_received_collaterals"` + FundingFeeReceivedCustodies github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,22,rep,name=funding_fee_received_custodies,json=fundingFeeReceivedCustodies,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funding_fee_received_custodies"` } func (m *MTP) Reset() { *m = MTP{} } @@ -120,42 +120,42 @@ func (m *MTP) GetAddress() string { return "" } -func (m *MTP) GetCollaterals() []types.Coin { +func (m *MTP) GetCollaterals() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.Collaterals } return nil } -func (m *MTP) GetBorrowInterestPaidCollaterals() []types.Coin { +func (m *MTP) GetBorrowInterestPaidCollaterals() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.BorrowInterestPaidCollaterals } return nil } -func (m *MTP) GetBorrowInterestPaidCustodies() []types.Coin { +func (m *MTP) GetBorrowInterestPaidCustodies() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.BorrowInterestPaidCustodies } return nil } -func (m *MTP) GetBorrowInterestUnpaidCollaterals() []types.Coin { +func (m *MTP) GetBorrowInterestUnpaidCollaterals() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.BorrowInterestUnpaidCollaterals } return nil } -func (m *MTP) GetCustodies() []types.Coin { +func (m *MTP) GetCustodies() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.Custodies } return nil } -func (m *MTP) GetTakeProfitCustodies() []types.Coin { +func (m *MTP) GetTakeProfitCustodies() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.TakeProfitCustodies } @@ -183,28 +183,28 @@ func (m *MTP) GetAmmPoolId() uint64 { return 0 } -func (m *MTP) GetFundingFeePaidCollaterals() []types.Coin { +func (m *MTP) GetFundingFeePaidCollaterals() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.FundingFeePaidCollaterals } return nil } -func (m *MTP) GetFundingFeePaidCustodies() []types.Coin { +func (m *MTP) GetFundingFeePaidCustodies() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.FundingFeePaidCustodies } return nil } -func (m *MTP) GetFundingFeeReceivedCollaterals() []types.Coin { +func (m *MTP) GetFundingFeeReceivedCollaterals() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.FundingFeeReceivedCollaterals } return nil } -func (m *MTP) GetFundingFeeReceivedCustodies() []types.Coin { +func (m *MTP) GetFundingFeeReceivedCustodies() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.FundingFeeReceivedCustodies } @@ -264,54 +264,56 @@ func init() { func init() { proto.RegisterFile("elys/margin/types.proto", fileDescriptor_cd1c09c977f732f9) } var fileDescriptor_cd1c09c977f732f9 = []byte{ - // 753 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x95, 0x5f, 0x4f, 0xda, 0x50, - 0x18, 0xc6, 0x29, 0xa0, 0xc2, 0x61, 0x20, 0x1e, 0x61, 0x56, 0xb7, 0x55, 0x62, 0xb2, 0x85, 0x6c, - 0xb1, 0x9d, 0xee, 0x7a, 0x17, 0xc3, 0x3f, 0x93, 0x04, 0xb5, 0xa9, 0x9a, 0x25, 0x66, 0x49, 0x77, - 0x68, 0x0f, 0x70, 0x62, 0xdb, 0xd3, 0xf4, 0x1c, 0x70, 0x7e, 0x8b, 0x7d, 0x2c, 0x2f, 0xbd, 0x5c, - 0x76, 0x61, 0x16, 0xfd, 0x18, 0xbb, 0x59, 0x5a, 0x0a, 0x2d, 0xc8, 0x45, 0xe5, 0x0a, 0xda, 0x73, - 0xfa, 0x7b, 0x9e, 0xb7, 0xe7, 0x79, 0xdf, 0x82, 0x35, 0x6c, 0xdd, 0x30, 0xc5, 0x46, 0x5e, 0x97, - 0x38, 0x0a, 0xbf, 0x71, 0x31, 0x93, 0x5d, 0x8f, 0x72, 0x0a, 0x0b, 0xfe, 0x82, 0x3c, 0x5c, 0xd8, - 0xa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 0x9a, 0xa1, 0x33, 0x62, 0x40, 0x0b, 0x6c, 0x4d, 0xab, - 0xf4, 0x9d, 0x27, 0x15, 0x2d, 0x26, 0x53, 0xda, 0x9c, 0x54, 0xba, 0x08, 0x40, 0xf1, 0x9a, 0x3e, - 0x83, 0x7c, 0x64, 0x7f, 0x29, 0x19, 0x34, 0x7a, 0x02, 0x76, 0xc0, 0x1a, 0x47, 0x57, 0x58, 0x77, - 0x3d, 0xda, 0x21, 0x5c, 0x8f, 0x1f, 0x6d, 0x6e, 0xae, 0xa3, 0xad, 0xfa, 0x38, 0x35, 0xa0, 0xb5, - 0x62, 0x87, 0x7c, 0x06, 0xaa, 0x71, 0x9d, 0xc8, 0x72, 0x3e, 0x99, 0xe5, 0xd5, 0x08, 0x1b, 0xbd, - 0xe9, 0x16, 0xc8, 0x5b, 0x78, 0x80, 0x3d, 0xd4, 0xc5, 0x4c, 0x04, 0xb5, 0xcc, 0x33, 0xed, 0xee, - 0x63, 0x43, 0x8b, 0x00, 0xf0, 0x18, 0x00, 0x9b, 0xbb, 0x7a, 0x0f, 0x23, 0x8b, 0xf7, 0xc4, 0xc2, - 0xb3, 0xab, 0x0f, 0x70, 0x36, 0x77, 0x8f, 0x02, 0x00, 0xdc, 0x01, 0x39, 0x97, 0x32, 0xc2, 0x09, - 0x75, 0xc4, 0x17, 0x35, 0xa1, 0x5e, 0xda, 0xad, 0xca, 0xb1, 0x1e, 0x97, 0xd5, 0x70, 0x51, 0x1b, - 0x6f, 0x83, 0x25, 0x90, 0x26, 0xa6, 0x58, 0xac, 0x09, 0xf5, 0xac, 0x96, 0x26, 0x26, 0x94, 0x40, - 0x01, 0xd9, 0xb6, 0xee, 0x52, 0x6a, 0xe9, 0xc4, 0x14, 0x4b, 0xc1, 0x42, 0x1e, 0xd9, 0xb6, 0x4a, - 0xa9, 0xd5, 0x34, 0x21, 0x02, 0x15, 0x83, 0x3a, 0x8c, 0x5a, 0xc4, 0x44, 0x1c, 0xeb, 0xa3, 0x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e, 0x4e, 0xce, 0xd4, 0x83, 0xbd, 0xe6, 0x61, 0xf3, 0x60, 0xbf, 0x9c, - 0x82, 0x39, 0x90, 0x6d, 0x9d, 0x9e, 0x7c, 0x2d, 0x0b, 0x30, 0x0f, 0x16, 0xce, 0x8e, 0x4e, 0xb5, - 0xf3, 0x72, 0xba, 0x71, 0x70, 0xfb, 0x20, 0x09, 0x77, 0x0f, 0x92, 0xf0, 0xf7, 0x41, 0x12, 0x7e, - 0x3d, 0x4a, 0xa9, 0xbb, 0x47, 0x29, 0xf5, 0xfb, 0x51, 0x4a, 0x5d, 0x7e, 0x88, 0xa5, 0xc9, 0xef, - 0xf3, 0x6d, 0x07, 0xf3, 0x6b, 0xea, 0x5d, 0x05, 0x17, 0xca, 0xcf, 0x89, 0x6f, 0x7e, 0x7b, 0x31, - 0xf8, 0x62, 0x7f, 0xfa, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x17, 0xea, 0x43, 0xef, 0x0f, 0x08, 0x00, + // 785 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0xcd, 0x4e, 0xdb, 0x4a, + 0x14, 0xc7, 0xe3, 0x84, 0x8f, 0x64, 0x72, 0x09, 0x61, 0x48, 0x2e, 0x86, 0x7b, 0xeb, 0x44, 0x48, + 0xad, 0xa2, 0x56, 0xd8, 0x40, 0xdf, 0x20, 0x7c, 0x94, 0x48, 0x01, 0x2c, 0x03, 0xaa, 0xc4, 0xc6, + 0x9a, 0xd8, 0x93, 0x64, 0x84, 0xed, 0xb1, 0x3c, 0x93, 0x50, 0x56, 0xdd, 0x76, 0xd1, 0x05, 0x8b, + 0x2e, 0xfa, 0x0c, 0x7d, 0x84, 0x3e, 0x01, 0x4b, 0x96, 0x55, 0x17, 0xb4, 0x82, 0x17, 0xa9, 0xec, + 0x38, 0xb1, 0x13, 0xb2, 0x28, 0x51, 0x58, 0x25, 0xf6, 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 0x61, 0x50, 0x1b, 0x3c, 0x06, 0x73, 0x20, 0x49, 0x4c, 0x71, + 0xa1, 0x2c, 0x54, 0x66, 0xb4, 0x24, 0x31, 0xa1, 0x04, 0xb2, 0xc8, 0xb6, 0x75, 0x97, 0x52, 0x4b, + 0x27, 0xa6, 0x98, 0x0b, 0x02, 0x19, 0x64, 0xdb, 0x2a, 0xa5, 0x56, 0xcd, 0x84, 0x08, 0x14, 0x0c, + 0xea, 0x30, 0x6a, 0x11, 0x13, 0x71, 0xac, 0xf7, 0xad, 0x88, 0x8b, 0x13, 0xb1, 0x2f, 0xc7, 0xb4, + 0xea, 0xa1, 0x14, 0x3c, 0x03, 0x39, 0xd6, 0xb1, 0x63, 0xd3, 0x23, 0xe6, 0x27, 0x6a, 0xa1, 0x05, + 0xd6, 0xb1, 0xa3, 0x71, 0x80, 0xe7, 0x60, 0x29, 0xde, 0x3a, 0xae, 0x47, 0x0c, 0x2c, 0x2e, 0x4d, + 0x84, 0xbd, 0x18, 0x75, 0x86, 0xea, 0xcb, 0x40, 0x3c, 0xdc, 0xfe, 0xe1, 0x3e, 0xf0, 0x10, 0xc7, + 0x22, 0x9c, 0x28, 0x43, 0x21, 0xca, 0x50, 0x0d, 0xc4, 0x34, 0xc4, 0x31, 0xfc, 0x2c, 0x80, 0xff, + 0x9b, 0x1d, 0xc7, 0x24, 0x4e, 0x4b, 0x6f, 0x62, 0xfc, 0x78, 0x23, 0x2f, 0x4f, 0x7f, 0x0a, 0x56, + 0xc3, 0x84, 0xfb, 0x18, 0x8f, 0x6e, 0xe3, 0x4f, 0x02, 0x58, 0x7b, 0x8c, 0x33, 0x18, 0xc9, 0xc2, + 0xf4, 0x61, 0x56, 0x46, 0x60, 0x06, 0x63, 0xe9, 0x9f, 0x57, 0x71, 0x14, 0x0f, 0x1b, 0x98, 0x74, + 0xf1, 0x70, 0x75, 0x8a, 0xcf, 0x70, 0x5e, 0x45, 0x40, 0x5a, 0x98, 0x72, 0xf4, 0xbc, 0x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