Skip to content

Commit

Permalink
chore: detail
Browse files Browse the repository at this point in the history
  • Loading branch information
Holybasil committed Nov 28, 2024
1 parent a710b4c commit 7ed9728
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ REACT_APP_ETHEREUM_YEAR_BADGE_API_URI = "https://genesis-nft-backend-git-sepolia
REACT_APP_BADGE_REGISTRY_URL="https://badge-registry.canvas.scroll.cat/badge-registry"
REACT_APP_BADGE_INDEXER_URL="https://canvas-indexer.scroll.cat"
REACT_APP_ETHEREUM_YEAR_BADGE_ADDRESS = "0xB59B6466B21a089c93B14030AF88b164905a58fd"
REACT_APP_SCR_HOLDING_BADGE_ADDRESS="0xef071708e09becfeac1e3d8afa1602bb6eb57922"
REACT_APP_SCR_HOLDING_BADGE_ADDRESS="0xeF071708e09BECFEac1e3d8AfA1602BB6eB57922"


[context.sepolia.environment]
Expand Down Expand Up @@ -237,7 +237,7 @@ REACT_APP_ETHEREUM_YEAR_BADGE_API_URI = "https://genesis-nft-backend-git-sepolia
REACT_APP_BADGE_REGISTRY_URL="https://badge-registry.canvas.scroll.cat/badge-registry"
REACT_APP_BADGE_INDEXER_URL="https://canvas-indexer.scroll.cat"
REACT_APP_ETHEREUM_YEAR_BADGE_ADDRESS = "0xB59B6466B21a089c93B14030AF88b164905a58fd"
REACT_APP_SCR_HOLDING_BADGE_ADDRESS="0xef071708e09becfeac1e3d8afa1602bb6eb57922"
REACT_APP_SCR_HOLDING_BADGE_ADDRESS="0xeF071708e09BECFEac1e3d8AfA1602BB6eB57922"


[context.mainnet.environment]
Expand Down
56 changes: 28 additions & 28 deletions src/pages/canvas/mint-scr/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const MintScr = () => {
const alertWarning = useSnackbar()
const [scrAmount, setSCRAmount] = useState("")
const [mintLoading, setMintLoading] = useState(false)
const [burnLoading, setBurnLoading] = useState(false)
// const [burnLoading, setBurnLoading] = useState(false)

const handleChangeSCRAmount = e => {
setSCRAmount(sanitizeNumericalString(e.target.value))
Expand Down Expand Up @@ -49,30 +49,30 @@ const MintScr = () => {
}
}

const handleBurnToken = async () => {
if (chainId !== CHAIN_ID.L2) {
alertWarning("please switch to L2")
return
}
try {
setBurnLoading(true)
const signer = await provider?.getSigner(0)
const tokenInterface = new ethers.Contract(SCR_TOKEN_ADDRESS, ERC20ABI, signer)
const amount = amountToBN(scrAmount)
const tx = await tokenInterface.burn(walletCurrentAddress, amount)
const txReceipt = await tx.wait()
if (txReceipt?.status === 1) {
alertWarning(`Burned ${scrAmount} SCR successfully`, "success")
setSCRAmount("")
}
} catch (e) {
if (!isUserRejected(e)) {
alertWarning(e.message)
}
} finally {
setBurnLoading(false)
}
}
// const handleBurnToken = async () => {
// if (chainId !== CHAIN_ID.L2) {
// alertWarning("please switch to L2")
// return
// }
// try {
// setBurnLoading(true)
// const signer = await provider?.getSigner(0)
// const tokenInterface = new ethers.Contract(SCR_TOKEN_ADDRESS, ERC20ABI, signer)
// const amount = amountToBN(scrAmount)
// const tx = await tokenInterface.burn(walletCurrentAddress, amount)
// const txReceipt = await tx.wait()
// if (txReceipt?.status === 1) {
// alertWarning(`Burned ${scrAmount} SCR successfully`, "success")
// setSCRAmount("")
// }
// } catch (e) {
// if (!isUserRejected(e)) {
// alertWarning(e.message)
// }
// } finally {
// setBurnLoading(false)
// }
// }
return (
<Stack direction="column" justifyContent="center" alignItems="center" sx={{ width: "100%", height: `calc(100vh - ${NORMAL_HEADER_HEIGHT})` }}>
<TextField
Expand All @@ -85,12 +85,12 @@ const MintScr = () => {
onChange={handleChangeSCRAmount}
/>
<Stack sx={{ width: "25rem", mt: "2rem" }} gap="2rem">
<PerksButton loading={mintLoading} onClick={handleMintToken}>
<PerksButton loading={mintLoading} disabled={!scrAmount} onClick={handleMintToken}>
Mint
</PerksButton>
<PerksButton loading={burnLoading} onClick={handleBurnToken}>
{/* <PerksButton loading={burnLoading} onClick={handleBurnToken}>
Burn
</PerksButton>
</PerksButton> */}
</Stack>
</Stack>
)
Expand Down

0 comments on commit 7ed9728

Please sign in to comment.