diff --git a/config.yml b/config.yml index 84ec8b659..c0a68876b 100644 --- a/config.yml +++ b/config.yml @@ -2,6 +2,8 @@ version: 1 accounts: - name: treasury coins: + - 100000000uatom + - 100000000uusdt - 9000000000000000uelys - 100000000ueden mnemonic: olympic slide park figure frost benefit deer reform fly pull price airport submit monitor silk insect uphold convince pupil project ignore roof warfare slight @@ -301,10 +303,22 @@ genesis: display: "BTC" bandTicker: "BTC" elysTicker: "BTC" + decimal: 9 - denom: "wei" display: "ETH" bandTicker: "ETH" elysTicker: "ETH" + decimal: 18 + - denom: "uatom" + display: "ATOM" + bandTicker: "ATOM" + elysTicker: "ATOM" + decimal: 6 + - denom: "uusdt" + display: "USDT" + bandTicker: "USDT" + elysTicker: "USDT" + decimal: 6 params: ask_count: "4" band_channel_source: "channel-0" @@ -324,6 +338,16 @@ genesis: - feeder: "elys12tzylat4udvjj56uuhu3vj2n4vgp7cf9fwna9w" is_active: true prices: + - asset: USDT + price: "1.00" + provider: elys12tzylat4udvjj56uuhu3vj2n4vgp7cf9fwna9w + source: elys + timestamp: "1694743319" + - asset: USDC + price: "1.00" + provider: elys12tzylat4udvjj56uuhu3vj2n4vgp7cf9fwna9w + source: elys + timestamp: "1694743319" burner: params: epochIdentifier: day diff --git a/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go b/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go index d83548668..cdf8260c9 100644 --- a/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go +++ b/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go @@ -12,11 +12,11 @@ import ( func AssetsValue(ctx sdk.Context, oracleKeeper types.OracleKeeper, elCoins sdk.DecCoins) (sdk.Dec, error) { totalValue := sdk.ZeroDec() for _, asset := range elCoins { - tokenPrice := oracleKeeper.GetAssetPriceFromDenom(ctx, asset.Denom) - if tokenPrice.IsZero() { - return sdk.ZeroDec(), fmt.Errorf("token price not set: %s", asset.Denom) + price, found := oracleKeeper.GetAssetPrice(ctx, asset.Denom) + if !found { + return sdk.ZeroDec(), fmt.Errorf("asset price not set: %s", asset.Denom) } else { - v := tokenPrice.Mul(asset.Amount) + v := price.Price.Mul(asset.Amount) totalValue = totalValue.Add(v) } } @@ -62,8 +62,13 @@ func (k msgServer) FeedMultipleExternalLiquidity(goCtx context.Context, msg *typ return nil, err } + fmt.Println("tvl", tvl.String()) + fmt.Println("elValue", elValue.String()) + elRatio := elValue.Quo(tvl) + fmt.Println("elRatio1", elRatio.String(), el.Depth) elRatio = elRatio.Quo(LiquidityRatioFromPriceDepth(el.Depth)) + fmt.Println("elRatio2", elRatio.String()) if elRatio.LT(sdk.OneDec()) { elRatio = sdk.OneDec() } diff --git a/x/amm/types/expected_keepers.go b/x/amm/types/expected_keepers.go index 17413278f..418286ca1 100644 --- a/x/amm/types/expected_keepers.go +++ b/x/amm/types/expected_keepers.go @@ -31,6 +31,7 @@ type BankKeeper interface { // OracleKeeper defines the expected interface needed to retrieve price info type OracleKeeper interface { + GetAssetPrice(ctx sdk.Context, asset string) (oracletypes.Price, bool) GetAssetPriceFromDenom(ctx sdk.Context, denom string) sdk.Dec GetPriceFeeder(ctx sdk.Context, feeder string) (val oracletypes.PriceFeeder, found bool) } diff --git a/x/incentive/types/expected_keepers.go b/x/incentive/types/expected_keepers.go index 8b78657b5..cad38a490 100644 --- a/x/incentive/types/expected_keepers.go +++ b/x/incentive/types/expected_keepers.go @@ -97,6 +97,7 @@ type AmmKeeper interface { // OracleKeeper defines the expected interface needed to retrieve price info type OracleKeeper interface { + GetAssetPrice(ctx sdk.Context, asset string) (oracletypes.Price, bool) GetAssetPriceFromDenom(ctx sdk.Context, denom string) sdk.Dec GetPriceFeeder(ctx sdk.Context, feeder string) (val oracletypes.PriceFeeder, found bool) }