Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script for contracts verification #100

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,27 @@ Project for [Autonomous Agent: AI x Web3 Hackathon 2024](https://autonomous-agen

Graviola's initiative employs blockchain, AI, and randomness to autonomously produce NFTs using user-supplied and on-chain stored keywords. It processes these keywords into AI-generated portraits through Stable Diffusion, then catalogs these unique NFTs with associated rarity and other metadata attributes on the blockchain.

## Live demo

Live on **Arbitrum One Sepolia** testnet!

https://el-tumero.github.io/graviola/

## Contracts

| **Contract** | **Address** | **Block explorer** |
| ---------------------- | ------------------------------------------ | ------------------------------------------------------------------------------ |
| GraviolaCollection | 0x5DeA8a4062E82CB44EBCA7CeBaa37B510eB6a6A9 | https://sepolia.arbiscan.io/address/0x5DeA8a4062E82CB44EBCA7CeBaa37B510eB6a6A9 |
| GraviolaGenerator | 0xAe48A15dE641fAC97AD5DC4faB28d31EF0c0B428 | https://sepolia.arbiscan.io/address/0xAe48A15dE641fAC97AD5DC4faB28d31EF0c0B428 |
| GraviolaSeasonsArchive | 0x6772D1461977f02D540108fFB8f33E8218DeCAc1 | https://sepolia.arbiscan.io/address/0x6772D1461977f02D540108fFB8f33E8218DeCAc1 |

## App Setup

1. `git clone https://github.com/el-tumero/graviola && cd graviola`
2. download Foundry https://book.getfoundry.sh/getting-started/installation#using-foundryup
3. generate types for the frontend
1. `cd contracts && yarn`
2. `yarn build && yarn types`
1. `cd contracts && yarn`
2. `yarn build && yarn types`
4. run website
1. `cd ../frontend && yarn`
2. `yarn dev`

## Live demo

https://el-tumero.github.io/graviola/
1. `cd ../frontend && yarn`
2. `yarn dev`
9 changes: 8 additions & 1 deletion contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import 'dotenv/config'
import { HardhatUserConfig } from 'hardhat/config'
import '@nomicfoundation/hardhat-toolbox'
import '@nomiclabs/hardhat-solhint'
import '@nomicfoundation/hardhat-verify'

const PRIVATE_KEY = process.env.PRIVATE_KEY
const API_KEY_INFURA = process.env.API_KEY_INFURA
const ARBISCAN_API_KEY = process.env.ARBISCAN_API_KEY

const config: HardhatUserConfig = {
networks: {
Expand All @@ -17,11 +19,16 @@ const config: HardhatUserConfig = {
blockNumber: 71109865,
},
},
testnet: {
arbitrumSepolia: {
url: `https://arbitrum-sepolia.infura.io/v3/${API_KEY_INFURA}`,
accounts: PRIVATE_KEY ? [PRIVATE_KEY] : undefined,
},
},
etherscan: {
apiKey: {
arbitrumSepolia: ARBISCAN_API_KEY ?? '',
},
},
solidity: {
version: '0.8.24',
},
Expand Down
6 changes: 4 additions & 2 deletions contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build": "forge build",
"deploy": "ts-node --transpile-only utils/deploy.ts",
"deploy:local": "HARDHAT_NETWORK=localhost yarn deploy",
"deploy:testnet": "HARDHAT_NETWORK=testnet yarn deploy",
"deploy:testnet": "HARDHAT_NETWORK=arbitrumSepolia yarn deploy",
"verify": "HARDHAT_NETWORK=arbitrumSepolia ts-node --transpile-only utils/verify.ts",
"local-node": "hardhat node",
"mock-bot": "HARDHAT_NETWORK=localhost ts-node --transpile-only utils/mock-bot.ts",
"test": "forge test -vv",
Expand All @@ -17,6 +18,7 @@
"lint": "solhint '**/*.sol'"
},
"dependencies": {
"@inquirer/prompts": "^5.4.0",
"@openzeppelin/contracts": "^5.0.2",
"dotenv": "^16.4.5",
"solidity-json-writer": "^1.1.0",
Expand All @@ -31,7 +33,7 @@
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.10",
"@nomiclabs/hardhat-solhint": "^4.0.0",
"@typechain/ethers-v6": "^0.5.1",
"@typechain/hardhat": "^9.0.0",
Expand Down
75 changes: 75 additions & 0 deletions contracts/utils/verify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import hardhat from 'hardhat'
import { checkbox } from '@inquirer/prompts'
import addresses from '../addresses-testnet.json'

async function main() {
const answer = await checkbox({
message: 'Select contracts to verify',
choices: [
{ name: 'Token', value: verifyToken },
{ name: 'SeasonsArchive', value: verifySeasonsArchive },
{ name: 'SeasonsGovernor', value: verifySeasonsGovernor },
{ name: 'Collection', value: verifyCollection },
{ name: 'Generator', value: verifyGenerator },
],
})

console.log('Verification process start...')
for (let i = 0; i < answer.length; i++) {
await answer[i]()
}
}

const onwerAddress = '0x4EEf993E6C1E67c76512B18A13D57671E1f78c24'
const migratorAddress = '0x2967831d920243582352Fce2db750137ef076A4e'

async function verifyToken() {
console.log('Verifing Token...')
await hardhat.run('verify:verify', {
address: addresses.TOKEN_ADDRESS,
constructorArguments: [onwerAddress],
})
}

async function verifySeasonsArchive() {
console.log('Verifing SeasonsArchive...')
await hardhat.run('verify:verify', {
address: addresses.SEASONS_ARCHIVE_ADDRESS,
constructorArguments: [migratorAddress],
})
}

async function verifySeasonsGovernor() {
console.log('Verifing SeasonsGovernor...')
await hardhat.run('verify:verify', {
address: addresses.SEASONS_GOVERNOR_ADDRESS,
constructorArguments: [
addresses.SEASONS_ARCHIVE_ADDRESS,
addresses.TOKEN_ADDRESS,
],
})
}

async function verifyCollection() {
console.log('Verifing Collection...')
await hardhat.run('verify:verify', {
address: addresses.COLLECTION_ADDRESS,
constructorArguments: [onwerAddress],
})
}

async function verifyGenerator() {
console.log('Verifing Generator...')
await hardhat.run('verify:verify', {
address: addresses.GENERATOR_ADDRESS,
constructorArguments: [
addresses.TOKEN_ADDRESS,
addresses.SEASONS_ARCHIVE_ADDRESS,
addresses.COLLECTION_ADDRESS,
addresses.OAO_ADDRESS,
addresses.VRF_ADDRESS,
],
})
}

main()
Loading
Loading