Skip to content

Commit

Permalink
added complete flow + update contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
0xlinus committed Sep 12, 2023
1 parent 73967aa commit 791cc87
Show file tree
Hide file tree
Showing 10 changed files with 377 additions and 29 deletions.
4 changes: 2 additions & 2 deletions pages/burn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import BurnAelin from '@/src/components/burn/BurnAelin'
import { LeftSidebarLayout } from '@/src/components/layout/LeftSidebarLayout'
import { SectionIntro } from '@/src/components/section/SectionIntro'

const Stats: NextPage = () => {
const Burn: NextPage = () => {
return (
<>
<Head>
Expand All @@ -29,4 +29,4 @@ const Stats: NextPage = () => {
)
}

export default Stats
export default Burn
318 changes: 318 additions & 0 deletions src/abis/SwapAelin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,318 @@
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "NftAlreadySet",
"type": "error"
},
{
"inputs": [],
"name": "NftNotSet",
"type": "error"
},
{
"inputs": [],
"name": "NoSwapNFT",
"type": "error"
},
{
"inputs": [],
"name": "WithdrawWindowClosed",
"type": "error"
},
{
"inputs": [],
"name": "ZeroAddress",
"type": "error"
},
{
"inputs": [],
"name": "ZeroAmount",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "aelinAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "usdcAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "veKwentaAmount",
"type": "uint256"
}
],
"name": "TokenSwapped",
"type": "event"
},
{
"inputs": [],
"name": "AELIN",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "AELIN_SUPPLY",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "BURN_ADDRESS",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "USDC",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "USDC_SUPPLY",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "VEKWENTA",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "VEKWENTA_SUPPLY",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "WITHDRAW_WINDOW",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "burn",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "getSwapAmount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_swapNFT",
"type": "address"
}
],
"name": "setNft",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "start",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "swapNFT",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_token",
"type": "address"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
4 changes: 2 additions & 2 deletions src/components/burn/BurnAelin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CardTitle, CardWithTitle } from '../common/CardWithTitle'
import Approve from '../pools/actions/Approve'
import { genericSuspense } from '@/src/components/helpers/SafeSuspense'
import { contracts } from '@/src/constants/contracts'
import { BURN_AELIN_CONTRACT } from '@/src/constants/misc'
import { RequiredConnection } from '@/src/hooks/requiredConnection'
import { BurnAelinState, useBurnAelin } from '@/src/providers/burnAelinProvider'
import { useWeb3Connection } from '@/src/providers/web3ConnectionProvider'
Expand Down Expand Up @@ -54,8 +55,7 @@ const BurnAelin: React.FC = () => {
allowance={formatToken(userBalance, 18, 4)}
description="Approve your AELIN tokens to be moved by our swap contract"
refetchAllowance={refetchUserAllowance}
// TODO: change to real contract address
spender={'swap-contract'}
spender={BURN_AELIN_CONTRACT}
symbol="AELIN"
title="Approve AELIN tokens"
tokenAddress={tokenAddress}
Expand Down
4 changes: 2 additions & 2 deletions src/components/burn/MintNft.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const MintNFT: React.FC = () => {
To retrieve your share of treasury assets, you must first agree to a waiver, a copy of which
you can read{' '}
<Link
href="https://v2.akord.com/public/vaults/active/2KzfEiio_umg2tFNymCwSp6qt7Yu4phwvqlsQ1b9u4s/gallery#public/df629071-3d77-4538-af9f-c9a6df2897dc"
href="https://v2.akord.com/public/vaults/active/boPGU8ShKj0KAcud8BLrzFGEkaIx5WlnBsVVhETG4ME/gallery#public/896532a7-b257-4997-8cf8-302435a915bb"
target="_blank"
>
here
Expand All @@ -53,7 +53,7 @@ const MintNFT: React.FC = () => {
the terms of the waiver.
</Contents>
<ButtonsWrapper>
<ButtonGradient disabled={!isSubmitting} onClick={handleMint}>
<ButtonGradient disabled={isSubmitting} onClick={handleMint}>
Mint NFT
</ButtonGradient>
</ButtonsWrapper>
Expand Down
4 changes: 3 additions & 1 deletion src/components/burn/Success.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import Link from 'next/link'

import { Contents, Wrapper } from '../pools/actions/Wrapper'
import { genericSuspense } from '@/src/components/helpers/SafeSuspense'
import { useBurnAelin } from '@/src/providers/burnAelinProvider'

const SwapAelinToken: React.FC = () => {
const { swapTransactionHash } = useBurnAelin()
return (
<Wrapper title={`Tokens swapped!`}>
<Contents>
You have successfully swapped all your AELIN tokens.
<br /> For more information you can check the{' '}
<Link href="https://optimistic.etherscan.io/tx/some-txs" target="_blank">
<Link href={`https://optimistic.etherscan.io/tx/${swapTransactionHash}`} target="_blank">
transaction receipt.
</Link>
</Contents>
Expand Down
Loading

0 comments on commit 791cc87

Please sign in to comment.