diff --git a/docs/deployment.md b/docs/deployment.md index 388ea0de..6736a8ba 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -99,6 +99,12 @@ optimizer: { }, ``` +#### Verify ERC1967Proxy + +``` +npx hardhat verify --network goerli 0x676Fae4c5b791D6Cb2732C27ec794c6378ABbC04 --constructor-args script/verificationArguments/hardhat/ERC1967Proxy.js +``` + ### foundry Example for token verification: diff --git a/script/DeployPlatform.s.sol b/script/DeployPlatform.s.sol index c7a9d8d1..98bfcac9 100644 --- a/script/DeployPlatform.s.sol +++ b/script/DeployPlatform.s.sol @@ -8,6 +8,8 @@ import "../contracts/factories/FeeSettingsCloneFactory.sol"; import "../contracts/factories/AllowListCloneFactory.sol"; import "../contracts/factories/PrivateOfferFactory.sol"; import "../contracts/factories/VestingCloneFactory.sol"; +import "../contracts/factories/TokenProxyFactory.sol"; +import "@opengsn/contracts/src/forwarder/Forwarder.sol"; contract DeployPlatform is Script { function setUp() public {} @@ -15,40 +17,66 @@ contract DeployPlatform is Script { function run() public { uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); address deployerAddress = vm.addr(deployerPrivateKey); + address platformColdWallet = 0x9E23f8AA17B2721cf69D157b8a15bd7b64ac881C; // Sepolia and Mainnet + + /* + * config + */ // Goerli - address platformColdWallet = 0x1695F52e342f3554eC8BC06621B7f5d1644cCE39; - address trustedForwarder = 0x0445d09A1917196E1DC12EdB7334C70c1FfB1623; + // address platformColdWallet = 0x1695F52e342f3554eC8BC06621B7f5d1644cCE39; + // address trustedForwarder = 0x0445d09A1917196E1DC12EdB7334C70c1FfB1623; + // address[] memory trustedCurrencies = new address[](6); + // trustedCurrencies[0] = address(0x07865c6E87B9F70255377e024ace6630C1Eaa37F); // USDC + // trustedCurrencies[1] = address(0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6); // WETH + // trustedCurrencies[2] = address(0xC04B0d3107736C32e19F1c62b2aF67BE61d63a05); // WBTC + // trustedCurrencies[3] = address(0x73967c6a0904aA032C103b4104747E88c566B1A2); // DAI + // trustedCurrencies[4] = address(0xA683d909e996052955500DDc45CA13E25c76e286); // EUROC + // trustedCurrencies[5] = address(0xcB444e90D8198415266c6a2724b7900fb12FC56E); // EURe // Mainnet - // address platformColdWallet = 0x9E23f8AA17B2721cf69D157b8a15bd7b64ac881C; - // address trustedForwarder = 0xAa3E82b4c4093b4bA13Cb5714382C99ADBf750cA; + address trustedForwarder = 0xAa3E82b4c4093b4bA13Cb5714382C99ADBf750cA; + address[] memory trustedCurrencies = new address[](6); + trustedCurrencies[0] = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); // WEth + trustedCurrencies[1] = address(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599); // WBTC + trustedCurrencies[2] = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); // USDC + trustedCurrencies[3] = address(0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c); // EUROC + trustedCurrencies[4] = address(0x6B175474E89094C44Da98b954EedeAC495271d0F); // DAI + trustedCurrencies[5] = address(0x3231Cb76718CDeF2155FC47b5286d82e6eDA273f); // EURe - console.log("Deployer address: ", deployerAddress); + // Sepolia + // address trustedForwarder = 0x274ca5f21Cdde06B6E4Fe063f5087EB6Cf3eAe55; + // address[] memory trustedCurrencies = new address[](2); + // trustedCurrencies[0] = address(0x30627856Ef668F0A6a1ca9145C9538f7d5b42BDE); // tEUROC + // trustedCurrencies[1] = address(0x86f488C7CC923d987b246994a0E5e20B3364fd92); // tUSDC + /* + * execution + */ + console.log("Deployer address: ", deployerAddress); vm.startBroadcast(deployerPrivateKey); - console.log("Deploying FeeSettingsCloneFactory contract..."); - FeeSettings feeSettingsLogicContract = new FeeSettings(trustedForwarder); - FeeSettingsCloneFactory feeSettingsCloneFactory = new FeeSettingsCloneFactory( - address(feeSettingsLogicContract) - ); - console.log("FeeSettingsCloneFactory deployed at: ", address(feeSettingsCloneFactory)); - - console.log("Deploying FeeSettings contract..."); - Fees memory fees = Fees(200, 600, 200, 0); - FeeSettings feeSettings = FeeSettings( - feeSettingsCloneFactory.createFeeSettingsClone( - bytes32(0), - trustedForwarder, - platformColdWallet, - fees, - platformColdWallet, - platformColdWallet, - platformColdWallet - ) - ); - console.log("FeeSettings deployed at: ", address(feeSettings)); + // console.log("Deploying FeeSettingsCloneFactory contract..."); + // FeeSettings feeSettingsLogicContract = new FeeSettings(trustedForwarder); + // FeeSettingsCloneFactory feeSettingsCloneFactory = new FeeSettingsCloneFactory( + // address(feeSettingsLogicContract) + // ); + // console.log("FeeSettingsCloneFactory deployed at: ", address(feeSettingsCloneFactory)); + + // console.log("Deploying FeeSettings contract..."); + // Fees memory fees = Fees(200, 600, 200, 0); + // FeeSettings feeSettings = FeeSettings( + // feeSettingsCloneFactory.createFeeSettingsClone( + // bytes32(0), + // trustedForwarder, + // platformColdWallet, + // fees, + // platformColdWallet, + // platformColdWallet, + // platformColdWallet + // ) + // ); + // console.log("FeeSettings deployed at: ", address(feeSettings)); // console.log("Deploying AllowListCloneFactory contract..."); // AllowList allowListLogicContract = new AllowList(trustedForwarder); @@ -56,19 +84,64 @@ contract DeployPlatform is Script { // console.log("AllowListCloneFactory deployed at: ", address(allowListCloneFactory)); // console.log("Deploying AllowList contract..."); + + // uint256[] memory attributes = new uint256[](trustedCurrencies.length); + // for (uint256 i = 0; i < trustedCurrencies.length; i++) { + // attributes[i] = TRUSTED_CURRENCY; + // } // AllowList allowList = AllowList( - // allowListCloneFactory.createAllowListClone(bytes32(0), trustedForwarder, platformColdWallet) + // allowListCloneFactory.createAllowListClone( + // bytes32(0), + // trustedForwarder, + // platformColdWallet, + // trustedCurrencies, + // attributes + // ) // ); // console.log("Allowlist deployed at: ", address(allowList)); - // console.log("Deploying VestingCloneFactory contract..."); - // Vesting vestingImplementation = new Vesting(trustedForwarder); - // VestingCloneFactory vestingCloneFactory = new VestingCloneFactory(address(vestingImplementation)); - // console.log("VestingCloneFactory deployed at: ", address(vestingCloneFactory)); + console.log("Deploying VestingCloneFactory contract..."); + Vesting vestingImplementation = new Vesting(trustedForwarder); + VestingCloneFactory vestingCloneFactory = new VestingCloneFactory(address(vestingImplementation)); + console.log("VestingCloneFactory deployed at: ", address(vestingCloneFactory)); + + console.log("Deploying PrivateOfferFactory contract..."); + PrivateOfferFactory privateOfferFactory = new PrivateOfferFactory(vestingCloneFactory); + console.log("PrivateOfferFactory deployed at: ", address(privateOfferFactory)); + + // console.log("Deploying TokenProxyFactory contract..."); + // Token tokenImplementation = new Token(trustedForwarder); + // TokenProxyFactory tokenProxyFactory = new TokenProxyFactory(address(tokenImplementation)); + // console.log("TokenProxyFactory deployed at: ", address(tokenProxyFactory)); - // console.log("Deploying PrivateOfferFactory contract..."); - // PrivateOfferFactory privateOfferFactory = new PrivateOfferFactory(vestingCloneFactory); - // console.log("PrivateOfferFactory deployed at: ", address(privateOfferFactory)); + // console.log("Deploying Tokens to use as currrency on testnet..."); + // Token tUSDC = Token( + // tokenProxyFactory.createTokenProxy( + // bytes32(0), + // trustedForwarder, + // feeSettings, + // platformColdWallet, + // allowList, + // 0, + // "tokenize.it_USDC", + // "tUSDC" + // ) + // ); + // console.log("tUSDC deployed at: ", address(tUSDC)); + // Token tEUROC = Token( + // tokenProxyFactory.createTokenProxy( + // bytes32(0), + // trustedForwarder, + // feeSettings, + // platformColdWallet, + // allowList, + // 0, + // "tokenize.it_EUROC", + // "tEUROC" + // ) + // ); + // console.log("tEUROC deployed at: ", address(tEUROC)); + // console.log("Remember to add the tokens to the AllowList with attribute TRUSTED_CURRENCY: ", TRUSTED_CURRENCY); vm.stopBroadcast(); } diff --git a/script/verificationArguments/hardhat/AllowList.js b/script/verificationArguments/hardhat/AllowList.js new file mode 100644 index 00000000..43dd591d --- /dev/null +++ b/script/verificationArguments/hardhat/AllowList.js @@ -0,0 +1,3 @@ +module.exports = [ + '0xAa3E82b4c4093b4bA13Cb5714382C99ADBf750cA', // _trustedForwarder +]; diff --git a/script/verificationArguments/hardhat/AllowListCloneFactory.js b/script/verificationArguments/hardhat/AllowListCloneFactory.js new file mode 100644 index 00000000..9e6dfb52 --- /dev/null +++ b/script/verificationArguments/hardhat/AllowListCloneFactory.js @@ -0,0 +1,3 @@ +module.exports = [ + '0x68924e6bdBF78aDEC126D8287039248243f923a0', // logic contract +]; diff --git a/script/verificationArguments/hardhat/ERC1967Proxy.js b/script/verificationArguments/hardhat/ERC1967Proxy.js new file mode 100644 index 00000000..9f664c18 --- /dev/null +++ b/script/verificationArguments/hardhat/ERC1967Proxy.js @@ -0,0 +1,4 @@ +module.exports = [ + '0x3411253d72bec9a1093810f7807b1ecf6706b341', // implementation + [], +];