mirror of
				https://github.com/0glabs/0g-chain.git
				synced 2025-10-31 14:47:29 +00:00 
			
		
		
		
	[R4R] Add liquidation pricefeed (#524)
* add parameter for liquidation pricefeed
This commit is contained in:
		
							parent
							
								
									99537efd24
								
							
						
					
					
						commit
						ade6edb918
					
				| @ -18,7 +18,12 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k Keeper) { | ||||
| 
 | ||||
| 	for _, cp := range params.CollateralParams { | ||||
| 
 | ||||
| 		ok := k.UpdatePricefeedStatus(ctx, cp.MarketID) | ||||
| 		ok := k.UpdatePricefeedStatus(ctx, cp.SpotMarketID) | ||||
| 		if !ok { | ||||
| 			continue | ||||
| 		} | ||||
| 
 | ||||
| 		ok = k.UpdatePricefeedStatus(ctx, cp.LiquidationMarketID) | ||||
| 		if !ok { | ||||
| 			continue | ||||
| 		} | ||||
| @ -28,8 +33,7 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k Keeper) { | ||||
| 		if err != nil { | ||||
| 			panic(err) | ||||
| 		} | ||||
| 
 | ||||
| 		err = k.LiquidateCdps(ctx, cp.MarketID, cp.Denom, cp.LiquidationRatio) | ||||
| 		err = k.LiquidateCdps(ctx, cp.LiquidationMarketID, cp.Denom, cp.LiquidationRatio) | ||||
| 		if err != nil { | ||||
| 			panic(err) | ||||
| 		} | ||||
|  | ||||
| @ -38,13 +38,21 @@ func InitGenesis(ctx sdk.Context, k Keeper, pk types.PricefeedKeeper, sk types.S | ||||
| 	} | ||||
| 
 | ||||
| 	for _, col := range gs.Params.CollateralParams { | ||||
| 		_, found := collateralMap[col.MarketID] | ||||
| 		_, found := collateralMap[col.SpotMarketID] | ||||
| 		if !found { | ||||
| 			panic(fmt.Sprintf("%s collateral not found in pricefeed", col.Denom)) | ||||
| 		} | ||||
| 		// sets the status of the pricefeed in the store
 | ||||
| 		// if pricefeed not active, debt operations are paused
 | ||||
| 		_ = k.UpdatePricefeedStatus(ctx, col.MarketID) | ||||
| 		_ = k.UpdatePricefeedStatus(ctx, col.SpotMarketID) | ||||
| 
 | ||||
| 		_, found = collateralMap[col.LiquidationMarketID] | ||||
| 		if !found { | ||||
| 			panic(fmt.Sprintf("%s collateral not found in pricefeed", col.Denom)) | ||||
| 		} | ||||
| 		// sets the status of the pricefeed in the store
 | ||||
| 		// if pricefeed not active, debt operations are paused
 | ||||
| 		_ = k.UpdatePricefeedStatus(ctx, col.LiquidationMarketID) | ||||
| 	} | ||||
| 
 | ||||
| 	k.SetParams(ctx, gs.Params) | ||||
|  | ||||
| @ -54,7 +54,8 @@ func NewCDPGenState(asset string, liquidationRatio sdk.Dec) app.GenesisState { | ||||
| 					AuctionSize:         i(1000000000), | ||||
| 					Prefix:              0x20, | ||||
| 					ConversionFactor:    i(6), | ||||
| 					MarketID:           asset + ":usd", | ||||
| 					SpotMarketID:        asset + ":usd", | ||||
| 					LiquidationMarketID: asset + ":usd", | ||||
| 				}, | ||||
| 			}, | ||||
| 			DebtParam: cdp.DebtParam{ | ||||
| @ -115,7 +116,8 @@ func NewCDPGenStateMulti() app.GenesisState { | ||||
| 					LiquidationPenalty:  d("0.05"), | ||||
| 					AuctionSize:         i(7000000000), | ||||
| 					Prefix:              0x20, | ||||
| 					MarketID:           "xrp:usd", | ||||
| 					SpotMarketID:        "xrp:usd", | ||||
| 					LiquidationMarketID: "xrp:usd", | ||||
| 					ConversionFactor:    i(6), | ||||
| 				}, | ||||
| 				{ | ||||
| @ -126,7 +128,8 @@ func NewCDPGenStateMulti() app.GenesisState { | ||||
| 					LiquidationPenalty:  d("0.025"), | ||||
| 					AuctionSize:         i(10000000), | ||||
| 					Prefix:              0x21, | ||||
| 					MarketID:           "btc:usd", | ||||
| 					SpotMarketID:        "btc:usd", | ||||
| 					LiquidationMarketID: "btc:usd", | ||||
| 					ConversionFactor:    i(8), | ||||
| 				}, | ||||
| 			}, | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| package keeper | ||||
| 
 | ||||
| import ( | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"sort" | ||||
| 
 | ||||
| @ -352,7 +353,11 @@ func (k Keeper) ValidateCollateral(ctx sdk.Context, collateral sdk.Coin) error { | ||||
| 	if !found { | ||||
| 		return sdkerrors.Wrap(types.ErrCollateralNotSupported, collateral.Denom) | ||||
| 	} | ||||
| 	ok := k.GetMarketStatus(ctx, cp.MarketID) | ||||
| 	ok := k.GetMarketStatus(ctx, cp.SpotMarketID) | ||||
| 	if !ok { | ||||
| 		return sdkerrors.Wrap(types.ErrPricefeedDown, collateral.Denom) | ||||
| 	} | ||||
| 	ok = k.GetMarketStatus(ctx, cp.LiquidationMarketID) | ||||
| 	if !ok { | ||||
| 		return sdkerrors.Wrap(types.ErrPricefeedDown, collateral.Denom) | ||||
| 	} | ||||
| @ -404,7 +409,7 @@ func (k Keeper) ValidateDebtLimit(ctx sdk.Context, collateralDenom string, princ | ||||
| // ValidateCollateralizationRatio validate that adding the input principal doesn't put the cdp below the liquidation ratio
 | ||||
| func (k Keeper) ValidateCollateralizationRatio(ctx sdk.Context, collateral sdk.Coin, principal sdk.Coin, fees sdk.Coin) error { | ||||
| 	//
 | ||||
| 	collateralizationRatio, err := k.CalculateCollateralizationRatio(ctx, collateral, principal, fees) | ||||
| 	collateralizationRatio, err := k.CalculateCollateralizationRatio(ctx, collateral, principal, fees, spot) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| @ -430,7 +435,7 @@ func (k Keeper) CalculateCollateralToDebtRatio(ctx sdk.Context, collateral sdk.C | ||||
| // LoadAugmentedCDP creates a new augmented CDP from an existing CDP
 | ||||
| func (k Keeper) LoadAugmentedCDP(ctx sdk.Context, cdp types.CDP) types.AugmentedCDP { | ||||
| 	// calculate collateralization ratio
 | ||||
| 	collateralizationRatio, err := k.CalculateCollateralizationRatio(ctx, cdp.Collateral, cdp.Principal, cdp.AccumulatedFees) | ||||
| 	collateralizationRatio, err := k.CalculateCollateralizationRatio(ctx, cdp.Collateral, cdp.Principal, cdp.AccumulatedFees, liquidation) | ||||
| 	if err != nil { | ||||
| 		return types.AugmentedCDP{CDP: cdp} | ||||
| 	} | ||||
| @ -451,11 +456,20 @@ func (k Keeper) LoadAugmentedCDP(ctx sdk.Context, cdp types.CDP) types.Augmented | ||||
| } | ||||
| 
 | ||||
| // CalculateCollateralizationRatio returns the collateralization ratio of the input collateral to the input debt plus fees
 | ||||
| func (k Keeper) CalculateCollateralizationRatio(ctx sdk.Context, collateral sdk.Coin, principal sdk.Coin, fees sdk.Coin) (sdk.Dec, error) { | ||||
| func (k Keeper) CalculateCollateralizationRatio(ctx sdk.Context, collateral sdk.Coin, principal sdk.Coin, fees sdk.Coin, pfType pricefeedType) (sdk.Dec, error) { | ||||
| 	if collateral.IsZero() { | ||||
| 		return sdk.ZeroDec(), nil | ||||
| 	} | ||||
| 	marketID := k.getMarketID(ctx, collateral.Denom) | ||||
| 	var marketID string | ||||
| 	switch pfType { | ||||
| 	case spot: | ||||
| 		marketID = k.getSpotMarketID(ctx, collateral.Denom) | ||||
| 	case liquidation: | ||||
| 		marketID = k.getliquidationMarketID(ctx, collateral.Denom) | ||||
| 	default: | ||||
| 		return sdk.Dec{}, pfType.IsValid() | ||||
| 	} | ||||
| 
 | ||||
| 	price, err := k.pricefeedKeeper.GetCurrentPrice(ctx, marketID) | ||||
| 	if err != nil { | ||||
| 		return sdk.Dec{}, err | ||||
| @ -473,9 +487,18 @@ func (k Keeper) CalculateCollateralizationRatio(ctx sdk.Context, collateral sdk. | ||||
| } | ||||
| 
 | ||||
| // CalculateCollateralizationRatioFromAbsoluteRatio takes a coin's denom and an absolute ratio and returns the respective collateralization ratio
 | ||||
| func (k Keeper) CalculateCollateralizationRatioFromAbsoluteRatio(ctx sdk.Context, collateralDenom string, absoluteRatio sdk.Dec) (sdk.Dec, error) { | ||||
| 	// get price collateral
 | ||||
| 	marketID := k.getMarketID(ctx, collateralDenom) | ||||
| func (k Keeper) CalculateCollateralizationRatioFromAbsoluteRatio(ctx sdk.Context, collateralDenom string, absoluteRatio sdk.Dec, pfType pricefeedType) (sdk.Dec, error) { | ||||
| 	// get price of collateral
 | ||||
| 	var marketID string | ||||
| 	switch pfType { | ||||
| 	case spot: | ||||
| 		marketID = k.getSpotMarketID(ctx, collateralDenom) | ||||
| 	case liquidation: | ||||
| 		marketID = k.getliquidationMarketID(ctx, collateralDenom) | ||||
| 	default: | ||||
| 		return sdk.Dec{}, pfType.IsValid() | ||||
| 	} | ||||
| 
 | ||||
| 	price, err := k.pricefeedKeeper.GetCurrentPrice(ctx, marketID) | ||||
| 	if err != nil { | ||||
| 		return sdk.Dec{}, err | ||||
| @ -522,3 +545,18 @@ func (k Keeper) convertDebtToBaseUnits(ctx sdk.Context, debt sdk.Coin) (baseUnit | ||||
| 	dp, _ := k.GetDebtParam(ctx, debt.Denom) | ||||
| 	return sdk.NewDecFromInt(debt.Amount).Mul(sdk.NewDecFromIntWithPrec(sdk.OneInt(), dp.ConversionFactor.Int64())) | ||||
| } | ||||
| 
 | ||||
| type pricefeedType string | ||||
| 
 | ||||
| const ( | ||||
| 	spot        pricefeedType = "spot" | ||||
| 	liquidation               = "liquidation" | ||||
| ) | ||||
| 
 | ||||
| func (pft pricefeedType) IsValid() error { | ||||
| 	switch pft { | ||||
| 	case spot, liquidation: | ||||
| 		return nil | ||||
| 	} | ||||
| 	return errors.New(fmt.Sprintf("invalid pricefeed type: %s", pft)) | ||||
| } | ||||
|  | ||||
| @ -285,11 +285,11 @@ func (suite *CdpTestSuite) TestCalculateCollateralizationRatio() { | ||||
| 	suite.keeper.IndexCdpByOwner(suite.ctx, c) | ||||
| 	cr := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, c.Collateral, c.Principal) | ||||
| 	suite.keeper.IndexCdpByCollateralRatio(suite.ctx, c.Collateral.Denom, c.ID, cr) | ||||
| 	cr, err = suite.keeper.CalculateCollateralizationRatio(suite.ctx, c.Collateral, c.Principal, c.AccumulatedFees) | ||||
| 	cr, err = suite.keeper.CalculateCollateralizationRatio(suite.ctx, c.Collateral, c.Principal, c.AccumulatedFees, "spot") | ||||
| 	suite.NoError(err) | ||||
| 	suite.Equal(d("2.5"), cr) | ||||
| 	c.AccumulatedFees = sdk.NewCoin("usdx", i(10000000)) | ||||
| 	cr, err = suite.keeper.CalculateCollateralizationRatio(suite.ctx, c.Collateral, c.Principal, c.AccumulatedFees) | ||||
| 	cr, err = suite.keeper.CalculateCollateralizationRatio(suite.ctx, c.Collateral, c.Principal, c.AccumulatedFees, "spot") | ||||
| 	suite.NoError(err) | ||||
| 	suite.Equal(d("1.25"), cr) | ||||
| } | ||||
|  | ||||
| @ -72,7 +72,7 @@ func (k Keeper) WithdrawCollateral(ctx sdk.Context, owner, depositor sdk.AccAddr | ||||
| 		return sdkerrors.Wrapf(types.ErrInvalidWithdrawAmount, "collateral %s, deposit %s", collateral, deposit.Amount) | ||||
| 	} | ||||
| 
 | ||||
| 	collateralizationRatio, err := k.CalculateCollateralizationRatio(ctx, cdp.Collateral.Sub(collateral), cdp.Principal, cdp.AccumulatedFees) | ||||
| 	collateralizationRatio, err := k.CalculateCollateralizationRatio(ctx, cdp.Collateral.Sub(collateral), cdp.Principal, cdp.AccumulatedFees, spot) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|  | ||||
| @ -54,7 +54,8 @@ func NewCDPGenState(asset string, liquidationRatio sdk.Dec) app.GenesisState { | ||||
| 					AuctionSize:         i(100), | ||||
| 					Prefix:              0x20, | ||||
| 					ConversionFactor:    i(6), | ||||
| 					MarketID:           asset + ":usd", | ||||
| 					SpotMarketID:        asset + ":usd", | ||||
| 					LiquidationMarketID: asset + ":usd", | ||||
| 				}, | ||||
| 			}, | ||||
| 			DebtParam: cdp.DebtParam{ | ||||
| @ -115,7 +116,8 @@ func NewCDPGenStateMulti() app.GenesisState { | ||||
| 					LiquidationPenalty:  d("0.05"), | ||||
| 					AuctionSize:         i(7000000000), | ||||
| 					Prefix:              0x20, | ||||
| 					MarketID:           "xrp:usd", | ||||
| 					SpotMarketID:        "xrp:usd", | ||||
| 					LiquidationMarketID: "xrp:usd", | ||||
| 					ConversionFactor:    i(6), | ||||
| 				}, | ||||
| 				{ | ||||
| @ -126,7 +128,8 @@ func NewCDPGenStateMulti() app.GenesisState { | ||||
| 					LiquidationPenalty:  d("0.025"), | ||||
| 					AuctionSize:         i(10000000), | ||||
| 					Prefix:              0x21, | ||||
| 					MarketID:           "btc:usd", | ||||
| 					SpotMarketID:        "btc:usd", | ||||
| 					LiquidationMarketID: "btc:usd", | ||||
| 					ConversionFactor:    i(8), | ||||
| 				}, | ||||
| 			}, | ||||
| @ -163,7 +166,8 @@ func NewCDPGenStateHighDebtLimit() app.GenesisState { | ||||
| 					LiquidationPenalty:  d("0.05"), | ||||
| 					AuctionSize:         i(7000000000), | ||||
| 					Prefix:              0x20, | ||||
| 					MarketID:           "xrp:usd", | ||||
| 					SpotMarketID:        "xrp:usd", | ||||
| 					LiquidationMarketID: "xrp:usd", | ||||
| 					ConversionFactor:    i(6), | ||||
| 				}, | ||||
| 				{ | ||||
| @ -174,7 +178,8 @@ func NewCDPGenStateHighDebtLimit() app.GenesisState { | ||||
| 					LiquidationPenalty:  d("0.025"), | ||||
| 					AuctionSize:         i(10000000), | ||||
| 					Prefix:              0x21, | ||||
| 					MarketID:           "btc:usd", | ||||
| 					SpotMarketID:        "btc:usd", | ||||
| 					LiquidationMarketID: "btc:usd", | ||||
| 					ConversionFactor:    i(8), | ||||
| 				}, | ||||
| 			}, | ||||
|  | ||||
| @ -62,12 +62,20 @@ func (k Keeper) getDenomFromByte(ctx sdk.Context, db byte) string { | ||||
| 	panic(fmt.Sprintf("no collateral denom with prefix %b", db)) | ||||
| } | ||||
| 
 | ||||
| func (k Keeper) getMarketID(ctx sdk.Context, denom string) string { | ||||
| func (k Keeper) getSpotMarketID(ctx sdk.Context, denom string) string { | ||||
| 	cp, found := k.GetCollateral(ctx, denom) | ||||
| 	if !found { | ||||
| 		panic(fmt.Sprintf("collateral not found: %s", denom)) | ||||
| 	} | ||||
| 	return cp.MarketID | ||||
| 	return cp.SpotMarketID | ||||
| } | ||||
| 
 | ||||
| func (k Keeper) getliquidationMarketID(ctx sdk.Context, denom string) string { | ||||
| 	cp, found := k.GetCollateral(ctx, denom) | ||||
| 	if !found { | ||||
| 		panic(fmt.Sprintf("collateral not found: %s", denom)) | ||||
| 	} | ||||
| 	return cp.LiquidationMarketID | ||||
| } | ||||
| 
 | ||||
| func (k Keeper) getLiquidationRatio(ctx sdk.Context, denom string) sdk.Dec { | ||||
|  | ||||
| @ -98,7 +98,7 @@ func queryGetCdpsByRatio(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) | ||||
| 		return nil, sdkerrors.Wrap(types.ErrCollateralNotSupported, requestParams.CollateralDenom) | ||||
| 	} | ||||
| 
 | ||||
| 	ratio, err := keeper.CalculateCollateralizationRatioFromAbsoluteRatio(ctx, requestParams.CollateralDenom, requestParams.Ratio) | ||||
| 	ratio, err := keeper.CalculateCollateralizationRatioFromAbsoluteRatio(ctx, requestParams.CollateralDenom, requestParams.Ratio, "liquidation") | ||||
| 	if err != nil { | ||||
| 		return nil, sdkerrors.Wrap(err, "couldn't get collateralization ratio from absolute ratio") | ||||
| 	} | ||||
|  | ||||
| @ -183,7 +183,7 @@ func (suite *QuerierTestSuite) TestQueryCdpsByRatio() { | ||||
| 	expectedBtcIds := []int{} | ||||
| 	for _, cdp := range suite.cdps { | ||||
| 		absoluteRatio := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, cdp.Collateral, cdp.Principal) | ||||
| 		collateralizationRatio, err := suite.keeper.CalculateCollateralizationRatioFromAbsoluteRatio(suite.ctx, cdp.Collateral.Denom, absoluteRatio) | ||||
| 		collateralizationRatio, err := suite.keeper.CalculateCollateralizationRatioFromAbsoluteRatio(suite.ctx, cdp.Collateral.Denom, absoluteRatio, "liquidation") | ||||
| 		suite.Nil(err) | ||||
| 		if cdp.Collateral.Denom == "xrp" { | ||||
| 			if collateralizationRatio.LT(xrpRatio) { | ||||
|  | ||||
| @ -83,7 +83,8 @@ func randomCdpGenState(selection int) types.GenesisState { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.075"), | ||||
| 						AuctionSize:         sdk.NewInt(100000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "xrp:usd", | ||||
| 						SpotMarketID:        "xrp:usd", | ||||
| 						LiquidationMarketID: "xrp:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(6), | ||||
| 					}, | ||||
| 					{ | ||||
| @ -94,7 +95,8 @@ func randomCdpGenState(selection int) types.GenesisState { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(1000000000), | ||||
| 						Prefix:              0x21, | ||||
| 						MarketID:           "btc:usd", | ||||
| 						SpotMarketID:        "btc:usd", | ||||
| 						LiquidationMarketID: "btc:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 					{ | ||||
| @ -105,7 +107,8 @@ func randomCdpGenState(selection int) types.GenesisState { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.15"), | ||||
| 						AuctionSize:         sdk.NewInt(1000000000000), | ||||
| 						Prefix:              0x22, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -139,7 +142,8 @@ func randomCdpGenState(selection int) types.GenesisState { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.075"), | ||||
| 						AuctionSize:         sdk.NewInt(10000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 				}, | ||||
|  | ||||
| @ -64,7 +64,7 @@ func SimulateMsgCdp(ak types.AccountKeeper, k keeper.Keeper, pfk types.Pricefeed | ||||
| 			return simulation.NoOpMsg(types.ModuleName), nil, nil | ||||
| 		} | ||||
| 
 | ||||
| 		price, err := pfk.GetCurrentPrice(ctx, randCollateralParam.MarketID) | ||||
| 		price, err := pfk.GetCurrentPrice(ctx, randCollateralParam.SpotMarketID) | ||||
| 		if err != nil { | ||||
| 			return simulation.NoOpMsg(types.ModuleName), nil, err | ||||
| 		} | ||||
|  | ||||
| @ -32,7 +32,7 @@ Module interactions: | ||||
| 
 | ||||
| In the event of a decrease in the price of the collateral, the total value of all collateral in CDPs may drop below the value of all the issued stable assets. This undesirable event is countered through two mechanisms: | ||||
| 
 | ||||
| **CDP Liquidations** The ratio of collateral value to debt value in each CDP is monitored. When this drops too low the collateral and debt is automatically seized by the system. The collateral is sold off through an auction to bring in stable asset which is burned against the seized debt. | ||||
| **CDP Liquidations** The ratio of collateral value to debt value in each CDP is monitored. When this drops too low the collateral and debt is automatically seized by the system. The collateral is sold off through an auction to bring in stable asset which is burned against the seized debt. The price used to determine liquidation is controlled by the `LiquidationMarketID` parameter, which can be the same as the `SpotMarketID` or use a different calculation of price, such as a time-weighted average. | ||||
| 
 | ||||
| **Debt Auctions** In extreme cases where liquidations fail to raise enough to cover the seized debt, another mechanism kicks in: Debt Auctions. System governance tokens are minted and sold through auction to raise enough stable asset to cover the remaining debt. The governors of the system represent the lenders of last resort. | ||||
| 
 | ||||
|  | ||||
| @ -13,13 +13,14 @@ The cdp module contains the following parameters: | ||||
| Each CollateralParam has the following parameters: | ||||
| 
 | ||||
| | Key                 | Type          | Example                                     | Description                                                                                                    | | ||||
| |------------------|---------------|---------------------------------------------|----------------------------------------------------------------------------------------------------------------| | ||||
| |---------------------|   |---------------|---------------------------------------------|----------------------------------------------------------------------------------------------------------------| | ||||
| | Denom               | string        | "bnb"                                       | collateral coin denom                                                                                          | | ||||
| | LiquidationRatio    | string (dec)  | "1.500000000000000000"                      | the ratio under which a cdp with this collateral type will be liquidated                                       | | ||||
| | DebtLimit           | coin          | {"denom":"bnb","amount":"1000000000000"}    | maximum pegged asset that can be minted backed by this collateral type                                         | | ||||
| | StabilityFee        | string (dec)  | "1.000000001547126"                         | per second fee                                                                                                 | | ||||
| | Prefix              | number (byte) | 34                                          | identifier used in store keys - **must** be unique across collateral types                                     | | ||||
| | MarketID         | string        | "bnb:usd"                                   | price feed identifier for this collateral type                                                                 | | ||||
| | SpotMarketID        | string        | "bnb:usd"                                   | price feed identifier for the spot price of this collateral type                                                       | | ||||
| | LiquidationMarketID | string        | "bnb:usd:30"                                | price feed identifier for the liquidation price of this collateral type                                                       | | ||||
| | ConversionFactor    | string (int)  | "6"                                         | 10^_ multiplier to go from external amount (say BTC1.50) to internal representation of that amount (150000000) | | ||||
| 
 | ||||
| DebtParam has the following parameters: | ||||
|  | ||||
| @ -96,7 +96,8 @@ type CollateralParam struct { | ||||
| 	AuctionSize         sdk.Int  `json:"auction_size" yaml:"auction_size"`               // Max amount of collateral to sell off in any one auction.
 | ||||
| 	LiquidationPenalty  sdk.Dec  `json:"liquidation_penalty" yaml:"liquidation_penalty"` // percentage penalty (between [0, 1]) applied to a cdp if it is liquidated
 | ||||
| 	Prefix              byte     `json:"prefix" yaml:"prefix"` | ||||
| 	MarketID           string   `json:"market_id" yaml:"market_id"`                 // marketID for fetching price of the asset from the pricefeed
 | ||||
| 	SpotMarketID        string   `json:"spot_market_id" yaml:"spot_market_id"`              // marketID of the spot price of the asset from the pricefeed - used for opening CDPs, depositing, withdrawing
 | ||||
| 	LiquidationMarketID string   `json:"liquidation_market_id" yaml:"liquidation_market_id` // marketID of the pricefeed used for liquidation
 | ||||
| 	ConversionFactor    sdk.Int  `json:"conversion_factor" yaml:"conversion_factor"`        // factor for converting internal units to one base unit of collateral
 | ||||
| } | ||||
| 
 | ||||
| @ -110,9 +111,10 @@ func (cp CollateralParam) String() string { | ||||
| 	Debt Limit: %s | ||||
| 	Auction Size: %s | ||||
| 	Prefix: %b | ||||
| 	Market ID: %s | ||||
| 	Spot Market ID: %s | ||||
| 	Liquidation Market ID: %s | ||||
| 	Conversion Factor: %s`, | ||||
| 		cp.Denom, cp.LiquidationRatio, cp.StabilityFee, cp.LiquidationPenalty, cp.DebtLimit, cp.AuctionSize, cp.Prefix, cp.MarketID, cp.ConversionFactor) | ||||
| 		cp.Denom, cp.LiquidationRatio, cp.StabilityFee, cp.LiquidationPenalty, cp.DebtLimit, cp.AuctionSize, cp.Prefix, cp.SpotMarketID, cp.LiquidationMarketID, cp.ConversionFactor) | ||||
| } | ||||
| 
 | ||||
| // CollateralParams array of CollateralParam
 | ||||
| @ -276,8 +278,12 @@ func validateCollateralParams(i interface{}) error { | ||||
| 			return fmt.Errorf("collateral denom invalid %s", cp.Denom) | ||||
| 		} | ||||
| 
 | ||||
| 		if strings.TrimSpace(cp.MarketID) == "" { | ||||
| 			return fmt.Errorf("market id cannot be blank %s", cp) | ||||
| 		if strings.TrimSpace(cp.SpotMarketID) == "" { | ||||
| 			return fmt.Errorf("spot market id cannot be blank %s", cp) | ||||
| 		} | ||||
| 
 | ||||
| 		if strings.TrimSpace(cp.LiquidationMarketID) == "" { | ||||
| 			return fmt.Errorf("liquidation market id cannot be blank %s", cp) | ||||
| 		} | ||||
| 
 | ||||
| 		prefix := int(cp.Prefix) | ||||
|  | ||||
| @ -68,7 +68,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -102,7 +103,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -136,7 +138,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -170,7 +173,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 					{ | ||||
| @ -181,7 +185,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x21, | ||||
| 						MarketID:           "xrp:usd", | ||||
| 						SpotMarketID:        "xrp:usd", | ||||
| 						LiquidationMarketID: "xrp:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(6), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -215,7 +220,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 					{ | ||||
| @ -226,7 +232,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x21, | ||||
| 						MarketID:           "xrp:usd", | ||||
| 						SpotMarketID:        "xrp:usd", | ||||
| 						LiquidationMarketID: "xrp:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(6), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -260,7 +267,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 					{ | ||||
| @ -271,7 +279,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x21, | ||||
| 						MarketID:           "xrp:usd", | ||||
| 						SpotMarketID:        "xrp:usd", | ||||
| 						LiquidationMarketID: "xrp:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(6), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -305,7 +314,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -339,7 +349,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "", | ||||
| 						SpotMarketID:        "", | ||||
| 						LiquidationMarketID: "", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -373,7 +384,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 					{ | ||||
| @ -384,7 +396,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x21, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -418,7 +431,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 					{ | ||||
| @ -429,7 +443,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "xrp:usd", | ||||
| 						SpotMarketID:        "xrp:usd", | ||||
| 						LiquidationMarketID: "xrp:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -463,7 +478,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -497,7 +513,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("1.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -531,7 +548,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.ZeroInt(), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -565,7 +583,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -599,7 +618,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 				}, | ||||
| @ -633,7 +653,8 @@ func (suite *ParamsTestSuite) TestParamValidation() { | ||||
| 						LiquidationPenalty:  sdk.MustNewDecFromStr("0.05"), | ||||
| 						AuctionSize:         sdk.NewInt(50000000000), | ||||
| 						Prefix:              0x20, | ||||
| 						MarketID:           "bnb:usd", | ||||
| 						SpotMarketID:        "bnb:usd", | ||||
| 						LiquidationMarketID: "bnb:usd", | ||||
| 						ConversionFactor:    sdk.NewInt(8), | ||||
| 					}, | ||||
| 				}, | ||||
|  | ||||
| @ -39,7 +39,8 @@ func (suite *PermissionTestSuite) TestSubParamChangePermission_Allows() { | ||||
| 			AuctionSize:         i(100), | ||||
| 			Prefix:              0x20, | ||||
| 			ConversionFactor:    i(6), | ||||
| 			MarketID:           "bnb:usd", | ||||
| 			SpotMarketID:        "bnb:usd", | ||||
| 			LiquidationMarketID: "bnb:usd", | ||||
| 		}, | ||||
| 		{ | ||||
| 			Denom:               "btc", | ||||
| @ -50,7 +51,8 @@ func (suite *PermissionTestSuite) TestSubParamChangePermission_Allows() { | ||||
| 			AuctionSize:         i(1000), | ||||
| 			Prefix:              0x30, | ||||
| 			ConversionFactor:    i(8), | ||||
| 			MarketID:           "btc:usd", | ||||
| 			SpotMarketID:        "btc:usd", | ||||
| 			LiquidationMarketID: "btc:usd", | ||||
| 		}, | ||||
| 	} | ||||
| 	testCPUpdatedDebtLimit := make(cdptypes.CollateralParams, len(testCPs)) | ||||
|  | ||||
| @ -94,7 +94,8 @@ func (suite *KeeperTestSuite) TestSubmitProposal() { | ||||
| 		AuctionSize:         i(100), | ||||
| 		Prefix:              0x20, | ||||
| 		ConversionFactor:    i(6), | ||||
| 		MarketID:           "bnb:usd", | ||||
| 		LiquidationMarketID: "bnb:usd", | ||||
| 		SpotMarketID:        "bnb:usd", | ||||
| 	}} | ||||
| 	testCDPParams := cdptypes.DefaultParams() | ||||
| 	testCDPParams.CollateralParams = testCP | ||||
| @ -106,7 +107,7 @@ func (suite *KeeperTestSuite) TestSubmitProposal() { | ||||
| 
 | ||||
| 	newInvalidCP := make(cdptypes.CollateralParams, len(testCP)) | ||||
| 	copy(newInvalidCP, testCP) | ||||
| 	newInvalidCP[0].MarketID = "btc:usd" | ||||
| 	newInvalidCP[0].SpotMarketID = "btc:usd" | ||||
| 
 | ||||
| 	testcases := []struct { | ||||
| 		name        string | ||||
|  | ||||
| @ -24,7 +24,8 @@ func (suite *PermissionsTestSuite) TestAllowedCollateralParams_Allows() { | ||||
| 			AuctionSize:         i(100), | ||||
| 			Prefix:              0x20, | ||||
| 			ConversionFactor:    i(6), | ||||
| 			MarketID:           "bnb:usd", | ||||
| 			SpotMarketID:        "bnb:usd", | ||||
| 			LiquidationMarketID: "bnb:usd", | ||||
| 		}, | ||||
| 		{ | ||||
| 			Denom:               "btc", | ||||
| @ -35,7 +36,8 @@ func (suite *PermissionsTestSuite) TestAllowedCollateralParams_Allows() { | ||||
| 			AuctionSize:         i(1000), | ||||
| 			Prefix:              0x30, | ||||
| 			ConversionFactor:    i(8), | ||||
| 			MarketID:           "btc:usd", | ||||
| 			SpotMarketID:        "btc:usd", | ||||
| 			LiquidationMarketID: "btc:usd", | ||||
| 		}, | ||||
| 		{ | ||||
| 			Denom:               "atom", | ||||
| @ -46,7 +48,8 @@ func (suite *PermissionsTestSuite) TestAllowedCollateralParams_Allows() { | ||||
| 			AuctionSize:         i(100), | ||||
| 			Prefix:              0x40, | ||||
| 			ConversionFactor:    i(6), | ||||
| 			MarketID:           "atom:usd", | ||||
| 			SpotMarketID:        "atom:usd", | ||||
| 			LiquidationMarketID: "atom:usd", | ||||
| 		}, | ||||
| 	} | ||||
| 	updatedTestCPs := make(cdptypes.CollateralParams, len(testCPs)) | ||||
| @ -85,7 +88,8 @@ func (suite *PermissionsTestSuite) TestAllowedCollateralParams_Allows() { | ||||
| 					AuctionSize:         true, | ||||
| 					LiquidationPenalty:  true, | ||||
| 					Prefix:              true, | ||||
| 					MarketID:           true, | ||||
| 					SpotMarketID:        true, | ||||
| 					LiquidationMarketID: true, | ||||
| 					ConversionFactor:    true, | ||||
| 				}, | ||||
| 			}, | ||||
| @ -109,7 +113,8 @@ func (suite *PermissionsTestSuite) TestAllowedCollateralParams_Allows() { | ||||
| 					AuctionSize:         true, | ||||
| 					LiquidationPenalty:  true, | ||||
| 					Prefix:              true, | ||||
| 					MarketID:           true, | ||||
| 					SpotMarketID:        true, | ||||
| 					LiquidationMarketID: true, | ||||
| 					ConversionFactor:    true, | ||||
| 				}, | ||||
| 			}, | ||||
| @ -384,16 +389,17 @@ func (suite *PermissionsTestSuite) TestAllowedCollateralParam_Allows() { | ||||
| 		AuctionSize:         i(100), | ||||
| 		Prefix:              0x20, | ||||
| 		ConversionFactor:    i(6), | ||||
| 		MarketID:           "bnb:usd", | ||||
| 		SpotMarketID:        "bnb:usd", | ||||
| 		LiquidationMarketID: "bnb:usd", | ||||
| 	} | ||||
| 	newMarketIDCP := testCP | ||||
| 	newMarketIDCP.MarketID = "btc:usd" | ||||
| 	newMarketIDCP.SpotMarketID = "btc:usd" | ||||
| 
 | ||||
| 	newDebtLimitCP := testCP | ||||
| 	newDebtLimitCP.DebtLimit = c("usdx", 1000) | ||||
| 
 | ||||
| 	newMarketIDAndDebtLimitCP := testCP | ||||
| 	newMarketIDCP.MarketID = "btc:usd" | ||||
| 	newMarketIDCP.SpotMarketID = "btc:usd" | ||||
| 	newDebtLimitCP.DebtLimit = c("usdx", 1000) | ||||
| 
 | ||||
| 	testcases := []struct { | ||||
|  | ||||
| @ -379,7 +379,8 @@ type AllowedCollateralParam struct { | ||||
| 	AuctionSize         bool   `json:"auction_size" yaml:"auction_size"` | ||||
| 	LiquidationPenalty  bool   `json:"liquidation_penalty" yaml:"liquidation_penalty"` | ||||
| 	Prefix              bool   `json:"prefix" yaml:"prefix"` | ||||
| 	MarketID           bool   `json:"market_id" yaml:"market_id"` | ||||
| 	SpotMarketID        bool   `json:"spot_market_id" yaml:"spot_market_id"` | ||||
| 	LiquidationMarketID bool   `json:"liquidation_market_id" yaml:"liquidation_market_id"` | ||||
| 	ConversionFactor    bool   `json:"conversion_factor" yaml:"conversion_factor"` | ||||
| } | ||||
| 
 | ||||
| @ -391,7 +392,8 @@ func (acp AllowedCollateralParam) Allows(current, incoming cdptypes.CollateralPa | ||||
| 		(current.AuctionSize.Equal(incoming.AuctionSize) || acp.AuctionSize) && | ||||
| 		(current.LiquidationPenalty.Equal(incoming.LiquidationPenalty) || acp.LiquidationPenalty) && | ||||
| 		((current.Prefix == incoming.Prefix) || acp.Prefix) && | ||||
| 		((current.MarketID == incoming.MarketID) || acp.MarketID) && | ||||
| 		((current.SpotMarketID == incoming.SpotMarketID) || acp.SpotMarketID) && | ||||
| 		((current.LiquidationMarketID == incoming.LiquidationMarketID) || acp.LiquidationMarketID) && | ||||
| 		(current.ConversionFactor.Equal(incoming.ConversionFactor) || acp.ConversionFactor) | ||||
| 	return allowed | ||||
| } | ||||
|  | ||||
| @ -190,7 +190,8 @@ func (suite *KeeperTestSuite) setupCdpChain() { | ||||
| 					LiquidationPenalty:  d("0.05"), | ||||
| 					AuctionSize:         i(10000000000), | ||||
| 					Prefix:              0x20, | ||||
| 					MarketID:           "bnb:usd", | ||||
| 					SpotMarketID:        "bnb:usd", | ||||
| 					LiquidationMarketID: "bnb:usd", | ||||
| 					ConversionFactor:    i(8), | ||||
| 				}, | ||||
| 			}, | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Kevin Davis
						Kevin Davis