diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1b00d5..e8992b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,4 +38,4 @@ jobs: # run: npm run test - name: Prepare production build - run: npm run build:milkomeda-c1-testnet + run: npm run build diff --git a/.github/workflows/codepreview.yml b/.github/workflows/codepreview.yml index 10e9507..5779b11 100644 --- a/.github/workflows/codepreview.yml +++ b/.github/workflows/codepreview.yml @@ -2,9 +2,9 @@ name: Create preview environment on: pull_request: - branches: [main, milkomeda-c1-testnet] + branches: [main] push: - branches: [main, milkomeda-c1-testnet] + branches: [main] concurrency: # The preview script can't handle concurrent deploys @@ -55,6 +55,11 @@ jobs: if: ${{ (github.head_ref || github.ref_name) == 'main' }} run: CI=false npm run build:milkomeda-c1 + # CI=false disables reporting warnings as errors + - name: Prepare build (main) + if: ${{ (github.head_ref || github.ref_name) == 'main' }} + run: CI=false npm run build:shu-mordor + - name: Create SSH key run: | mkdir -p ~/.ssh/ diff --git a/env/milkomeda-testnet.env b/env/milkomeda-testnet.env index ee477df..d840003 100644 --- a/env/milkomeda-testnet.env +++ b/env/milkomeda-testnet.env @@ -6,7 +6,7 @@ REACT_APP_CHAIN_ID=200101 REACT_APP_DJED_ADDRESS=0xc4C0669Ea7BFF70A6cFa5905A0Ba487fC181Dc37 REACT_APP_FEE_UI=0 REACT_APP_UI=0x0232556C83791b8291E9b23BfEa7d67405Bd9839 -REACT_APP_MILKOMEDA_C1_EXPLORER=https://explorer-devnet-cardano-evm.c1.milkomeda.com/ +REACT_APP_EXPLORER=https://explorer-devnet-cardano-evm.c1.milkomeda.com/ REACT_APP_BC=Milkomeda REACT_APP_PROTOCOL_CHAIN_DESCRIPTION=Milkomeda is the EVM-compatible chain of the Cardano ecosystem. Its native currency is mADA, a bridged version of Cardano`s ADA REACT_APP_CHAIN_COIN=mADA diff --git a/env/milkomeda.env b/env/milkomeda.env index 1a9fe52..66de6ad 100644 --- a/env/milkomeda.env +++ b/env/milkomeda.env @@ -6,7 +6,7 @@ REACT_APP_CHAIN_ID=2001 REACT_APP_DJED_ADDRESS=0x67A30B399F5Ed499C1a6Bc0358FA6e42Ea4BCe76 REACT_APP_FEE_UI=0.01 REACT_APP_UI=0x6AfD84920971Ba96118a302deaA6d11e7ce18b03 -REACT_APP_MILKOMEDA_C1_EXPLORER=https://explorer-mainnet-cardano-evm.c1.milkomeda.com/ +REACT_APP_EXPLORER=https://explorer-mainnet-cardano-evm.c1.milkomeda.com/ REACT_APP_BC=Milkomeda REACT_APP_PROTOCOL_CHAIN_DESCRIPTION=Milkomeda is the EVM-compatible chain of the Cardano ecosystem. Its native currency is mADA, a bridged version of Cardano`s ADA REACT_APP_CHAIN_COIN=mADA diff --git a/env/shu-mordor.env b/env/shu-mordor.env index c91f6a6..646f4c8 100644 --- a/env/shu-mordor.env +++ b/env/shu-mordor.env @@ -3,8 +3,8 @@ ############### REACT_APP_BLOCKCHAIN_URI=https://rpc.mordor.etccooperative.org REACT_APP_CHAIN_ID=63 -REACT_APP_DJED_ADDRESS=0x7535E14d98c8a8744DcFe216Aa0af3b95c76a5E3 -REACT_APP_DJED_SHU_ADDRESS=0x7535E14d98c8a8744DcFe216Aa0af3b95c76a5E3 +REACT_APP_DJED_ADDRESS=0x1F09D7d259073414a81E5663C74a76182B05852D +REACT_APP_DJED_SHU_ADDRESS=0x1F09D7d259073414a81E5663C74a76182B05852D REACT_APP_FEE_UI=0 REACT_APP_UI=0x0232556C83791b8291E9b23BfEa7d67405Bd9839 REACT_APP_EXPLORER=https://etc-mordor.blockscout.com/ @@ -16,8 +16,8 @@ REACT_APP_SC_SYMBOL=ECSD REACT_APP_RC_NAME=Ethereum Classic Reserve Surplus Share REACT_APP_RC_SYMBOL=ECRS REACT_APP_LIMIT_PER_TXN=10000 -REACT_APP_EVM_RESERVECOIN_ADDRESS=0x81D6C9F0dd8823Ae664B9E43e25Bf3e6A79dC351 -REACT_APP_EVM_STABLECOIN_ADDRESS=0x4746e9c3cB00f70Af6e25a699AE3490e43207Fd9 +REACT_APP_EVM_RESERVECOIN_ADDRESS=0x851D24a058fED2b0458c875BFb512BAc04dDeE09 +REACT_APP_EVM_STABLECOIN_ADDRESS=0x6b7ff59Ddb17610146c2666Dd6eB402b3BC5C59D # Color Theme REACT_APP_GRADIENT_THEME='gradient-theme-7' diff --git a/package.json b/package.json index c2ae888..c2b76fd 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,9 @@ "scripts": { "start": "craco start", "build": "craco build", - "build:milkomeda-testnet": "npx -y env-cmd -f ./env/milkomeda-testnet.env npm run build", + "build:milkomeda-c1-testnet": "npx -y env-cmd -f ./env/milkomeda-testnet.env npm run build", "build:sepolia": "npx -y env-cmd -f ./env/sepolia.env npm run build", - "build:milkomeda": "npx -y env-cmd -f ./env/milkomeda.env npm run build", + "build:milkomeda-c1": "npx -y env-cmd -f ./env/milkomeda.env npm run build", "build:mordor": "npx -y env-cmd -f ./env/mordor.env npm run build", "build:ethereum-classic": "npx -y env-cmd -f ./env/ethereum-classic.env npm run build", "build:shu-mordor": "npx -y env-cmd -f ./env/shu-mordor.env npm run build", diff --git a/src/components/molecules/CoinCard/CoinCard.jsx b/src/components/molecules/CoinCard/CoinCard.jsx index 3ebfeed..e5292a6 100644 --- a/src/components/molecules/CoinCard/CoinCard.jsx +++ b/src/components/molecules/CoinCard/CoinCard.jsx @@ -9,6 +9,8 @@ const CoinCard = ({ coinIcon, coinName, priceAmount, + minPriceAmount, + maxPriceAmount, sellPriceAmount, circulatingAmount, tokenName, @@ -38,14 +40,14 @@ const CoinCard = ({
Current Minimum Price

- {priceAmount} {CHAIN_COIN} + {minPriceAmount} {CHAIN_COIN}

Current Maximum Price

- {priceAmount} {CHAIN_COIN} + {maxPriceAmount} {CHAIN_COIN}

diff --git a/src/components/molecules/ReservesCard/ReservesCard.jsx b/src/components/molecules/ReservesCard/ReservesCard.jsx index 3c4bdca..4d5f893 100644 --- a/src/components/molecules/ReservesCard/ReservesCard.jsx +++ b/src/components/molecules/ReservesCard/ReservesCard.jsx @@ -13,7 +13,8 @@ const ReservesCard = ({ reserveRatio, reserveRatioMin, reserveRatioMax, - showCurrentReserveRatio + showCurrentReserveRatio, + isShu }) => (
@@ -30,7 +31,10 @@ const ReservesCard = ({ {showCurrentReserveRatio && ( - + )}
diff --git a/src/routes/protocol.jsx b/src/routes/protocol.jsx index c3888a6..39fc767 100644 --- a/src/routes/protocol.jsx +++ b/src/routes/protocol.jsx @@ -51,7 +51,11 @@ export default function Protocol() { . Here you can interact with a{" "} @@ -116,6 +120,7 @@ export default function Protocol() { reserveRatioMin={systemParams?.reserveRatioMin} reserveRatioMax={systemParams?.reserveRatioMax} showCurrentReserveRatio={Number(coinsDetails?.unscaledNumberSc) > 0} + isShu={isShu} /> diff --git a/src/utils/ethereum.js b/src/utils/ethereum.js index ff35b2c..7c21f88 100644 --- a/src/utils/ethereum.js +++ b/src/utils/ethereum.js @@ -163,7 +163,6 @@ export const getShuCoinDetails = async ( scDecimals, rcDecimals ) => { - console.log(await web3Promise(djed, "rcBuyingPrice", 0)); const [ [scaledNumberSc, unscaledNumberSc], [scaledMinPriceSc, unscaledMinPriceSc], @@ -183,10 +182,10 @@ export const getShuCoinDetails = async ( let scaledSellPriceRc = emptyValue; let unscaledSellPriceRc = emptyValue; let percentReserveRatio = emptyValue; - const scaledScExchangeRate = scaledPromise( - (unscaledMinPriceSc + unscaledMaxPriceSc) / 2, - BC_DECIMALS - ); + const scaledScExchangeRate = ( + (parseFloat(scaledMinPriceSc) + parseFloat(scaledMaxPriceSc)) / + 2 + ).toString(); //Check total stablecoin supply if (!BigNumber.from(unscaledNumberRc).isZero()) { @@ -197,10 +196,10 @@ export const getShuCoinDetails = async ( } //Check total reservecoin supply if (!BigNumber.from(unscaledNumberSc).isZero()) { - percentReserveRatio = await percentScaledPromise( - web3Promise(djed, "ratio"), - SCALING_DECIMALS - ); + percentReserveRatio = [ + await percentScaledPromise(web3Promise(djed, "ratioMin"), SCALING_DECIMALS), + await percentScaledPromise(web3Promise(djed, "ratioMax"), SCALING_DECIMALS) + ]; } return { scaledNumberSc, @@ -668,16 +667,16 @@ const calculateFuturePrice = async ({ web3Promise(djedContract, "R", 0) ]); + const price = readPriceMethod === "readData" ? scTargetPrice : scTargetPrice[0]; + const futureScSupply = BigNumber.from(scSupply).add(BigNumber.from(amountSC)); const futureRatio = BigNumber.from(ratio).add(BigNumber.from(amountBC)); if (futureScSupply.isZero()) { - return scTargetPrice; + return price; } else { const futurePrice = futureRatio.mul(scDecimalScalingFactor).div(futureScSupply); - return BigNumber.from(scTargetPrice).lt(futurePrice) - ? scTargetPrice - : futurePrice.toString(); + return BigNumber.from(price).lt(futurePrice) ? price : futurePrice.toString(); } } catch (error) { console.log("calculateFuturePrice error", error);