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

update scripts and docs #317

Merged
merged 5 commits into from
Jan 5, 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
6 changes: 6 additions & 0 deletions docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
141 changes: 107 additions & 34 deletions script/DeployPlatform.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,67 +8,140 @@ 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 {}

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);
// AllowListCloneFactory allowListCloneFactory = new AllowListCloneFactory(address(allowListLogicContract));
// 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();
}
Expand Down
3 changes: 3 additions & 0 deletions script/verificationArguments/hardhat/AllowList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = [
'0xAa3E82b4c4093b4bA13Cb5714382C99ADBf750cA', // _trustedForwarder
];
3 changes: 3 additions & 0 deletions script/verificationArguments/hardhat/AllowListCloneFactory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = [
'0x68924e6bdBF78aDEC126D8287039248243f923a0', // logic contract
];
4 changes: 4 additions & 0 deletions script/verificationArguments/hardhat/ERC1967Proxy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = [
'0x3411253d72bec9a1093810f7807b1ecf6706b341', // implementation
[],
];
Loading