Skip to content

Commit

Permalink
wip: apply lint
Browse files Browse the repository at this point in the history
  • Loading branch information
seinmyung25 committed Jan 8, 2024
1 parent 56d1b54 commit 80ed584
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 53 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @kroma-network/ecobe
27 changes: 0 additions & 27 deletions scripts/deploy.ts

This file was deleted.

43 changes: 19 additions & 24 deletions test/proxy.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import {
time,
loadFixture,
} from "@nomicfoundation/hardhat-toolbox/network-helpers";

import { AsyncConstructor } from 'async-constructor'
import { expect } from "chai";
import { ethers } from "hardhat";

import { EcoERC20Mintable } from "../typechain-types";

import { ContractFactory } from "ethers";
import hre from "hardhat";

import { AsyncConstructor } from 'async-constructor'
import { EcoERC20Mintable } from "../typechain-types";

type ProxiedContract<FT extends ContractFactory> = Awaited<ReturnType<FT['deploy']>>;

Expand All @@ -30,11 +26,11 @@ describe("ProxyContractTypeTest", function () {
const name = "Mintable Token";
const symbol = "M ERC20";

const amount = ethers.parseEther("100");
const amount = hre.ethers.parseEther("100");

async function Proxy_Helper_Fixture() {
const [owner, ...users] = await ethers.getSigners();
const helper = await new ProxyContractTypeTest(await ethers.getContractFactory("EcoERC20Mintable"), name, symbol);
const [owner, ...users] = await hre.ethers.getSigners();
const helper = await new ProxyContractTypeTest(await hre.ethers.getContractFactory("EcoERC20Mintable"), name, symbol);
return {owner, helper}
}

Expand All @@ -49,24 +45,23 @@ describe("ERC20 Mintable", function () {
const name = "Mintable Token";
const symbol = "M ERC20";

const amount = ethers.parseEther("100");

const amount = hre.ethers.parseEther("100");
async function NFT_Mintable_Fixture() {
const [owner, ...users] = await ethers.getSigners();
// TODO: apply proxyFactory
const [owner, ...users] = await hre.ethers.getSigners();

const EcoProxyAdmin = await ethers.getContractFactory("EcoProxyAdmin");
const EcoProxyAdmin = await hre.ethers.getContractFactory("EcoProxyAdmin");
const admin = await EcoProxyAdmin.deploy(owner);

const EcoProxyForProxyAdmin = await ethers.getContractFactory("EcoProxyForProxyAdmin");
const EcoProxyForProxyAdmin = await hre.ethers.getContractFactory("EcoProxyForProxyAdmin");
const pAdmin = await EcoProxyForProxyAdmin.deploy(admin, owner);

const ERC20 = await ethers.getContractFactory("EcoERC20Mintable");
const erc20 = await ERC20.deploy(name, symbol);

const ERC20 = await hre.ethers.getContractFactory("EcoERC20Mintable");
const erc20 = await ERC20.deploy(name,symbol);

const EcoTUPWithAdmin = await ethers.getContractFactory("EcoTUPWithAdmin");
let inst = await EcoTUPWithAdmin.deploy(pAdmin, erc20, erc20.interface.encodeFunctionData("initEcoERC20Mintable", [owner.address, name, symbol]))
const pErc20:EcoERC20Mintable = erc20.attach( await inst.getAddress() )
const EcoTUPWithAdmin = await hre.ethers.getContractFactory("EcoTUPWithAdmin");
const inst = await EcoTUPWithAdmin.deploy(pAdmin, erc20, erc20.interface.encodeFunctionData("initEcoERC20Mintable", [owner.address, name, symbol]))
const pErc20:EcoERC20Mintable = erc20.attach( await inst.getAddress() ) as EcoERC20Mintable;

return { owner, users, admin, pAdmin, erc20, pErc20 };
}
Expand Down Expand Up @@ -102,7 +97,7 @@ const amount = ethers.parseEther("100");
it("Shouldn't fail mint with the right role access account", async function () {
const { pErc20, users } = await loadFixture(NFT_Mintable_Fixture);

const nextMintSelector = ethers.zeroPadBytes(pErc20.mint.fragment.selector, 32)
const nextMintSelector = hre.ethers.zeroPadBytes(pErc20.mint.fragment.selector, 32)
await expect( pErc20.grantRole(nextMintSelector, users[0]) ).not.reverted;

const user_connected_nft = pErc20.connect(users[0])
Expand All @@ -118,11 +113,11 @@ const amount = ethers.parseEther("100");
const { owner, pErc20, users } = await loadFixture(NFT_Mintable_Fixture);
await expect( pErc20.mint(users[0], amount) ).not.reverted;

await pErc20.connect(users[0]).approve(owner, ethers.MaxUint256);
await pErc20.connect(users[0]).approve(owner, hre.ethers.MaxUint256);
await expect( pErc20.transferFrom(users[0], users[1], await pErc20.balanceOf(users[0])) ).not.reverted;
await expect( pErc20.transferFrom(users[0], users[1], amount) ).reverted;
await expect( pErc20.connect(users[1]).transferFrom(users[1], users[0], await pErc20.balanceOf(users[1])) ).reverted;
await pErc20.connect(users[1]).approve(owner, ethers.MaxUint256);
await pErc20.connect(users[1]).approve(owner, hre.ethers.MaxUint256);
await expect( pErc20.transferFrom(users[1], users[0], await pErc20.balanceOf(users[1])) ).not.reverted;
});
});
Expand Down
1 change: 0 additions & 1 deletion test/token/ERC20.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
time,
loadFixture,
} from "@nomicfoundation/hardhat-toolbox/network-helpers";
import { expect } from "chai";
Expand Down
1 change: 0 additions & 1 deletion test/token/ERC721.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
time,
loadFixture,
} from "@nomicfoundation/hardhat-toolbox/network-helpers";
import { expect } from "chai";
Expand Down

0 comments on commit 80ed584

Please sign in to comment.