diff --git a/package.json b/package.json index 5c85efb..6f91596 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ghost-dao-interface", "private": true, - "version": "0.2.2", + "version": "0.2.3", "type": "module", "scripts": { "dev": "vite", diff --git a/src/containers/Stake/components/ClaimConfirmationModal.jsx b/src/containers/Stake/components/ClaimConfirmationModal.jsx index a904857..dc2653b 100644 --- a/src/containers/Stake/components/ClaimConfirmationModal.jsx +++ b/src/containers/Stake/components/ClaimConfirmationModal.jsx @@ -19,7 +19,7 @@ const ClaimConfirmationModal = (props) => { switch (props.action.toUpperCase()) { case "FORFEIT": - await forfeit(props.chainId, props.receiver); + await forfeit(props.chainId, props.receiver, props.ftsoSymbol); break; case "CLAIM": await claim( diff --git a/src/containers/Stake/components/ClaimsArea.jsx b/src/containers/Stake/components/ClaimsArea.jsx index 1c006be..6102883 100644 --- a/src/containers/Stake/components/ClaimsArea.jsx +++ b/src/containers/Stake/components/ClaimsArea.jsx @@ -91,6 +91,7 @@ export const ClaimsArea = ({ chainId, address, epoch }) => { outputToken={claim.expiry > epoch.number ? ftsoSymbol : isPayoutGhst ? ghstSymbol : stnkSymbol} stnkSymbol={stnkSymbol} ghstSymbol={ghstSymbol} + ftsoSymbol={ftsoSymbol} action={claim.expiry > epoch.number ? "forfeit" : "claim"} chainId={chainId} /> diff --git a/src/containers/Stake/components/StakeConfirmationModal.jsx b/src/containers/Stake/components/StakeConfirmationModal.jsx index e3e4370..749d9dc 100644 --- a/src/containers/Stake/components/StakeConfirmationModal.jsx +++ b/src/containers/Stake/components/StakeConfirmationModal.jsx @@ -71,18 +71,46 @@ const StakeConfirmationModal = (props) => { switch (props.action) { case "STAKE": - isRebase = props.bottomToken.toUpperCase() === "STNK"; - await stake(props.chainId, props.address, actionAmount._value.toBigInt(), isRebase, props.isClaim); + isRebase = props.bottomToken === props.stnkSymbol; + await stake( + props.chainId, + props.address, + actionAmount._value.toBigInt(), + isRebase, + props.isClaim, + props.ftsoSymbol, + props.stnkSymbol, + props.ghstSymbol + ); break; case "UNSTAKE": - isRebase = props.upperToken.toUpperCase() === "STNK"; - await unstake(props.chainId, props.address, actionAmount._value.toBigInt(), props.isTrigger, isRebase); + isRebase = props.upperToken === stnkSymbol; + await unstake( + props.chainId, + props.address, + actionAmount._value.toBigInt(), + props.isTrigger, + isRebase, + props.ftsoSymbol, + props.stnkSymbol, + props.ghstSymbol + ); break; case "WRAP": - await wrap(props.chainId, props.address, actionAmount._value.toBigInt()); + await wrap( + props.chainId, + props.address, + actionAmount._value.toBigInt(), + props.ghstSymbol + ); break; case "UNWRAP": - await unwrap(props.chainId, props.address, actionAmount._value.toBigInt()); + await unwrap( + props.chainId, + props.address, + actionAmount._value.toBigInt(), + props.stnkSymbol + ); break; default: console.log("Wrong action to be executed!"); diff --git a/src/hooks/staking/index.js b/src/hooks/staking/index.js index 8d533b0..7053a5d 100644 --- a/src/hooks/staking/index.js +++ b/src/hooks/staking/index.js @@ -113,7 +113,7 @@ export const useGhostedSupply = (chainId) => { return ghostedSupply; } -export const stake = async (chainId, account, amount, isRebase, isClaim) => { +export const stake = async (chainId, account, amount, isRebase, isClaim, ftsoSymbol, stnkSymbol, ghstSymbol) => { const args = [ amount, account, @@ -122,7 +122,7 @@ export const stake = async (chainId, account, amount, isRebase, isClaim) => { ]; const messages = { replacedMsg: "Staking transaction was replaced. Wait for inclusion please.", - successMsg: `FTSO tokens staked successfully! Wait for the warmup period to claim your ${isRebase ? "STNK" : "GHST"}.`, + successMsg: `${ftsoSymbol} tokens staked successfully! Wait for the warmup period to claim your ${isRebase ? stnkSymbol : ghstSymbol}.`, errorMsg: "Staking transaction failed. Check logs for error detalization.", }; await executeOnChainTransaction( @@ -134,7 +134,7 @@ export const stake = async (chainId, account, amount, isRebase, isClaim) => { ); } -export const unstake = async (chainId, account, amount, isTrigger, isRebase) => { +export const unstake = async (chainId, account, amount, isTrigger, isRebase, ftsoSymbol, stnkSymbol, ghstSymbol) => { const args = [ amount, account, @@ -143,7 +143,7 @@ export const unstake = async (chainId, account, amount, isTrigger, isRebase) => ]; const messages = { replacedMsg: "Unstake transaction was replaced. Wait for inclusion please.", - successMsg: `${isRebase ? "STNK" : "GHST"} tokens unstaked successfully! Check your FTSO balance on ${shorten(account)}.`, + successMsg: `${isRebase ? stnkSymbol : ghstSymbol} tokens unstaked successfully! Check your ${ftsoSymbol} balance on ${shorten(account)}.`, errorMsg: "Unstake transaction failed. Check logs for error detalization.", }; await executeOnChainTransaction( @@ -155,10 +155,10 @@ export const unstake = async (chainId, account, amount, isTrigger, isRebase) => ); } -export const forfeit = async (chainId, account) => { +export const forfeit = async (chainId, account, ftsoSymbol) => { const messages = { replacedMsg: "Forfeit transaction was replaced. Wait for inclusion please.", - successMsg: `Tokens forfeited successfully! Check your FTSO balance on ${shorten(account)}.`, + successMsg: `Tokens forfeited successfully! Check your ${ftsoSymbol} balance on ${shorten(account)}.`, errorMsg: "Forfeit transaction failed. Check logs for error detalization.", }; await executeOnChainTransaction( @@ -186,10 +186,10 @@ export const claim = async (chainId, account, isStnk, stnkSymbol, ghstSymbol) => ); } -export const unwrap = async (chainId, account, amount) => { +export const unwrap = async (chainId, account, amount, stnkSymbol) => { const messages = { replacedMsg: "Unwrap transaction was replaced. Wait for inclusion please.", - successMsg: `Tokens unwrapped successfully! Check your STNK balance on ${shorten(account)}.`, + successMsg: `Tokens unwrapped successfully! Check your ${stnkSymbol} balance on ${shorten(account)}.`, errorMsg: "Unwrap transaction failed. Check logs for error detalization.", }; await executeOnChainTransaction( @@ -201,10 +201,10 @@ export const unwrap = async (chainId, account, amount) => { ); } -export const wrap = async (chainId, account, amount) => { +export const wrap = async (chainId, account, amount, ghstSymbol) => { const messages = { replacedMsg: "Wrap transaction was replaced. Wait for inclusion please.", - successMsg: `Tokens wrapped successfully! Check your GHST balance on ${shorten(account)}.`, + successMsg: `Tokens wrapped successfully! Check your ${ghstSymbol} balance on ${shorten(account)}.`, errorMsg: "Wrap transaction failed. Check logs for error detalization.", }; await executeOnChainTransaction(