Compare commits
4 Commits
bc5f88d572
...
175d964b9f
Author | SHA1 | Date | |
---|---|---|---|
175d964b9f | |||
9b1c8c0f09 | |||
3348a99155 | |||
4b1c91b144 |
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ghost-dao-interface",
|
"name": "ghost-dao-interface",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.2.0",
|
"version": "0.2.4",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
@ -220,7 +220,11 @@ const Bridge = ({ chainId, address, config, connect }) => {
|
|||||||
|
|
||||||
const preparedAmount = useMemo(() => {
|
const preparedAmount = useMemo(() => {
|
||||||
try {
|
try {
|
||||||
return BigInt(parseFloat(amount) * Math.pow(10, 18));
|
const result = BigInt(parseFloat(amount) * Math.pow(10, 18));
|
||||||
|
if (result > ghstBalance._value) {
|
||||||
|
return ghstBalance._value;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
} catch {
|
} catch {
|
||||||
return 0n;
|
return 0n;
|
||||||
}
|
}
|
||||||
@ -248,8 +252,8 @@ const Bridge = ({ chainId, address, config, connect }) => {
|
|||||||
setIsPending(true);
|
setIsPending(true);
|
||||||
|
|
||||||
const txHash = await ghost(chainId, address, convertedReceiver, preparedAmount);
|
const txHash = await ghost(chainId, address, convertedReceiver, preparedAmount);
|
||||||
|
|
||||||
await ghstBalanceRefetch();
|
await ghstBalanceRefetch();
|
||||||
|
|
||||||
setReceiver("");
|
setReceiver("");
|
||||||
setAmount("");
|
setAmount("");
|
||||||
setIsPending(false);
|
setIsPending(false);
|
||||||
|
@ -12,53 +12,41 @@ import GhostStyledIcon from "../../components/Icon/GhostIcon";
|
|||||||
import Modal from "../../components/Modal/Modal";
|
import Modal from "../../components/Modal/Modal";
|
||||||
import Paper from "../../components/Paper/Paper";
|
import Paper from "../../components/Paper/Paper";
|
||||||
import TokenStack from "../../components/TokenStack/TokenStack";
|
import TokenStack from "../../components/TokenStack/TokenStack";
|
||||||
|
import { useTokenSymbol } from "../../hooks/tokens";
|
||||||
|
|
||||||
const Stake = ({ chainId, address, isOpened, closeModal, connect }) => {
|
const Stake = ({ chainId, address, isOpened, closeModal, connect }) => {
|
||||||
const [action, setAction] = useState("STAKE");
|
const [action, setAction] = useState("STAKE");
|
||||||
const [upperToken, setUpperToken] = useState("FTSO");
|
|
||||||
const [bottomToken, setBottomToken] = useState("GHST");
|
|
||||||
const [settingsModalOpen, setSettingsModalOpen] = useState(false);
|
const [settingsModalOpen, setSettingsModalOpen] = useState(false);
|
||||||
|
|
||||||
|
const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO");
|
||||||
|
const { symbol: stnkSymbol } = useTokenSymbol(chainId, "STNK");
|
||||||
|
const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST");
|
||||||
|
|
||||||
|
const [upperToken, setUpperToken] = useState(ftsoSymbol);
|
||||||
|
const [bottomToken, setBottomToken] = useState(ghstSymbol);
|
||||||
|
|
||||||
const setSettingsModalOpenInner = (value) => {
|
const setSettingsModalOpenInner = (value) => {
|
||||||
setSettingsModalOpen(value);
|
setSettingsModalOpen(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case (upperToken === "FTSO" && bottomToken === "STNK"):
|
case (upperToken === ftsoSymbol && bottomToken === stnkSymbol):
|
||||||
setAction("STAKE")
|
setAction("STAKE")
|
||||||
break;
|
break;
|
||||||
case (upperToken === "eCSPR" && bottomToken === "sCSPR"):
|
case (upperToken === ftsoSymbol && bottomToken === ghstSymbol):
|
||||||
setAction("STAKE")
|
setAction("STAKE")
|
||||||
break;
|
break;
|
||||||
case (upperToken === "FTSO" && bottomToken === "GHST"):
|
case (upperToken === stnkSymbol && bottomToken === ftsoSymbol):
|
||||||
setAction("STAKE")
|
|
||||||
break;
|
|
||||||
case (upperToken === "eCSPR" && bottomToken === "CSPR"):
|
|
||||||
setAction("STAKE")
|
|
||||||
break;
|
|
||||||
case (upperToken === "STNK" && bottomToken === "FTSO"):
|
|
||||||
setAction("UNSTAKE")
|
setAction("UNSTAKE")
|
||||||
break;
|
break;
|
||||||
case (upperToken === "sCSPR" && bottomToken === "eCSPR"):
|
case (upperToken === ghstSymbol && bottomToken === ftsoSymbol):
|
||||||
setAction("UNSTAKE")
|
setAction("UNSTAKE")
|
||||||
break;
|
break;
|
||||||
case (upperToken === "GHST" && bottomToken === "FTSO"):
|
case (upperToken === stnkSymbol && bottomToken === ghstSymbol):
|
||||||
setAction("UNSTAKE")
|
|
||||||
break;
|
|
||||||
case (upperToken === "CSPR" && bottomToken === "eCSPR"):
|
|
||||||
setAction("UNSTAKE")
|
|
||||||
break;
|
|
||||||
case (upperToken === "STNK" && bottomToken === "GHST"):
|
|
||||||
setAction("WRAP")
|
setAction("WRAP")
|
||||||
break;
|
break;
|
||||||
case (upperToken === "sCSPR" && bottomToken === "CSPR"):
|
case (upperToken === ghstSymbol && bottomToken === stnkSymbol):
|
||||||
setAction("WRAP")
|
|
||||||
break;
|
|
||||||
case (upperToken === "GHST" && bottomToken === "STNK"):
|
|
||||||
setAction("UNWRAP")
|
|
||||||
break;
|
|
||||||
case (upperToken === "CSPR" && bottomToken === "sCSPR"):
|
|
||||||
setAction("UNWRAP")
|
setAction("UNWRAP")
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -19,10 +19,16 @@ const ClaimConfirmationModal = (props) => {
|
|||||||
|
|
||||||
switch (props.action.toUpperCase()) {
|
switch (props.action.toUpperCase()) {
|
||||||
case "FORFEIT":
|
case "FORFEIT":
|
||||||
await forfeit(props.chainId, props.receiver);
|
await forfeit(props.chainId, props.receiver, props.ftsoSymbol);
|
||||||
break;
|
break;
|
||||||
case "CLAIM":
|
case "CLAIM":
|
||||||
await claim(props.chainId, props.receiver, props.outputToken === "STNK" || props.outputToken === "sCSPR");
|
await claim(
|
||||||
|
props.chainId,
|
||||||
|
props.receiver,
|
||||||
|
props.outputToken === props.stnkSymbol,
|
||||||
|
props.stnkSymbol,
|
||||||
|
props.ghstSymbol
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log("Unknown action")
|
console.log("Unknown action")
|
||||||
@ -55,7 +61,7 @@ const ClaimConfirmationModal = (props) => {
|
|||||||
/>
|
/>
|
||||||
<Box display="flex" flexDirection="row" justifyContent="center">
|
<Box display="flex" flexDirection="row" justifyContent="center">
|
||||||
<Typography>
|
<Typography>
|
||||||
{props.outputTokenName}
|
{props.outputToken}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -88,8 +88,10 @@ export const ClaimsArea = ({ chainId, address, epoch }) => {
|
|||||||
chainid={chainId}
|
chainid={chainId}
|
||||||
receiver={address}
|
receiver={address}
|
||||||
receiveAmount={claim.expiry > epoch.number ? claim.deposit : isPayoutGhst ? balanceForShares.div(currentIndex) : balanceForShares}
|
receiveAmount={claim.expiry > epoch.number ? claim.deposit : isPayoutGhst ? balanceForShares.div(currentIndex) : balanceForShares}
|
||||||
outputToken={claim.expiry > epoch.number ? "FTSO" : isPayoutGhst ? "GHST" : "STNK"}
|
outputToken={claim.expiry > epoch.number ? ftsoSymbol : isPayoutGhst ? ghstSymbol : stnkSymbol}
|
||||||
outputTokenName={claim.expiry > epoch.number ? ftsoSymbol : isPayoutGhst ? ghstSymbol : stnkSymbol}
|
stnkSymbol={stnkSymbol}
|
||||||
|
ghstSymbol={ghstSymbol}
|
||||||
|
ftsoSymbol={ftsoSymbol}
|
||||||
action={claim.expiry > epoch.number ? "forfeit" : "claim"}
|
action={claim.expiry > epoch.number ? "forfeit" : "claim"}
|
||||||
chainId={chainId}
|
chainId={chainId}
|
||||||
/>
|
/>
|
||||||
|
@ -71,18 +71,46 @@ const StakeConfirmationModal = (props) => {
|
|||||||
|
|
||||||
switch (props.action) {
|
switch (props.action) {
|
||||||
case "STAKE":
|
case "STAKE":
|
||||||
isRebase = props.bottomToken.toUpperCase() === "STNK";
|
isRebase = props.bottomToken === props.stnkSymbol;
|
||||||
await stake(props.chainId, props.address, actionAmount._value.toBigInt(), isRebase, props.isClaim);
|
await stake(
|
||||||
|
props.chainId,
|
||||||
|
props.address,
|
||||||
|
actionAmount._value.toBigInt(),
|
||||||
|
isRebase,
|
||||||
|
props.isClaim,
|
||||||
|
props.ftsoSymbol,
|
||||||
|
props.stnkSymbol,
|
||||||
|
props.ghstSymbol
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case "UNSTAKE":
|
case "UNSTAKE":
|
||||||
isRebase = props.upperToken.toUpperCase() === "STNK";
|
isRebase = props.upperToken === stnkSymbol;
|
||||||
await unstake(props.chainId, props.address, actionAmount._value.toBigInt(), props.isTrigger, isRebase);
|
await unstake(
|
||||||
|
props.chainId,
|
||||||
|
props.address,
|
||||||
|
actionAmount._value.toBigInt(),
|
||||||
|
props.isTrigger,
|
||||||
|
isRebase,
|
||||||
|
props.ftsoSymbol,
|
||||||
|
props.stnkSymbol,
|
||||||
|
props.ghstSymbol
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case "WRAP":
|
case "WRAP":
|
||||||
await wrap(props.chainId, props.address, actionAmount._value.toBigInt());
|
await wrap(
|
||||||
|
props.chainId,
|
||||||
|
props.address,
|
||||||
|
actionAmount._value.toBigInt(),
|
||||||
|
props.ghstSymbol
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case "UNWRAP":
|
case "UNWRAP":
|
||||||
await unwrap(props.chainId, props.address, actionAmount._value.toBigInt());
|
await unwrap(
|
||||||
|
props.chainId,
|
||||||
|
props.address,
|
||||||
|
actionAmount._value.toBigInt(),
|
||||||
|
props.stnkSymbol
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log("Wrong action to be executed!");
|
console.log("Wrong action to be executed!");
|
||||||
@ -115,7 +143,7 @@ const StakeConfirmationModal = (props) => {
|
|||||||
/>
|
/>
|
||||||
<Box display="flex" flexDirection="row" justifyContent="center">
|
<Box display="flex" flexDirection="row" justifyContent="center">
|
||||||
<Typography>
|
<Typography>
|
||||||
{props.upperToken === "FTSO" ? props.ftsoSymbol : props.upperToken === "STNK" ? props.stnkSymbol : props.ghstSymbol}
|
{props.upperToken}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
@ -127,7 +155,7 @@ const StakeConfirmationModal = (props) => {
|
|||||||
/>
|
/>
|
||||||
<Box display="flex" flexDirection="row" justifyContent="center">
|
<Box display="flex" flexDirection="row" justifyContent="center">
|
||||||
<Typography>
|
<Typography>
|
||||||
{props.bottomToken === "FTSO" ? props.ftsoSymbol : props.bottomToken === "STNK" ? props.stnkSymbol : props.ghstSymbol}
|
{props.bottomToken}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
@ -141,7 +169,7 @@ const StakeConfirmationModal = (props) => {
|
|||||||
owner={props.address}
|
owner={props.address}
|
||||||
spender={STAKING_ADDRESSES[props.chainId]}
|
spender={STAKING_ADDRESSES[props.chainId]}
|
||||||
decimals={props.spendDecimals}
|
decimals={props.spendDecimals}
|
||||||
approvalText={"Approve " + props.upperToken === "FTSO" ? props.ftsoSymbol : props.upperToken === "STNK" ? props.stnkSymbol : props.ghstSymbol}
|
approvalText={`Approve ${props.upperToken}`}
|
||||||
approvalPendingText={"Approving..."}
|
approvalPendingText={"Approving..."}
|
||||||
connect={props.connect}
|
connect={props.connect}
|
||||||
isVertical
|
isVertical
|
||||||
|
@ -129,33 +129,33 @@ export const StakeInputArea = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const innerBalance = upperToken === "GHST" ?
|
const innerBalance = upperToken === ghstSymbol ?
|
||||||
ghstBalance
|
ghstBalance
|
||||||
:
|
:
|
||||||
upperToken === "STNK" ?
|
upperToken === stnkSymbol ?
|
||||||
stnkBalance
|
stnkBalance
|
||||||
:
|
:
|
||||||
ftsoBalance;
|
ftsoBalance;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(upperToken === "FTSO" && bottomToken === "STNK") ||
|
(upperToken === ftsoSymbol && bottomToken === stnkSymbol) ||
|
||||||
(upperToken === "STNK" && bottomToken === "FTSO")
|
(upperToken === stnkSymbol && bottomToken === ftsoSymbol)
|
||||||
) {
|
) {
|
||||||
setReceiveAmount(amount);
|
setReceiveAmount(amount);
|
||||||
setExceedsAmount(new DecimalBigNumber(amount, 9).gt(innerBalance))
|
setExceedsAmount(new DecimalBigNumber(amount, 9).gt(innerBalance))
|
||||||
} else {
|
} else {
|
||||||
const decimals = upperToken === "GHST" ? 18 : 9;
|
const decimals = upperToken === ghstSymbol ? 18 : 9;
|
||||||
const raw = new DecimalBigNumber(amount, decimals);
|
const raw = new DecimalBigNumber(amount, decimals);
|
||||||
const amountIn = new DecimalBigNumber(raw._value.toBigInt(), decimals);
|
const amountIn = new DecimalBigNumber(raw._value.toBigInt(), decimals);
|
||||||
const result = upperToken === "GHST" ?
|
const result = upperToken === ghstSymbol ?
|
||||||
currentIndex.mul(amountIn).toString()
|
currentIndex.mul(amountIn).toString()
|
||||||
:
|
:
|
||||||
currentIndex._value > 0n ? amountIn.div(currentIndex).toString() : "0";
|
currentIndex._value > 0n ? amountIn.div(currentIndex).toString() : "0";
|
||||||
|
|
||||||
const innerBalance = upperToken === "GHST" ?
|
const innerBalance = upperToken === ghstSymbol ?
|
||||||
ghstBalance
|
ghstBalance
|
||||||
:
|
:
|
||||||
upperToken === "STNK" ?
|
upperToken === stnkSymbol ?
|
||||||
stnkBalance
|
stnkBalance
|
||||||
:
|
:
|
||||||
ftsoBalance;
|
ftsoBalance;
|
||||||
@ -168,7 +168,7 @@ export const StakeInputArea = ({
|
|||||||
const handleTokenModalInput = (value, isUpper) => {
|
const handleTokenModalInput = (value, isUpper) => {
|
||||||
if (isUpper) {
|
if (isUpper) {
|
||||||
if (value === bottomToken) {
|
if (value === bottomToken) {
|
||||||
const newValue = value === "GHST" ? "STNK" : "GHST";
|
const newValue = value === ghstSymbol ? stnkSymbol : ghstSymbol;
|
||||||
setBottomToken(newValue)
|
setBottomToken(newValue)
|
||||||
}
|
}
|
||||||
setUpperToken(value);
|
setUpperToken(value);
|
||||||
@ -185,28 +185,19 @@ export const StakeInputArea = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SwapCardTemplate = (tokenName, tokenAmount, isUpper, handleModal) => {
|
const SwapCardTemplate = (tokenName, tokenAmount, isUpper, handleModal) => {
|
||||||
const balance = tokenName === "STNK" || tokenName === "sCSPR" ?
|
const balance = tokenName === stnkSymbol
|
||||||
stnkBalance : tokenName === "FTSO" || tokenName === "eCSPR" ?
|
? stnkBalance
|
||||||
ftsoBalance : ghstBalance;
|
: tokenName === ftsoSymbol ? ftsoBalance : ghstBalance;
|
||||||
|
|
||||||
let realTokenName = "";
|
let realTokenName = "";
|
||||||
switch (tokenName.toUpperCase()) {
|
switch (tokenName.toUpperCase()) {
|
||||||
case "FTSO":
|
case ftsoSymbol:
|
||||||
realTokenName = ftsoSymbol;
|
realTokenName = ftsoSymbol;
|
||||||
break;
|
break;
|
||||||
case "ECSPR":
|
case stnkSymbol:
|
||||||
realTokenName = ftsoSymbol;
|
|
||||||
break;
|
|
||||||
case "STNK":
|
|
||||||
realTokenName = stnkSymbol;
|
realTokenName = stnkSymbol;
|
||||||
break;
|
break;
|
||||||
case "SCSPR":
|
case ghstSymbol:
|
||||||
realTokenName = stnkSymbol;
|
|
||||||
break;
|
|
||||||
case "GHST":
|
|
||||||
realTokenName = ghstSymbol;
|
|
||||||
break;
|
|
||||||
case "CSPR":
|
|
||||||
realTokenName = ghstSymbol;
|
realTokenName = ghstSymbol;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -320,8 +311,8 @@ export const StakeInputArea = ({
|
|||||||
receiveAmount={receiveAmount}
|
receiveAmount={receiveAmount}
|
||||||
amountExceedsBalance={exceedsAmount}
|
amountExceedsBalance={exceedsAmount}
|
||||||
connect={connect}
|
connect={connect}
|
||||||
spendDecimals={upperToken === "GHST" ? 18 : 9}
|
spendDecimals={upperToken === ghstSymbol ? 18 : 9}
|
||||||
receiveDecimals={bottomToken === "GHST" ? 18 : 9}
|
receiveDecimals={bottomToken === ghstSymbol ? 18 : 9}
|
||||||
isClaim={isClaim}
|
isClaim={isClaim}
|
||||||
isTrigger={isTrigger}
|
isTrigger={isTrigger}
|
||||||
ftsoSymbol={ftsoSymbol}
|
ftsoSymbol={ftsoSymbol}
|
||||||
|
@ -69,9 +69,9 @@ const TokenModal = ({
|
|||||||
</Link>
|
</Link>
|
||||||
</Box>
|
</Box>
|
||||||
<List>
|
<List>
|
||||||
{<TokenItem isUpper={isUpper} exclude={tokenToExclude} token="FTSO" name={ftsoSymbol} balance={ftsoBalance} />}
|
{<TokenItem isUpper={isUpper} exclude={tokenToExclude} token={ftsoSymbol} name={ftsoSymbol} balance={ftsoBalance} />}
|
||||||
{<TokenItem isUpper={isUpper} exclude={tokenToExclude} token="STNK" name={stnkSymbol} balance={stnkBalance} />}
|
{<TokenItem isUpper={isUpper} exclude={tokenToExclude} token={stnkSymbol} name={stnkSymbol} balance={stnkBalance} />}
|
||||||
{<TokenItem isUpper={isUpper} exclude={tokenToExclude} token="GHST" name={ghstSymbol} balance={ghstBalance} />}
|
{<TokenItem isUpper={isUpper} exclude={tokenToExclude} token={ghstSymbol} name={ghstSymbol} balance={ghstBalance} />}
|
||||||
</List>
|
</List>
|
||||||
</Box>
|
</Box>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
@ -113,7 +113,7 @@ export const useGhostedSupply = (chainId) => {
|
|||||||
return ghostedSupply;
|
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 = [
|
const args = [
|
||||||
amount,
|
amount,
|
||||||
account,
|
account,
|
||||||
@ -122,7 +122,7 @@ export const stake = async (chainId, account, amount, isRebase, isClaim) => {
|
|||||||
];
|
];
|
||||||
const messages = {
|
const messages = {
|
||||||
replacedMsg: "Staking transaction was replaced. Wait for inclusion please.",
|
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.",
|
errorMsg: "Staking transaction failed. Check logs for error detalization.",
|
||||||
};
|
};
|
||||||
await executeOnChainTransaction(
|
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 = [
|
const args = [
|
||||||
amount,
|
amount,
|
||||||
account,
|
account,
|
||||||
@ -143,7 +143,7 @@ export const unstake = async (chainId, account, amount, isTrigger, isRebase) =>
|
|||||||
];
|
];
|
||||||
const messages = {
|
const messages = {
|
||||||
replacedMsg: "Unstake transaction was replaced. Wait for inclusion please.",
|
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.",
|
errorMsg: "Unstake transaction failed. Check logs for error detalization.",
|
||||||
};
|
};
|
||||||
await executeOnChainTransaction(
|
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 = {
|
const messages = {
|
||||||
replacedMsg: "Forfeit transaction was replaced. Wait for inclusion please.",
|
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.",
|
errorMsg: "Forfeit transaction failed. Check logs for error detalization.",
|
||||||
};
|
};
|
||||||
await executeOnChainTransaction(
|
await executeOnChainTransaction(
|
||||||
@ -170,11 +170,11 @@ export const forfeit = async (chainId, account) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const claim = async (chainId, account, isStnk) => {
|
export const claim = async (chainId, account, isStnk, stnkSymbol, ghstSymbol) => {
|
||||||
const args = [account, isStnk];
|
const args = [account, isStnk];
|
||||||
const messages = {
|
const messages = {
|
||||||
replacedMsg: "Claim transaction was replaced. Wait for inclusion please.",
|
replacedMsg: "Claim transaction was replaced. Wait for inclusion please.",
|
||||||
successMsg: `${isStnk ? "STNK" : "GHST"} tokens claimed successfully to ${shorten(account)}.`,
|
successMsg: `${isStnk ? stnkSymbol : ghstSymbol} tokens claimed successfully to ${shorten(account)}.`,
|
||||||
errorMsg: "Claim transaction failed. Check logs for error detalization.",
|
errorMsg: "Claim transaction failed. Check logs for error detalization.",
|
||||||
};
|
};
|
||||||
await executeOnChainTransaction(
|
await executeOnChainTransaction(
|
||||||
@ -186,10 +186,10 @@ export const claim = async (chainId, account, isStnk) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const unwrap = async (chainId, account, amount) => {
|
export const unwrap = async (chainId, account, amount, stnkSymbol) => {
|
||||||
const messages = {
|
const messages = {
|
||||||
replacedMsg: "Unwrap transaction was replaced. Wait for inclusion please.",
|
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.",
|
errorMsg: "Unwrap transaction failed. Check logs for error detalization.",
|
||||||
};
|
};
|
||||||
await executeOnChainTransaction(
|
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 = {
|
const messages = {
|
||||||
replacedMsg: "Wrap transaction was replaced. Wait for inclusion please.",
|
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.",
|
errorMsg: "Wrap transaction failed. Check logs for error detalization.",
|
||||||
};
|
};
|
||||||
await executeOnChainTransaction(
|
await executeOnChainTransaction(
|
||||||
|
Loading…
Reference in New Issue
Block a user