diff --git a/.env.example b/.env.example index f20c4664..3527d681 100644 --- a/.env.example +++ b/.env.example @@ -12,6 +12,7 @@ BSC_NODE="" OP_NODE="" BLAST_NODE="" SCROLL_NODE="" +AVAX_NODE="" ETHERSCAN_API_KEY="" POLYGONSCAN_API_KEY="" @@ -21,6 +22,7 @@ BSCSCAN_API_KEY="" OPSCAN_API_KEY="" BLASTSCAN_API_KEY="" SCROLLSCAN_API_KEY="" +AVASCAN_API_KEY="" COINMARKETCAP_API_KEY="" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2f1e09a..55b85db0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,7 @@ env: OP_NODE: ${{ secrets.OP_NODE }} BLAST_NODE: ${{ secrets.BLAST_NODE }} SCROLL_NODE: ${{ secrets.SCROLL_NODE }} + AVAX_NODE: ${{ secrets.AVAX_NODE }} ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} PRIVATE_KEY: ${{ secrets.DUMMY_PK }} diff --git a/.github/workflows/slither.yml b/.github/workflows/slither.yml index d23084eb..d188f571 100644 --- a/.github/workflows/slither.yml +++ b/.github/workflows/slither.yml @@ -20,6 +20,7 @@ env: OP_NODE: ${{ secrets.OP_NODE }} BLAST_NODE: ${{ secrets.BLAST_NODE }} SCROLL_NODE: ${{ secrets.SCROLL_NODE }} + AVAX_NODE: ${{ secrets.AVAX_NODE }} ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} PRIVATE_KEY: ${{ secrets.DUMMY_PK }} diff --git a/.openzeppelin/avalanche.json b/.openzeppelin/avalanche.json new file mode 100644 index 00000000..d4c5bdc5 --- /dev/null +++ b/.openzeppelin/avalanche.json @@ -0,0 +1,357 @@ +{ + "manifestVersion": "3.2", + "admin": { + "address": "0xFe0D2F86cE8854C1c2081aB9e47D08374afB737F", + "txHash": "0xdf4a10741c436e1e04bec1d863c1f1d9cfca3672a8538d6bb563b8620944e4ce" + }, + "proxies": [ + { + "address": "0x3f67093dfFD4F0aF4f2918703C92B60ACB7AD78b", + "txHash": "0x3a94829a115aad7ed06b16d51062e21d1bdc5c7ee51c94313bcf3a119cb60ee3", + "kind": "transparent" + }, + { + "address": "0x0d3bd40758dF4F79aaD316707FcB809CD4815Ffe", + "txHash": "0x46637350e5fa2b07f3f80fa0dd2851ba7e14fbf282d75fd827cf64e359ddd353", + "kind": "transparent" + }, + { + "address": "0x1bE9d03BfC211D83CFf3ABDb94A75F9Db46e1334", + "txHash": "0xf1ebc169c068fcc3ff6dab50613e61f4ae2a66a7ba6292540d1a5d506e23f5d2", + "kind": "transparent" + }, + { + "address": "0x9c05d54645306d4C4EAd6f75846000E1554c0360", + "txHash": "0x4d376cf7e5cdb9f4ddc9f8450dbe44ea380dac253c05c41a3db9fd7412517ddd", + "kind": "transparent" + }, + { + "address": "0xb80a1d87654BEf7aD8eB6BBDa3d2309E31D4e598", + "txHash": "0x35f72809912a27fbd931fd5419ab8187106888150b8cb4ac10203e12a854a9d3", + "kind": "transparent" + }, + { + "address": "0x9F2825333aa7bC2C98c061924871B6C016e385F3", + "txHash": "0xc526200a09b6173214ab9209c3ca4513c8b2cef7959e686b79d2ac5c30201ee7", + "kind": "transparent" + }, + { + "address": "0xF4ACCD20bFED4dFFe06d4C85A7f9924b1d5dA819", + "txHash": "0x3e3e54d8cc49f25ce409033a802c10c903ffcecd206b6f4e8033540072a58597", + "kind": "transparent" + }, + { + "address": "0xFf4927e04c6a01868284F5C3fB9cba7F7ca4aeC0", + "txHash": "0x0ff341b803c12a1da03be7400cc56aeae2298c90d744487997e63b96cc92fe8a", + "kind": "transparent" + }, + { + "address": "0x399508A43d7E2b4451cd344633108b4d84b33B03", + "txHash": "0x03998e117945dadab422ce8f3776c034c44f613d9a50f118f42eb0a05622d450", + "kind": "transparent" + }, + { + "address": "0x73225F88fEEA4E41Fc67E986a95AC61dd7118866", + "txHash": "0xea32daadc9f5393df5347ebdf93edf326b3a30b7a496c94e262d4d31d9539daa", + "kind": "transparent" + }, + { + "address": "0xD2aEE1CE2b4459dE326971DE036E82f1318270AF", + "txHash": "0x36259e10d3cfec78485496968e5b1d64bfb46a894b086ef1a28020774e043ca0", + "kind": "transparent" + } + ], + "impls": { + "946bbeec1ea22aaaeb7c7bd5038bbff42663e67c566214749561898491ffacba": { + "address": "0xF2753202BA39dD25eA8D6D1D609a9021234943Fc", + "txHash": "0x6a8e7e13dccde1c4e2f4b23563289d17243ec208ad771ef79e209b513b728549", + "layout": { + "solcVersion": "0.8.17", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_paused", + "offset": 0, + "slot": "51", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol:116" + }, + { + "label": "_balances", + "offset": 0, + "slot": "101", + "type": "t_mapping(t_address,t_uint256)", + "contract": "ERC20Upgradeable", + "src": "openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol:37" + }, + { + "label": "_allowances", + "offset": 0, + "slot": "102", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", + "contract": "ERC20Upgradeable", + "src": "openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol:39" + }, + { + "label": "_totalSupply", + "offset": 0, + "slot": "103", + "type": "t_uint256", + "contract": "ERC20Upgradeable", + "src": "openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol:41" + }, + { + "label": "_name", + "offset": 0, + "slot": "104", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol:43" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "105", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol:44" + }, + { + "label": "__gap", + "offset": 0, + "slot": "106", + "type": "t_array(t_uint256)45_storage", + "contract": "ERC20Upgradeable", + "src": "openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol:400" + }, + { + "label": "__gap", + "offset": 0, + "slot": "151", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC165Upgradeable", + "src": "openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol:41" + }, + { + "label": "_roles", + "offset": 0, + "slot": "201", + "type": "t_mapping(t_bytes32,t_struct(RoleData)2191_storage)", + "contract": "AccessControlUpgradeable", + "src": "openzeppelin-contracts-upgradeable/contracts/access/AccessControlUpgradeable.sol:61" + }, + { + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage", + "contract": "AccessControlUpgradeable", + "src": "openzeppelin-contracts-upgradeable/contracts/access/AccessControlUpgradeable.sol:259" + }, + { + "label": "__gap", + "offset": 0, + "slot": "251", + "type": "t_array(t_uint256)50_storage", + "contract": "AuthorizationModule", + "src": "contracts/modules/security/AuthorizationModule.sol:57" + }, + { + "label": "tokenId", + "offset": 0, + "slot": "301", + "type": "t_string_storage", + "contract": "BaseModule", + "src": "contracts/modules/wrapper/mandatory/BaseModule.sol:23" + }, + { + "label": "terms", + "offset": 0, + "slot": "302", + "type": "t_string_storage", + "contract": "BaseModule", + "src": "contracts/modules/wrapper/mandatory/BaseModule.sol:24" + }, + { + "label": "information", + "offset": 0, + "slot": "303", + "type": "t_string_storage", + "contract": "BaseModule", + "src": "contracts/modules/wrapper/mandatory/BaseModule.sol:25" + }, + { + "label": "flag", + "offset": 0, + "slot": "304", + "type": "t_uint256", + "contract": "BaseModule", + "src": "contracts/modules/wrapper/mandatory/BaseModule.sol:26" + }, + { + "label": "__gap", + "offset": 0, + "slot": "305", + "type": "t_array(t_uint256)50_storage", + "contract": "BaseModule", + "src": "contracts/modules/wrapper/mandatory/BaseModule.sol:109" + }, + { + "label": "__gap", + "offset": 0, + "slot": "355", + "type": "t_array(t_uint256)50_storage", + "contract": "PauseModule", + "src": "contracts/modules/wrapper/mandatory/PauseModule.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "405", + "type": "t_array(t_uint256)50_storage", + "contract": "MintModule", + "src": "contracts/modules/wrapper/mandatory/MintModule.sol:51" + }, + { + "label": "__gap", + "offset": 0, + "slot": "455", + "type": "t_array(t_uint256)50_storage", + "contract": "BurnModule", + "src": "contracts/modules/wrapper/mandatory/BurnModule.sol:51" + }, + { + "label": "_decimals", + "offset": 0, + "slot": "505", + "type": "t_uint8", + "contract": "ERC20BaseModule", + "src": "contracts/modules/wrapper/mandatory/ERC20BaseModule.sol:16" + }, + { + "label": "__gap", + "offset": 0, + "slot": "506", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC20BaseModule", + "src": "contracts/modules/wrapper/mandatory/ERC20BaseModule.sol:90" + }, + { + "label": "__gap", + "offset": 0, + "slot": "556", + "type": "t_array(t_uint256)50_storage", + "contract": "CMTAT_BASE", + "src": "contracts/modules/CMTAT_BASE.sol:139" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)45_storage": { + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_struct(RoleData)2191_storage)": { + "label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(RoleData)2191_storage": { + "label": "struct AccessControlUpgradeable.RoleData", + "members": [ + { + "label": "members", + "type": "t_mapping(t_address,t_bool)", + "offset": 0, + "slot": "0" + }, + { + "label": "adminRole", + "type": "t_bytes32", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } + } + } +} diff --git a/hardhat.config.js b/hardhat.config.js index 9d25bf0c..c3ed5756 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -81,6 +81,11 @@ module.exports = { url: process.env.SCROLL_NODE, accounts: [process.env.PRIVATE_KEY], chainId: 534352 + }, + avalanche: { + url: process.env.AVAX_NODE, + accounts: [process.env.PRIVATE_KEY], + chainId: 43114 } }, solidity: { @@ -105,7 +110,8 @@ module.exports = { bsc: process.env.BSCSCAN_API_KEY, optimisticEthereum: process.env.OPSCAN_API_KEY, blast: process.env.BLASTSCAN_API_KEY, - scroll: process.env.SCROLLSCAN_API_KEY + scroll: process.env.SCROLLSCAN_API_KEY, + avalanche: process.env.AVASCAN_API_KEY }, customChains: [ { @@ -160,4 +166,3 @@ module.exports = { token: 'ETH' } } - diff --git a/scripts/4_deploy_21doge_alone.js b/scripts/4_deploy_21doge_alone.js new file mode 100644 index 00000000..2f9261a2 --- /dev/null +++ b/scripts/4_deploy_21doge_alone.js @@ -0,0 +1,43 @@ +require('dotenv').config() +const { ethers, upgrades } = require('hardhat') +const { + printBoxedTitle +} = require('./utils') +const tokensMetadata = require('./wrapped-tokens.json') + +async function deployWrappedAsset (CMTATBase, metadata) { + const proxyContract = await upgrades.deployProxy( + CMTATBase, + metadata, + { initializer: 'initialize' } + ) + + if (!proxyContract || !(await proxyContract.getAddress())) { + throw new Error('Deployment failed. Proxy contract address is undefined.') + } + + console.log('Deployed contract address: ', await proxyContract.getAddress()) +} + +async function deployWrappedAssets () { + printBoxedTitle('Deploying 21DOGE to a new network') + + const CMTATBase = await ethers.getContractFactory('CMTAT_BASE') + + // Deploy 21DOGE as nonce 0 + await deployWrappedAsset( + CMTATBase, + tokensMetadata.tokens['0xD2aEE1CE2b4459dE326971DE036E82f1318270AF'].metadata + ) +} + +async function main () { + try { + await deployWrappedAssets() + } catch (error) { + console.error('Deployment failed:', error) + process.exit(1) + } +} + +main().then(() => process.exit(0))