From 74071d3c3a0c02c259adda83e4d27987225e80d1 Mon Sep 17 00:00:00 2001 From: xieqian Date: Sun, 4 Feb 2024 17:06:22 +0800 Subject: [PATCH] get config infos from contrct --- components/Modal/Action.tsx | 21 ++++---- interfaces/burrow.ts | 2 + interfaces/contract-methods.ts | 1 + redux/appSlice.ts | 2 + redux/assetsSlice.ts | 6 ++- store/actions/adjustCollateral.ts | 41 ++++++++------- store/actions/borrow.ts | 25 +++++---- store/actions/repayFromDeposits.ts | 81 ++++++++++++++++-------------- store/actions/shadow.ts | 69 +++++++++++++------------ store/actions/withdraw.ts | 75 +++++++++++++++------------ store/helper.ts | 30 ++++++++--- utils/pythOracleConfig.ts | 34 ++++++------- 12 files changed, 216 insertions(+), 171 deletions(-) diff --git a/components/Modal/Action.tsx b/components/Modal/Action.tsx index 97bc8b45..72bee988 100644 --- a/components/Modal/Action.tsx +++ b/components/Modal/Action.tsx @@ -1,8 +1,4 @@ import { useState, useMemo, useEffect } from "react"; -import { Box, Typography, Switch, Tooltip, Alert, useTheme } from "@mui/material"; -import LoadingButton from "@mui/lab/LoadingButton"; -import Decimal from "decimal.js"; -import { FcInfo } from "@react-icons/all-files/fc/FcInfo"; import { nearTokenId } from "../../utils"; import { toggleUseAsCollateral, hideModal } from "../../redux/appSlice"; import { getModalData } from "./utils"; @@ -15,22 +11,22 @@ import { withdraw } from "../../store/actions/withdraw"; import { shadow_action_supply } from "../../store/actions/shadow"; import { adjustCollateral } from "../../store/actions/adjustCollateral"; import { useAppSelector, useAppDispatch } from "../../redux/hooks"; -import { getSelectedValues, getAssetData } from "../../redux/appSelectors"; -import { trackActionButton, trackUseAsCollateral } from "../../utils/telemetry"; +import { getSelectedValues, getAssetData, getConfig } from "../../redux/appSelectors"; +import { trackActionButton } from "../../utils/telemetry"; import { useDegenMode } from "../../hooks/hooks"; -import { SubmitButton, AlertWarning } from "./components"; -import { getAccountPortfolio } from "../../redux/accountSelectors"; +import { SubmitButton } from "./components"; import getShadowRecords from "../../api/get-shadows"; -import { expandToken } from "../../store"; +import getFrontEndConfig from "../../utils/config"; export default function Action({ maxBorrowAmount, healthFactor, collateralType }) { const [loading, setLoading] = useState(false); const { amount, useAsCollateral, isMax } = useAppSelector(getSelectedValues); + // const enable_pyth_oracle = getFrontEndConfig().PRICE_SWITCH === "pyth"; + const { enable_pyth_oracle } = useAppSelector(getConfig); const dispatch = useAppDispatch(); const asset = useAppSelector(getAssetData); const { action = "Deposit", tokenId, isLpToken, decimals } = asset; const { isRepayFromDeposits } = useDegenMode(); - const { available, canUseAsCollateral, extraDecimals, collateral, disabled } = getModalData({ ...asset, maxBorrowAmount, @@ -83,7 +79,7 @@ export default function Action({ maxBorrowAmount, healthFactor, collateralType } } break; case "Borrow": { - await borrow({ tokenId, extraDecimals, amount, collateralType }); + await borrow({ tokenId, extraDecimals, amount, collateralType, enable_pyth_oracle }); break; } case "Withdraw": { @@ -92,6 +88,7 @@ export default function Action({ maxBorrowAmount, healthFactor, collateralType } extraDecimals, amount, isMax, + enable_pyth_oracle, }); break; } @@ -101,6 +98,7 @@ export default function Action({ maxBorrowAmount, healthFactor, collateralType } extraDecimals, amount, isMax, + enable_pyth_oracle, }); break; case "Repay": { @@ -111,6 +109,7 @@ export default function Action({ maxBorrowAmount, healthFactor, collateralType } extraDecimals, position: collateralType, isMax, + enable_pyth_oracle, }); } else { await repay({ diff --git a/interfaces/burrow.ts b/interfaces/burrow.ts index ec1f2bea..47937a8a 100644 --- a/interfaces/burrow.ts +++ b/interfaces/burrow.ts @@ -26,6 +26,8 @@ export interface IConfig { ref_exchange_id: string; owner_id: string; x_booster_multiplier_at_maximum_staking_duration: number; + enable_price_oracle: boolean; + enable_pyth_oracle: boolean; } export interface IBurrow { diff --git a/interfaces/contract-methods.ts b/interfaces/contract-methods.ts index 3dfa9461..c516787c 100644 --- a/interfaces/contract-methods.ts +++ b/interfaces/contract-methods.ts @@ -15,6 +15,7 @@ export enum ViewMethodsLogic { get_asset_farms_paged, storage_balance_of, check_registration, + get_all_token_pyth_infos, } // Change methods can modify the state. But you don't receive the returned value when called. diff --git a/redux/appSlice.ts b/redux/appSlice.ts index 1f4f0cee..9552a083 100644 --- a/redux/appSlice.ts +++ b/redux/appSlice.ts @@ -129,6 +129,8 @@ export const initialState: AppState = { ref_exchange_id: "", owner_id: "", x_booster_multiplier_at_maximum_staking_duration: 0, + enable_price_oracle: false, + enable_pyth_oracle: true, }, }; diff --git a/redux/assetsSlice.ts b/redux/assetsSlice.ts index d4363e5e..6bfbcd07 100644 --- a/redux/assetsSlice.ts +++ b/redux/assetsSlice.ts @@ -41,7 +41,11 @@ export const assetSlice = createSlice({ builder.addCase(fetchRefPrices.fulfilled, (state, action) => { missingPriceTokens.forEach((missingToken) => { const missingTokenId = missingToken[defaultNetwork]; - if (missingTokenId && state.data[missingTokenId] && !state.data[missingTokenId]["price"]) { + if ( + missingTokenId && + state.data[missingTokenId] && + !+(state.data[missingTokenId]["price"]?.multiplier || "0") + ) { state.data[missingTokenId]["price"] = { decimals: action.payload[missingToken.mainnet].decimal, usd: Number(action.payload[missingToken.mainnet].price), diff --git a/store/actions/adjustCollateral.ts b/store/actions/adjustCollateral.ts index 3001cc04..e665b5e2 100644 --- a/store/actions/adjustCollateral.ts +++ b/store/actions/adjustCollateral.ts @@ -5,8 +5,7 @@ import { decimalMin, getBurrow } from "../../utils"; import { expandTokenDecimal } from "../helper"; import { ChangeMethodsLogic, ChangeMethodsOracle } from "../../interfaces"; import { Transaction } from "../wallet"; -import { getMetadata, prepareAndExecuteTransactions } from "../tokens"; -import { getAccountDetailed } from "../accounts"; +import { prepareAndExecuteTransactions } from "../tokens"; import getAssets from "../../api/get-assets"; import { transformAssets } from "../../transformers/asstets"; import getAccount from "../../api/get-account"; @@ -17,11 +16,13 @@ export async function adjustCollateral({ extraDecimals, amount, isMax, + enable_pyth_oracle, }: { tokenId: string; extraDecimals: number; amount: string; isMax: boolean; + enable_pyth_oracle: boolean; }) { const { oracleContract, logicContract } = await getBurrow(); const assets = await getAssets().then(transformAssets); @@ -29,7 +30,6 @@ export async function adjustCollateral({ const { decimals } = asset.metadata; const account = await getAccount().then(transformAccount); if (!account) return; - const suppliedBalance = new Decimal(account.portfolio?.supplied[tokenId]?.balance || 0); const collateralBalance = new Decimal( asset.isLpToken @@ -68,7 +68,9 @@ export async function adjustCollateral({ receiverId: logicContract.contractId, functionCalls: [ { - methodName: ChangeMethodsLogic[ChangeMethodsLogic.execute_with_pyth], + methodName: enable_pyth_oracle + ? ChangeMethodsLogic[ChangeMethodsLogic.execute_with_pyth] + : ChangeMethodsLogic[ChangeMethodsLogic.execute], gas: new BN("100000000000000"), args: { actions: [increaseCollateralTemplate], @@ -103,24 +105,25 @@ export async function adjustCollateral({ } await prepareAndExecuteTransactions([ { - // receiverId: oracleContract.contractId, - receiverId: logicContract.contractId, + receiverId: enable_pyth_oracle ? logicContract.contractId : oracleContract.contractId, functionCalls: [ { - // methodName: ChangeMethodsOracle[ChangeMethodsOracle.oracle_call], - methodName: ChangeMethodsLogic[ChangeMethodsLogic.execute_with_pyth], + methodName: enable_pyth_oracle + ? ChangeMethodsLogic[ChangeMethodsLogic.execute_with_pyth] + : ChangeMethodsOracle[ChangeMethodsOracle.oracle_call], gas: new BN("100000000000000"), - // args: { - // receiver_id: logicContract.contractId, - // msg: JSON.stringify({ - // Execute: { - // actions: [decreaseCollateralTemplate], - // }, - // }), - // }, - args: { - actions: [decreaseCollateralTemplate], - }, + args: enable_pyth_oracle + ? { + actions: [decreaseCollateralTemplate], + } + : { + receiver_id: logicContract.contractId, + msg: JSON.stringify({ + Execute: { + actions: [decreaseCollateralTemplate], + }, + }), + }, }, ], } as Transaction, diff --git a/store/actions/borrow.ts b/store/actions/borrow.ts index 80126b64..937e24e5 100644 --- a/store/actions/borrow.ts +++ b/store/actions/borrow.ts @@ -19,11 +19,13 @@ export async function borrow({ extraDecimals, amount, collateralType, + enable_pyth_oracle, }: { tokenId: string; extraDecimals: number; amount: string; collateralType: string; + enable_pyth_oracle: boolean; }) { const { oracleContract, logicContract, account } = await getBurrow(); const { decimals } = (await getMetadata(tokenId))!; @@ -121,20 +123,21 @@ export async function borrow({ } transactions.push({ - // receiverId: oracleContract.contractId, - receiverId: logicContract.contractId, + receiverId: enable_pyth_oracle ? logicContract.contractId : oracleContract.contractId, functionCalls: [ { - // methodName: ChangeMethodsOracle[ChangeMethodsOracle.oracle_call], - methodName: ChangeMethodsLogic[ChangeMethodsLogic.execute_with_pyth], + methodName: enable_pyth_oracle + ? ChangeMethodsLogic[ChangeMethodsLogic.execute_with_pyth] + : ChangeMethodsOracle[ChangeMethodsOracle.oracle_call], gas: new BN("100000000000000"), - // args: { - // receiver_id: logicContract.contractId, - // msg: JSON.stringify(borrowTemplate), - // }, - args: { - actions: borrowTemplate.Execute.actions, - }, + args: enable_pyth_oracle + ? { + actions: borrowTemplate.Execute.actions, + } + : { + receiver_id: logicContract.contractId, + msg: JSON.stringify(borrowTemplate), + }, }, ], }); diff --git a/store/actions/repayFromDeposits.ts b/store/actions/repayFromDeposits.ts index 9c14b719..00407eac 100644 --- a/store/actions/repayFromDeposits.ts +++ b/store/actions/repayFromDeposits.ts @@ -15,12 +15,14 @@ export async function repayFromDeposits({ extraDecimals, position, isMax, + enable_pyth_oracle, }: { tokenId: string; amount: string; extraDecimals: number; position: string; isMax: boolean; + enable_pyth_oracle: boolean; }) { // TODO repay from supplied const { logicContract, oracleContract } = await getBurrow(); @@ -66,47 +68,48 @@ export async function repayFromDeposits({ }, }; transactions.push({ - // receiverId: oracleContract.contractId, - receiverId: logicContract.contractId, + receiverId: enable_pyth_oracle ? logicContract.contractId : oracleContract.contractId, functionCalls: [ { - // methodName: ChangeMethodsOracle[ChangeMethodsOracle.oracle_call], - methodName: ChangeMethodsLogic[ChangeMethodsLogic.execute_with_pyth], - // args: { - // receiver_id: logicContract.contractId, - // msg: JSON.stringify({ - // Execute: { - // actions: [ - // ...(decreaseCollateralAmount.gt(0) - // ? [ - // { - // DecreaseCollateral: { - // token_id: tokenId, - // amount: decreaseCollateralAmount.toFixed(0), - // }, - // }, - // ] - // : []), - // repayTemplate, - // ], - // }, - // }), - // }, - args: { - actions: [ - ...(decreaseCollateralAmount.gt(0) - ? [ - { - DecreaseCollateral: { - token_id: tokenId, - amount: decreaseCollateralAmount.toFixed(0), - }, - }, - ] - : []), - repayTemplate, - ], - }, + methodName: enable_pyth_oracle + ? ChangeMethodsLogic[ChangeMethodsLogic.execute_with_pyth] + : ChangeMethodsOracle[ChangeMethodsOracle.oracle_call], + args: enable_pyth_oracle + ? { + actions: [ + ...(decreaseCollateralAmount.gt(0) + ? [ + { + DecreaseCollateral: { + token_id: tokenId, + amount: decreaseCollateralAmount.toFixed(0), + }, + }, + ] + : []), + repayTemplate, + ], + } + : { + receiver_id: logicContract.contractId, + msg: JSON.stringify({ + Execute: { + actions: [ + ...(decreaseCollateralAmount.gt(0) + ? [ + { + DecreaseCollateral: { + token_id: tokenId, + amount: decreaseCollateralAmount.toFixed(0), + }, + }, + ] + : []), + repayTemplate, + ], + }, + }), + }, }, ], }); diff --git a/store/actions/shadow.ts b/store/actions/shadow.ts index 5f05e72a..d08a2ce1 100644 --- a/store/actions/shadow.ts +++ b/store/actions/shadow.ts @@ -59,55 +59,58 @@ export async function shadow_action_withdraw({ expandAmount, isMax, decreaseCollateralAmount, + enable_pyth_oracle, }: { tokenId: string; expandAmount: string; isMax: boolean; decreaseCollateralAmount: Decimal; + enable_pyth_oracle: boolean; }): Promise { const transactions: Transaction[] = []; const { refv1Contract, logicContract, oracleContract } = await getBurrow(); const pool_id = +tokenId.split("-")[1]; if (decreaseCollateralAmount.gt(0)) { transactions.push({ - // receiverId: oracleContract.contractId, - receiverId: logicContract.contractId, + receiverId: enable_pyth_oracle ? logicContract.contractId : oracleContract.contractId, functionCalls: [ { - // methodName: ChangeMethodsOracle[ChangeMethodsOracle.oracle_call], - methodName: ChangeMethodsLogic[ChangeMethodsLogic.execute_with_pyth], + methodName: enable_pyth_oracle + ? ChangeMethodsLogic[ChangeMethodsLogic.execute_with_pyth] + : ChangeMethodsOracle[ChangeMethodsOracle.oracle_call], gas: new BN("100000000000000"), - // args: { - // receiver_id: logicContract.contractId, - // msg: JSON.stringify({ - // Execute: { - // actions: [ - // { - // PositionDecreaseCollateral: { - // position: tokenId, - // asset_amount: { - // token_id: tokenId, - // amount: decreaseCollateralAmount.toFixed(0), - // }, - // }, - // }, - // ], - // }, - // }), - // }, - args: { - actions: [ - { - PositionDecreaseCollateral: { - position: tokenId, - asset_amount: { - token_id: tokenId, - amount: decreaseCollateralAmount.toFixed(0), + args: enable_pyth_oracle + ? { + actions: [ + { + PositionDecreaseCollateral: { + position: tokenId, + asset_amount: { + token_id: tokenId, + amount: decreaseCollateralAmount.toFixed(0), + }, + }, }, - }, + ], + } + : { + receiver_id: logicContract.contractId, + msg: JSON.stringify({ + Execute: { + actions: [ + { + PositionDecreaseCollateral: { + position: tokenId, + asset_amount: { + token_id: tokenId, + amount: decreaseCollateralAmount.toFixed(0), + }, + }, + }, + ], + }, + }), }, - ], - }, }, ], }); diff --git a/store/actions/withdraw.ts b/store/actions/withdraw.ts index 68d1bff5..a1ea9f15 100644 --- a/store/actions/withdraw.ts +++ b/store/actions/withdraw.ts @@ -22,9 +22,16 @@ interface Props { extraDecimals: number; amount: string; isMax: boolean; + enable_pyth_oracle: boolean; } -export async function withdraw({ tokenId, extraDecimals, amount, isMax }: Props) { +export async function withdraw({ + tokenId, + extraDecimals, + amount, + isMax, + enable_pyth_oracle, +}: Props) { const assets = await getAssets().then(transformAssets); const account = await getAccount().then(transformAccount); if (!account) return; @@ -49,6 +56,7 @@ export async function withdraw({ tokenId, extraDecimals, amount, isMax }: Props) expandAmount: expandedAmount.toFixed(0), isMax, decreaseCollateralAmount, + enable_pyth_oracle, }); } else { const tokenContract = await getTokenContract(tokenId); @@ -104,40 +112,41 @@ export async function withdraw({ tokenId, extraDecimals, amount, isMax }: Props) }; if (decreaseCollateralAmount.gt(0)) { transactions.push({ - // receiverId: oracleContract.contractId, - receiverId: logicContract.contractId, + receiverId: enable_pyth_oracle ? logicContract.contractId : oracleContract.contractId, functionCalls: [ { - // methodName: ChangeMethodsOracle[ChangeMethodsOracle.oracle_call], - methodName: ChangeMethodsLogic[ChangeMethodsLogic.execute_with_pyth], + methodName: enable_pyth_oracle + ? ChangeMethodsLogic[ChangeMethodsLogic.execute_with_pyth] + : ChangeMethodsOracle[ChangeMethodsOracle.oracle_call], gas: new BN("100000000000000"), - // args: { - // receiver_id: logicContract.contractId, - // msg: JSON.stringify({ - // Execute: { - // actions: [ - // { - // DecreaseCollateral: { - // token_id: tokenId, - // amount: decreaseCollateralAmount.toFixed(0), - // }, - // }, - // withdrawAction, - // ], - // }, - // }), - // }, - args: { - actions: [ - { - DecreaseCollateral: { - token_id: tokenId, - amount: decreaseCollateralAmount.toFixed(0), - }, + args: enable_pyth_oracle + ? { + actions: [ + { + DecreaseCollateral: { + token_id: tokenId, + amount: decreaseCollateralAmount.toFixed(0), + }, + }, + withdrawAction, + ], + } + : { + receiver_id: logicContract.contractId, + msg: JSON.stringify({ + Execute: { + actions: [ + { + DecreaseCollateral: { + token_id: tokenId, + amount: decreaseCollateralAmount.toFixed(0), + }, + }, + withdrawAction, + ], + }, + }), }, - withdrawAction, - ], - }, }, ], }); @@ -146,7 +155,9 @@ export async function withdraw({ tokenId, extraDecimals, amount, isMax }: Props) receiverId: logicContract.contractId, functionCalls: [ { - methodName: ChangeMethodsLogic[ChangeMethodsLogic.execute_with_pyth], + methodName: enable_pyth_oracle + ? ChangeMethodsLogic[ChangeMethodsLogic.execute_with_pyth] + : ChangeMethodsLogic[ChangeMethodsLogic.execute], args: { actions: [withdrawAction], }, diff --git a/store/helper.ts b/store/helper.ts index c7f5f2d4..07661323 100644 --- a/store/helper.ts +++ b/store/helper.ts @@ -4,7 +4,7 @@ import { Account, Contract } from "near-api-js"; import { DEFAULT_PRECISION, NANOS_PER_YEAR, NEAR_DECIMALS } from "./constants"; import { getBurrow, nearTokenId } from "../utils"; -import getConfig from "../utils/config"; +import getFrontEndConfig from "../utils/config"; import { ViewMethodsOracle, IAssetPrice, @@ -13,6 +13,8 @@ import { ViewMethodsPyth, IPythPrice, ViewMethodsToken, + ViewMethodsLogic, + IConfig, } from "../interfaces"; import { isRegistered } from "./wallet"; import { @@ -44,7 +46,14 @@ export const rateToApr = (rate: string): string => { }; export const getPrices = async (): Promise => { - if (getConfig().PRICE_SWITCH === "pyth") { + const { view, logicContract } = await getBurrow(); + const config = (await view( + logicContract, + ViewMethodsLogic[ViewMethodsLogic.get_config], + )) as IConfig; + // const enable_pyth_oracle = getFrontEndConfig().PRICE_SWITCH === "pyth"; + const { enable_pyth_oracle } = config; + if (enable_pyth_oracle) { const pythResponse = await getPythPrices(); return pythResponse; } else { @@ -53,12 +62,17 @@ export const getPrices = async (): Promise => { } }; const getPythPrices = async () => { - const { view, pythContract } = await getBurrow(); + const { view, pythContract, logicContract } = await getBurrow(); + // const COINList = COINS; + const COINList = await view( + logicContract, + ViewMethodsLogic[ViewMethodsLogic.get_all_token_pyth_infos], + ); try { - const array_coins = Object.entries(COINS) as any[]; + const array_coins = Object.entries(COINList) as any[]; const allRequest = array_coins.map(([, coin]) => { return view(pythContract, ViewMethodsPyth[ViewMethodsPyth.get_price], { - price_identifier: coin.priceFeedId, + price_identifier: coin.price_identifier, }); }); let near_pyth_price_obj: IPythPrice = { @@ -75,13 +89,13 @@ const getPythPrices = async () => { if (coin[0] === nearTokenId) { near_pyth_price_obj = priceObject; } - coin[1].fractionDigits = coin[1].fractionDigits || FRACTION_DIGITS; - const discrepancy_denominator = new Decimal(10).pow(coin[1].fractionDigits).toNumber(); + coin[1].fraction_digits = coin[1].fraction_digits || FRACTION_DIGITS; + const discrepancy_denominator = new Decimal(10).pow(coin[1].fraction_digits).toNumber(); const object = { asset_id: coin[0], price: { multiplier: new Decimal(p).mul(discrepancy_denominator).toFixed(0), - decimals: coin[1].decimals + coin[1].fractionDigits, + decimals: coin[1].decimals + coin[1].fraction_digits, }, }; return object; diff --git a/utils/pythOracleConfig.ts b/utils/pythOracleConfig.ts index 939f6ca2..9305ce1c 100644 --- a/utils/pythOracleConfig.ts +++ b/utils/pythOracleConfig.ts @@ -4,49 +4,49 @@ const FRACTION_DIGITS = 4; const TestnetCoins = { "wrap.testnet": { decimals: 24, - priceFeedId: "27e867f0f4f61076456d1a73b14c7edc1cf5cef4f4d6193a33424288f11bd0f4", + price_identifier: "27e867f0f4f61076456d1a73b14c7edc1cf5cef4f4d6193a33424288f11bd0f4", }, aurora: { decimals: 18, - fractionDigits: 2, - priceFeedId: "ca80ba6dc32e08d06f1aa886011eed1d77c77be9eb761cc10d72b7d0a2fd57a6", + fraction_digits: 2, + price_identifier: "ca80ba6dc32e08d06f1aa886011eed1d77c77be9eb761cc10d72b7d0a2fd57a6", }, "usdt.fakes.testnet": { decimals: 6, - priceFeedId: "1fc18861232290221461220bd4e2acd1dcdfbc89c84092c93c18bdc7756c1588", + price_identifier: "1fc18861232290221461220bd4e2acd1dcdfbc89c84092c93c18bdc7756c1588", }, "usdc.fakes.testnet": { decimals: 6, - priceFeedId: "41f3625971ca2ed2263e78573fe5ce23e13d2558ed3f2e47ab0f84fb9e7ae722", + price_identifier: "41f3625971ca2ed2263e78573fe5ce23e13d2558ed3f2e47ab0f84fb9e7ae722", }, "dai.fakes.testnet": { decimals: 18, - priceFeedId: "87a67534df591d2dd5ec577ab3c75668a8e3d35e92e27bf29d9e2e52df8de412", + price_identifier: "87a67534df591d2dd5ec577ab3c75668a8e3d35e92e27bf29d9e2e52df8de412", }, "wbtc.fakes.testnet": { decimals: 8, - fractionDigits: 2, - priceFeedId: "ea0459ab2954676022baaceadb472c1acc97888062864aa23e9771bae3ff36ed", + fraction_digits: 2, + price_identifier: "ea0459ab2954676022baaceadb472c1acc97888062864aa23e9771bae3ff36ed", }, "aurora.fakes.testnet": { decimals: 18, - fractionDigits: 5, - priceFeedId: "eb00e1f858549e12034ff880b7592456a71b4237aaf4aeb16e63cd9b68ba4d7e", + fraction_digits: 5, + price_identifier: "eb00e1f858549e12034ff880b7592456a71b4237aaf4aeb16e63cd9b68ba4d7e", }, "woo.orderly.testnet": { decimals: 18, - fractionDigits: 6, - priceFeedId: "bf517e0f7ccfc307f0b2fa93b99a737641933989af6af769c928725989c21e66", + fraction_digits: 6, + price_identifier: "bf517e0f7ccfc307f0b2fa93b99a737641933989af6af769c928725989c21e66", }, }; const MainnetCoins = { "wrap.near": { decimals: 24, - priceFeedId: "c415de8d2eba7db216527dff4b60e8f3a5311c740dadb233e13e12547e226750", + price_identifier: "c415de8d2eba7db216527dff4b60e8f3a5311c740dadb233e13e12547e226750", }, aurora: { decimals: 18, - fractionDigits: 2, + fraction_digits: 2, }, "dac17f958d2ee523a2206206994597c13d831ec7.factory.bridge.near": { decimals: 6, @@ -59,15 +59,15 @@ const MainnetCoins = { }, "2260fac5e5542a773aa44fbcfedf7c193bc2c599.factory.bridge.near": { decimals: 8, - fractionDigits: 2, + fraction_digits: 2, }, "aaaaaa20d9e0e2461697782ef11675f668207961.factory.bridge.near": { decimals: 18, - fractionDigits: 5, + fraction_digits: 5, }, "4691937a7508860f876c9c0a2a617e7d9e945d4b.factory.bridge.near": { decimals: 18, - fractionDigits: 6, + fraction_digits: 6, }, }; const COINS_ENV = {