mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
Update test
This commit is contained in:
parent
6bc432be52
commit
a800c3b197
|
@ -1,19 +1,28 @@
|
||||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||||
|
import { ethers } from "hardhat";
|
||||||
import { ConnectV2ArbitrumAirdrop, ConnectV2ArbitrumAirdrop__factory } from "../../../typechain";
|
import { ConnectV2ArbitrumAirdrop, ConnectV2ArbitrumAirdrop__factory } from "../../../typechain";
|
||||||
import hre, { ethers } from "hardhat";
|
import hre from "hardhat";
|
||||||
|
import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector";
|
||||||
|
import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2";
|
||||||
|
import { encodeSpells } from "../../../scripts/tests/encodeSpells";
|
||||||
|
import { getMasterSigner } from "../../../scripts/tests/getMasterSigner";
|
||||||
|
import { addresses } from "../../../scripts/tests/arbitrum/addresses";
|
||||||
|
import { abis } from "../../../scripts/constant/abis";
|
||||||
|
|
||||||
describe("Arbitrum Airdrop Claim Test", () => {
|
describe("Arbitrum Airdrop Claim Test", () => {
|
||||||
let signer: SignerWithAddress;
|
let signer: SignerWithAddress;
|
||||||
let userSigner: SignerWithAddress;
|
|
||||||
let signer_user: any;
|
let signer_user: any;
|
||||||
const user = "0x30c3D961a21c2352A6FfAfFd4e8cB8730Bf82757";
|
const user = "0x30c3D961a21c2352A6FfAfFd4e8cB8730Bf82757";
|
||||||
|
const connectorName = "arbitrum-airdrop";
|
||||||
|
let dsaWallet0: any;
|
||||||
|
|
||||||
|
before(async () => {
|
||||||
|
[signer] = await ethers.getSigners();
|
||||||
|
});
|
||||||
|
|
||||||
describe("Arbitrum Airdrop Functions", () => {
|
describe("Arbitrum Airdrop Functions", () => {
|
||||||
let contract: ConnectV2ArbitrumAirdrop;
|
let contract: ConnectV2ArbitrumAirdrop;
|
||||||
|
|
||||||
//@ts-ignore
|
|
||||||
console.log('hre.config.networks.hardhat.forking.url: ', hre.config.networks.hardhat.forking.url)
|
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await hre.network.provider.request({
|
await hre.network.provider.request({
|
||||||
method: "hardhat_reset",
|
method: "hardhat_reset",
|
||||||
|
@ -22,35 +31,50 @@ describe("Arbitrum Airdrop Claim Test", () => {
|
||||||
forking: {
|
forking: {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
blockNumber: 70606643
|
blockNumber: 70606643,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
[signer] = await ethers.getSigners();
|
|
||||||
console.log("Signer: ", signer.address);
|
|
||||||
|
|
||||||
userSigner = await ethers.getSigner(user);
|
|
||||||
|
|
||||||
const deployer = new ConnectV2ArbitrumAirdrop__factory(signer);
|
const deployer = new ConnectV2ArbitrumAirdrop__factory(signer);
|
||||||
contract = await deployer.deploy();
|
contract = await deployer.deploy();
|
||||||
await contract.deployed();
|
await contract.deployed();
|
||||||
console.log("Contract deployed at: ", contract.address);
|
console.log("Contract deployed at: ", contract.address);
|
||||||
|
|
||||||
|
await deployAndEnableConnector({
|
||||||
|
connectorName,
|
||||||
|
contractArtifact: ConnectV2ArbitrumAirdrop__factory,
|
||||||
|
signer: signer,
|
||||||
|
connectors: await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2),
|
||||||
|
});
|
||||||
|
|
||||||
await hre.network.provider.request({
|
await hre.network.provider.request({
|
||||||
method: 'hardhat_impersonateAccount',
|
method: 'hardhat_impersonateAccount',
|
||||||
params: [user],
|
params: [user],
|
||||||
});
|
});
|
||||||
|
|
||||||
signer_user = await ethers.getSigner(user);
|
signer_user = await ethers.getSigner(user);
|
||||||
|
dsaWallet0 = await buildDSAv2(user);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Arbitrum Arbitrum", async () => {
|
it("Claims Arbitrum Airdrop and checks claimable tokens", async () => {
|
||||||
it("Claims Arbitrum Airdrop", async () => {
|
const claimableBefore = await contract.claimableArbTokens(user);
|
||||||
const response = await contract.connect(signer_user).claimAirdrop("4256");
|
console.log("Claimable tokens before: ", claimableBefore.toString());
|
||||||
console.log('response: ', response);
|
|
||||||
});
|
const spells = [
|
||||||
})
|
{
|
||||||
|
connector: connectorName,
|
||||||
|
method: "claimAirdrop",
|
||||||
|
args: ["0"],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const tx = await dsaWallet0.connect(signer_user).cast(...encodeSpells(spells), user);
|
||||||
|
await tx.wait();
|
||||||
|
|
||||||
|
const claimableAfter = await contract.claimableArbTokens(user);
|
||||||
|
console.log("Claimable tokens after: ", claimableAfter.toString());
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user