Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit da10250

Browse files
committed
Bump dependencies to programmtically verify contract + misc fixes
1 parent 4365483 commit da10250

File tree

9 files changed

+224
-81
lines changed

9 files changed

+224
-81
lines changed

deployments/polygonAddresses.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"token": "0x6847D3A4c80a82e1fb26f1fC6F09F3Ad5BEB5222",
44
"tokenLock": "0xB17828789280C77C17B02fc8E6F20Ddc5721f2C2",
55
"timelock": "0xdFB26381aFBc37f0Fae4A77D385b91B90347aA12",
6-
"governor": "0xc6eaDcC36aFcf1C430962506ad79145aD5140E58"
6+
"governor": "0xc6eaDcC36aFcf1C430962506ad79145aD5140E58",
7+
"tokenSale": "0xD0e7d5a2220e32914540D97A6D0548658050180b"
78
}

hardhat.config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ const config: HardhatUserConfig = {
4646
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
4747
},
4848
},
49+
etherscan: {
50+
apiKey: {
51+
polygon: process.env.POLYGONSCAN_API_KEY == undefined ? '' : process.env.POLYGONSCAN_API_KEY,
52+
}
53+
},
4954
typechain: {
5055
outDir: 'typechain',
5156
target: 'ethers-v5',
@@ -54,9 +59,6 @@ const config: HardhatUserConfig = {
5459
enabled: process.env.REPORT_GAS !== undefined,
5560
currency: 'USD',
5661
},
57-
etherscan: {
58-
apiKey: process.env.ETHERSCAN_API_KEY,
59-
},
6062
mocha: {
6163
// 1 hour, essentially disabled auto timeout
6264
timeout: 60 * 60 * 1000,

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
},
2525
"homepage": "https://github.com/code-423n4/genesis#readme",
2626
"dependencies": {
27-
"hardhat": "2.7.0",
27+
"hardhat": "2.8.3",
2828
"lodash": "^4.17.21"
2929
},
3030
"devDependencies": {
31-
"@nomiclabs/hardhat-ethers": "^2.0.3",
32-
"@nomiclabs/hardhat-etherscan": "2.1.7",
31+
"@nomiclabs/hardhat-ethers": "^2.0.4",
32+
"@nomiclabs/hardhat-etherscan": "3.0.0",
3333
"@nomiclabs/hardhat-waffle": "^2.0.0",
3434
"@openzeppelin/contracts": "^4.4.0",
35-
"@typechain/ethers-v5": "^7.0.1",
36-
"@typechain/hardhat": "^2.3.0",
35+
"@typechain/ethers-v5": "^9.0.0",
36+
"@typechain/hardhat": "^4.0.0",
3737
"@types/chai": "^4.2.21",
3838
"@types/lodash": "^4.14.178",
3939
"@types/mocha": "^9.0.0",
@@ -60,7 +60,7 @@
6060
"solidity-coverage": "^0.7.16",
6161
"ts-generator": "^0.1.1",
6262
"ts-node": "^10.4.0",
63-
"typechain": "^5.1.2",
64-
"typescript": "^4.3.5"
63+
"typechain": "^7.0.0",
64+
"typescript": "^4.5.5"
6565
}
6666
}

scripts/deploy/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export const tokenSaleConfigs: {[key: number]: TokenSaleConfig} = {
6969
TOKEN_SALE_DURATION: 10 * ONE_DAY,
7070
TOKEN_SALE_USDC: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
7171
TOKEN_SALE_ARENA_PRICE: BN.from(30_000).mul(ONE_18).div(ONE_18), // 0.03 USDC * 1e18 / 1.0 ARENA
72-
TOKEN_SALE_RECIPIENT: '0x7f0049597056E37B4B1f887196E44CAc050D4863 ', // C4 Polygon multisig
72+
TOKEN_SALE_RECIPIENT: '0x7f0049597056E37B4B1f887196E44CAc050D4863', // C4 Polygon multisig
7373
TOKEN_SALE_WHITELIST,
7474
RECIPIENT_AMOUNT: BN.from(1_750_000).mul(BN.from(10).pow(6)), // 1.75M USDC, rest to treasury
7575
TOKEN_SALE_SUPPLY: BN.from(100_000_000).mul(ONE_18), // 100M ARENA tokens

scripts/deploy/deployTokenSale.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414

1515
import {allConfigs, tokenSaleConfigs} from './config';
1616
import {HardhatRuntimeEnvironment} from 'hardhat/types';
17+
import {verifyContract} from './verify';
1718

1819
let proposerAddress: string;
1920
let tokenSale: TokenSale;
@@ -104,12 +105,12 @@ export async function deployTokenSale(hre: HardhatRuntimeEnvironment) {
104105
targets,
105106
values,
106107
calldatas,
107-
`"# C4IP-6: Transfer ARENA for token sale\nThis proposal takes action on the token sale approved by [C4IP-1\\]
108+
`# C4IP-6: Transfer ARENA for token sale\nThis proposal takes action on the token sale approved by [C4IP-1\\]
108109
\\(https://www.withtally.com/governance/eip155:137:0xc6eaDcC36aFcf1C430962506ad79145aD5140E58/proposal/61969381053746686972699442694032986733206504062025717191093241526145462208038)
109110
and the hiring of Code4 Corporation approved by [C4IP-3\\]\\(https://www.withtally.com/governance/eip155:137:0xc6eaDcC36aFcf1C430962506ad79145aD5140E58/proposal/46190911081008287731655546929165163023822387405966829437304548060152876868278)
110111
both of which are discussed in detail in [this forum post\\]\\(https://forum.code4rena.com/t/c4ip-1-constitution-dao-bootstrapping-reimbursements-token-sale/93)\n\n\n\n- 100,000,000 $ARENA tokens transferred to the [token sale contract\\]
111112
\\(${tokenSale.address})\n\n- Tokens are sold at price of 1 ARENA = .03 USDC\n\n- Token sale details to be administered by Code4 Corporation\n\n- $1.75M of the initial sale will immediately be used to fund Code4 Corporation operations\n\n
112-
- Remaining $1.25M proceeds will be transferred to the Code4rena treasury<br>\n\n\n<!-- -->\n\n"`
113+
- Remaining $1.25M proceeds will be transferred to the Code4rena treasury<br>\n\n\n<!-- -->\n\n`
113114
);
114115
console.log(`proposal submitted: ${tx.hash}`);
115116
console.log(`waiting for block inclusion ...`);
@@ -121,6 +122,19 @@ export async function deployTokenSale(hre: HardhatRuntimeEnvironment) {
121122
let exportJson = JSON.stringify(addressesToExport, null, 2);
122123
fs.writeFileSync(deploymentFilePath, exportJson);
123124

125+
console.log(`Verifying tokenSale contract...`);
126+
await verifyContract(hre, tokenSale.address, [
127+
config.TOKEN_SALE_USDC,
128+
arenaToken.address,
129+
config.TOKEN_SALE_START,
130+
config.TOKEN_SALE_DURATION,
131+
config.TOKEN_SALE_ARENA_PRICE,
132+
config.TOKEN_SALE_RECIPIENT,
133+
tokenLock.address,
134+
allConfigs[networkId].VEST_DURATION,
135+
config.RECIPIENT_AMOUNT,
136+
]);
137+
124138
/////////////////////////////////
125139
// ACCESS CONTROL VERIFICATION //
126140
/////////////////////////////////

scripts/deploy/verify.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {HardhatRuntimeEnvironment} from 'hardhat/types';
2+
3+
export async function verifyContract(hre: HardhatRuntimeEnvironment, contractAddress: string, ctorArgs: any[]) {
4+
await hre.run('verify:verify', {
5+
address: contractAddress,
6+
constructorArguments: ctorArgs,
7+
});
8+
}

test/RevokableTokenLock.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@ import {setNextBlockTimeStamp, mineBlockAt} from '../shared/TimeManipulation';
77

88
const {loadFixture} = waffle;
99

10-
let token: IERC20;
10+
let token: TestERC20;
1111
let revokableTokenLock: RevokableTokenLock;
1212

1313
describe('RevokableTokenLock', async () => {
1414
const [owner, revoker, recipient, other] = waffle.provider.getWallets();
1515
const amount = ethers.utils.parseEther('20');
1616

17-
// TODO: maybe create shared fixtures that can be imported by the test files
1817
async function fixture() {
1918
const TokenFactory = await ethers.getContractFactory('TestERC20');
20-
const token = (await TokenFactory.deploy('TEST', 'TEST')) as IERC20;
19+
const token = await TokenFactory.deploy('TEST', 'TEST');
2120
const RevokableTokenLockFactory = await ethers.getContractFactory('RevokableTokenLock');
2221
const revokableTokenLock = (await RevokableTokenLockFactory.deploy(
2322
token.address,

test/TokenLock.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {mineBlockAt, resetNetwork, setNextBlockTimeStamp} from '../shared/TimeMa
88
const {solidity, loadFixture} = waffle;
99
chai.use(solidity);
1010

11-
let token: IERC20;
11+
let token: TestERC20;
1212
let tokenLock: TokenLock;
1313
let unlockBegin: number;
1414
let unlockCliff: number;
@@ -20,7 +20,7 @@ describe('TokenLock', async () => {
2020
// TODO: maybe create shared fixtures that can be imported by the test files
2121
async function fixture() {
2222
const TokenFactory = await ethers.getContractFactory('TestERC20');
23-
const token = (await TokenFactory.connect(admin).deploy('TEST', 'TEST')) as IERC20;
23+
const token = (await TokenFactory.connect(admin).deploy('TEST', 'TEST')) as TestERC20;
2424
const TokenLockFactory = await ethers.getContractFactory('TokenLock');
2525
const tokenLock = (await TokenLockFactory.connect(admin).deploy(token.address)) as TokenLock;
2626
return {token, tokenLock};

0 commit comments

Comments
 (0)