Skip to content

Commit

Permalink
Add mainnet contract abi
Browse files Browse the repository at this point in the history
  • Loading branch information
VegeBun-csj committed Sep 21, 2024
1 parent 02028a0 commit 243d94a
Show file tree
Hide file tree
Showing 6 changed files with 13,691 additions and 485 deletions.
13,824 changes: 13,581 additions & 243 deletions src/constants/abi/bridgeContractAbi.json

Large diffs are not rendered by default.

103 changes: 103 additions & 0 deletions src/constants/abi/ethDORAContractAbi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
[
{
"inputs": [{ "internalType": "address", "name": "_founder", "type": "address" }],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "_owner", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "_spender", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "_value", "type": "uint256" }
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "_from", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "_to", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "_value", "type": "uint256" }
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{ "internalType": "address", "name": "_owner", "type": "address" },
{ "internalType": "address", "name": "_spender", "type": "address" }
],
"name": "allowance",
"outputs": [{ "internalType": "uint256", "name": "remaining", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_spender", "type": "address" },
{ "internalType": "uint256", "name": "_value", "type": "uint256" }
],
"name": "approve",
"outputs": [{ "internalType": "bool", "name": "success", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "_owner", "type": "address" }],
"name": "balanceOf",
"outputs": [{ "internalType": "uint256", "name": "balance", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [{ "internalType": "uint256", "name": "supply", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_to", "type": "address" },
{ "internalType": "uint256", "name": "_value", "type": "uint256" }
],
"name": "transfer",
"outputs": [{ "internalType": "bool", "name": "success", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_from", "type": "address" },
{ "internalType": "address", "name": "_to", "type": "address" },
{ "internalType": "uint256", "name": "_value", "type": "uint256" }
],
"name": "transferFrom",
"outputs": [{ "internalType": "bool", "name": "success", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
}
]
235 changes: 0 additions & 235 deletions src/constants/abi/ethINFContractAbi.json

This file was deleted.

4 changes: 2 additions & 2 deletions src/constants/abi/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bridgeContractAbi from './bridgeContractAbi.json';
import ethINFContractAbi from './ethINFContractAbi.json';
import ethDORAContractAbi from './ethDORAContractAbi.json';

export { bridgeContractAbi, ethINFContractAbi };
export { bridgeContractAbi, ethDORAContractAbi };
6 changes: 3 additions & 3 deletions src/hooks/migrate/useTokenAllowance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import BigNumber from 'bignumber.js';

import { useContractWrite, useContractRead, useWaitForTransaction } from 'wagmi';

import { ethINFContractAbi } from '@/constants/abi';
import { ethDORAContractAbi } from '@/constants/abi';
import { TOKEN_DECIMAL_SHIFT } from '@/constants/migrate';

import { MustBigNumber } from '@/lib/numbers';
Expand All @@ -29,7 +29,7 @@ export const useTokenAllowance = ({

const { data: needTokenAllowance, refetch } = useContractRead({
address: import.meta.env.VITE_ETH_DORA_ADDRESSS,
abi: ethINFContractAbi,
abi: ethDORAContractAbi,
functionName: 'allowance',
args: [evmAddress, import.meta.env.VITE_BRIDGE_CONTRACT_ADDRESS],
chainId: Number(import.meta.env.VITE_ETH_CHAIN_ID),
Expand All @@ -49,7 +49,7 @@ export const useTokenAllowance = ({
error
} = useContractWrite({
address: import.meta.env.VITE_ETH_DORA_ADDRESSS,
abi: ethINFContractAbi,
abi: ethDORAContractAbi,
functionName: 'approve',
args: [
import.meta.env.VITE_BRIDGE_CONTRACT_ADDRESS,
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useAccountBalance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useContext, createContext } from 'react';
import { useSelector } from 'react-redux';
import { useQuery } from 'react-query';
import { useBalance, useContractRead } from 'wagmi';
import { ethINFContractAbi } from '@/constants/abi';
import { ethDORAContractAbi } from '@/constants/abi';

import { TOKEN_DECIMAL_SHIFT } from '@/constants/migrate';

Expand Down Expand Up @@ -44,7 +44,7 @@ const useAccountBalanceContext = () => {

const { data: balance, isError, isLoading, refetch } = useContractRead({
address: import.meta.env.VITE_ETH_DORA_ADDRESSS,
abi: ethINFContractAbi,
abi: ethDORAContractAbi,
functionName: 'balanceOf',
args: [evmAddress],
watch: true,
Expand Down

0 comments on commit 243d94a

Please sign in to comment.