Airdrop working

takehome
Greg Shuflin 3 months ago
parent f4c8da118a
commit e80e2c3907

@ -13,12 +13,13 @@ const web3 = new Web3(Web3.givenProvider);
import Airdrop from "./Airdrop.json";
import MagnaToken from "./MagnaToken.json";
const airdropAddress = "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512";
const airdropContract = new web3.eth.Contract(Airdrop.abi as any, airdropAddress);
const magnaTokenAddress = "0x5FbDB2315678afecb367f032d93F642f64180aa3";
const magnaTokenContract = new web3.eth.Contract(MagnaToken.abi as any, magnaTokenAddress);
const airdropAddress = "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512";
const airdropContract = new web3.eth.Contract(Airdrop.abi as any, airdropAddress);
const { chains, provider, webSocketProvider } = configureChains([mainnet], [publicProvider()]);
const wagmiClient = createClient({
@ -151,6 +152,9 @@ function App() {
console.log(`Owner ${ownerAddress} Airdrop ${airdropAddress}`);
const oldbal = await magnaTokenContract.methods.balanceOf(addressList[0]).call({ from: ownerAddress });
console.log(`Old balance of magna token for ${addressList[0]} is ${oldbal}`);
const allowance = await magnaTokenContract.methods.allowance(ownerAddress, airdropAddress).call({ from: ownerAddress });
console.log(`Allowance: ${allowance}`);
@ -164,6 +168,9 @@ function App() {
const output = await airdropContract.methods.airdropTokens(recipients, amounts).send({ from: ownerAddress });
console.log(output);
const newbal = await magnaTokenContract.methods.balanceOf(addressList[0]).call({ from: ownerAddress });
console.log(`New balance of magna token for ${addressList[0]} is ${newbal}`);
}
const airdropButtonDisabled = addressList.length == 0 || !isConnected;

Loading…
Cancel
Save