Skip to content

Commit

Permalink
Merge pull request #357 from open-dollar/protocolToken-deploy
Browse files Browse the repository at this point in the history
deployed factory
  • Loading branch information
daopunk authored Jan 16, 2024
2 parents 53858a3 + 0d7006a commit 09a0cf2
Show file tree
Hide file tree
Showing 8 changed files with 4,336 additions and 5,354 deletions.
9,635 changes: 4,306 additions & 5,329 deletions deployments/sepolia_421614/run-latest.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"deploy:anvil": "bash -c 'source .env && forge script DeployAnvil --with-gas-price 2000000000 -vvvvv --rpc-url $ANVIL_RPC --private-key $ANVIL_ONE --broadcast --ffi' && cp broadcast/Deploy.s.sol/31337/run-latest.json deployments/anvil/ && node tasks/parseAnvilDeployments.js",
"deploy:mainnet": "bash -c 'source .env && forge script DeployMainnet --rpc-url $ARB_MAINNET_RPC --broadcast --private-key $ARB_MAINNET_DEPLOYER_PK --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY'",
"deploy:mainnet:ffi": "bash -c 'source .env && forge script DeployMainnet --rpc-url $ARB_MAINNET_RPC --broadcast --private-key $ARB_MAINNET_DEPLOYER_PK --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY --ffi'",
"deploy:sepolia": "bash -c 'source .env && forge script DeploySepolia --skip-simulation --with-gas-price 2000000000 -vvvvv --chain-id 461614 --rpc-url $ARB_SEPOLIA_RPC --private-key $ARB_SEPOLIA_DEPLOYER_PK --broadcast --verifier etherscan --verifier-url $ARB_SEPOLIA_API --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY'",
"deploy:sepolia:ffi": "bash -c 'source .env && forge script DeploySepolia --with-gas-price 2000000000 -vvvvv --chain-id 461614 --rpc-url $ARB_SEPOLIA_RPC --private-key $ARB_SEPOLIA_DEPLOYER_PK --broadcast --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY --ffi'",
"postinstall": "forge install",
"lint:check": "yarn lint:sol && forge fmt --check",
Expand Down
5 changes: 0 additions & 5 deletions script/Common.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,6 @@ abstract contract Common is Contracts, Params {
if (_chainId != 31_337) {
address systemCoinAddress = create2.create2deploy(_systemCoinSalt, _systemCoinInitCode);
systemCoin = ISystemCoin(systemCoinAddress);
if (_chainId == 42_161) {
protocolToken = IProtocolToken(MAINNET_PROTOCOL_TOKEN); // pre-deployed & initialized
} else {
protocolToken = IProtocolToken(SEPOLIA_PROTOCOL_TOKEN); // pre-deployed & initialized
}
} else {
systemCoin = new OpenDollar();
protocolToken = new OpenDollarGovernance();
Expand Down
2 changes: 2 additions & 0 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ contract DeployMainnet is MainnetParams, Deploy {
function setUp() public virtual {
// set create2 factory
create2 = IODCreate2Factory(MAINNET_CREATE2FACTORY);
protocolToken = IProtocolToken(MAINNET_PROTOCOL_TOKEN);

_deployerPk = uint256(vm.envBytes32('ARB_MAINNET_DEPLOYER_PK'));
chainId = 42_161;
Expand Down Expand Up @@ -173,6 +174,7 @@ contract DeploySepolia is SepoliaParams, Deploy {
function setUp() public virtual {
// set create2 factory
create2 = IODCreate2Factory(TEST_CREATE2FACTORY);
protocolToken = IProtocolToken(SEPOLIA_PROTOCOL_TOKEN);

_deployerPk = uint256(vm.envBytes32('ARB_SEPOLIA_DEPLOYER_PK'));
chainId = 421_614;
Expand Down
18 changes: 9 additions & 9 deletions script/Registry.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@ uint256 constant SEMI_RANDOM_SALT = 0; // set to 0 to use Salts below, set to 1
// --- ARB Sepolia Testnet ---

// Create2 Factory
address constant TEST_CREATE2FACTORY = 0xd7729CC26096035e1A7e834cE0b72599Da25FA7f;
address constant TEST_CREATE2FACTORY = 0xC5f2C81d16764908B18379D95f410912d928Adc2;

// Protocol Token
address constant SEPOLIA_PROTOCOL_TOKEN = 0xFEEe338C2A70FC4F754C68c788973a7634b83d5b;
address constant SEPOLIA_PROTOCOL_TOKEN = 0x00D2363Ea723d8Bc3D664b87Cf51A04033BD0Ef1;

// Governance Settings
uint256 constant TEST_INIT_VOTING_DELAY = 1;
uint256 constant TEST_INIT_VOTING_PERIOD = 15;
uint256 constant TEST_INIT_PROP_THRESHOLD = 0;

// Deployment params
address constant TEST_DEPLOYER = 0xA0313248556DeA42fd17B345817Dd5DC5674c1E1;
address constant TEST_SAFE = 0xA0313248556DeA42fd17B345817Dd5DC5674c1E1;
uint256 constant MIN_DELAY_GOERLI = 1 minutes;
uint256 constant ORACLE_INTERVAL_TEST = 1 minutes;

Expand All @@ -29,9 +27,9 @@ address constant J = 0xcb81A76a565aC4870EDA5B0e32c5a0D2ec734174;
address constant P = 0xC295763Eed507d4A0f8B77241c03dd3354781a15;

// Vanity address params - use `cast create2` to find salt (salt must change for each deployment)
bytes32 constant SEPOLIA_SALT_SYSTEMCOIN = 0x46320220579d213d0446f6f1fb03407627be45d5215e7d705569a5346288aa97;
bytes32 constant SEPOLIA_SALT_PROTOCOLTOKEN = 0xc262cd83fe003707ee84344a60b91f7fe4ecf9f2699c79415942c5277e5a3985;
bytes32 constant SEPOLIA_SALT_VAULT721 = 0x2bfa56b0ce602655b440d2aa008f0900d12ef45823378bf9cb8d32eba74439c3;
bytes32 constant SEPOLIA_SALT_SYSTEMCOIN = 0x320b084950f2ed030fd47ee2a0d2e917b0be85568b45a5ab588489d1ee750f8e;
bytes32 constant SEPOLIA_SALT_PROTOCOLTOKEN = 0x2eeca8c9b7363a55d7c815636716e32bdbd3b6531752ae4e6f6be1f83d6f8442;
bytes32 constant SEPOLIA_SALT_VAULT721 = 0xbdf2f56ce92411dbdc7a4de225c95fee8bcc5c94cd325ff55353a16597966d12;

// Camelot Relayer (pre-deployed @ sol 0.7.6)
address constant SEPOLIA_CAMELOT_RELAYER_FACTORY = 0x92Bfb4D96f0b8dcA8F6e5E0fc4713DEa8243d9D6;
Expand Down Expand Up @@ -62,7 +60,7 @@ address constant SEPOLIA_WETH = 0x980B62Da83eFf3D4576C647993b0c1D7faf17c73;
// --- ARB Mainnet ---

// Create2 Factory
address constant MAINNET_CREATE2FACTORY = address(0);
address constant MAINNET_CREATE2FACTORY = 0x6EDb251053B4F7670C98e18bbEA20818367b4C0f;

// Protocol Token
address constant MAINNET_PROTOCOL_TOKEN = address(0);
Expand All @@ -81,7 +79,9 @@ uint256 constant ORACLE_INTERVAL_PROD = 1 hours;

// Vanity address params - use `cast create2` to find salt
bytes32 constant MAINNET_SALT_SYSTEMCOIN = bytes32(uint256(0x1));
bytes32 constant MAINNET_SALT_PROTOCOLTOKEN = bytes32(uint256(0x1));
bytes32 constant MAINNET_SALT_PROTOCOLTOKEN_X = 0x9b1a9c8e5919ef7cfcbfc9bca7a4e864a4cb000e481d77291abf03c358055d0f; // 0x000000d627d89106efd5bbFFb2aBa457310e04AA
bytes32 constant MAINNET_SALT_PROTOCOLTOKEN_XX = 0xc9a9fed357826f89be546dd81e107a64fd2feab41f85119fc682ecdc3d209ae2; // 0x00000D6e081E063dfA1c0e4F71D60E29ff5BC26c
bytes32 constant MAINNET_SALT_PROTOCOLTOKEN = 0xb2c552ad83cd8e190b3d170a646188c6a64fc6dda47a1ae28748fc0f6c53ce65; // 0x000D636bD52BFc1B3a699165Ef5aa340BEA8939c
bytes32 constant MAINNET_SALT_VAULT721 = bytes32(uint256(0x1));

// Camelot Relayer (pre-deployed @ sol 0.7.6)
Expand Down
2 changes: 1 addition & 1 deletion script/predeployment/DeployODCreate2Factory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ contract DeployODCreate2FactorySepolia is Script {

function run() public {
vm.startBroadcast(vm.envUint('ARB_SEPOLIA_DEPLOYER_PK'));
create2 = new ODCreate2Factory(TEST_DEPLOYER);
create2 = new ODCreate2Factory(vm.envAddress('ARB_SEPOLIA_PC'));
vm.stopBroadcast();
}
}
18 changes: 15 additions & 3 deletions script/predeployment/DeployProtocolToken.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,22 @@ import {OpenDollarGovernance, ProtocolToken, IProtocolToken} from '@contracts/to
import {IODCreate2Factory} from '@interfaces/factories/IODCreate2Factory.sol';

// BROADCAST
// source .env && forge script DeployProtocolTokenMainnet --skip-simulation --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_SEPOLIA_RPC --broadcast --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY
// source .env && forge script DeployProtocolTokenMainnet --skip-simulation --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_MAINNET_RPC --broadcast --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY

// SIMULATE
// source .env && forge script DeployProtocolTokenMainnet --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_SEPOLIA_RPC
// source .env && forge script DeployProtocolTokenMainnet --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_MAINNET_RPC

/**
* @dev forge script to generate salt
* ProtocolToken
* cast create2 --starts-with 000D6 --case-sensitive --deployer 0x6EDb251053B4F7670C98e18bbEA20818367b4C0f --init-code-hash 0xefe18de3888fd4c30afdd243d43fa8763c95e8ed0faa142f76a67d94062b3c83
*
* SystemCoin
* cast create2 --starts-with 000D011A --case-sensitive --deployer 0x6EDb251053B4F7670C98e18bbEA20818367b4C0f --init-code-hash 0x2c2da24cf8ff20a033122ffbcaa010c6edbc1b0a17ae658667c45c8b28d54a75
*
* Vault721
* cast create2 --starts-with 0005AFE --case-sensitive --deployer 0x6EDb251053B4F7670C98e18bbEA20818367b4C0f --init-code-hash 0x72826cfc58dad84e93750b991b5b55307bccd08ec741ca412a5b01a465ac2c65
*/

contract DeployProtocolTokenMainnet is Script, Test {
IODCreate2Factory internal _create2 = IODCreate2Factory(MAINNET_CREATE2FACTORY);
Expand Down Expand Up @@ -67,7 +79,7 @@ contract DeployProtocolTokenSepolia is Script, Test {
emit log_named_address('ODG deployment', _protocolToken);

IProtocolToken(_protocolToken).initialize('Open Dollar Governance', 'ODG');
IProtocolToken(_protocolToken).mint(TEST_SAFE, 10_000_000 * 1e18);
IProtocolToken(_protocolToken).mint(vm.envAddress('ARB_SEPOLIA_PC'), 10_000_000 * 1e18);

vm.stopBroadcast();
}
Expand Down
9 changes: 3 additions & 6 deletions script/testScripts/create2/ComputeAddress.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ import {Vault721} from '@contracts/proxies/Vault721.sol';
// source .env && forge script ComputeAdress --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_SEPOLIA_RPC

/**
* cast create2 --starts-with FEE --case-sensitive --deployer 0xd7729CC26096035e1A7e834cE0b72599Da25FA7f --init-code-hash 0x2c2da24cf8ff20a033122ffbcaa010c6edbc1b0a17ae658667c45c8b28d54a75
* Salt: 0x46320220579d213d0446f6f1fb03407627be45d5215e7d705569a5346288aa97
* cast create2 --starts-with 00D0 --case-sensitive --deployer 0xC5f2C81d16764908B18379D95f410912d928Adc2 --init-code-hash 0x2c2da24cf8ff20a033122ffbcaa010c6edbc1b0a17ae658667c45c8b28d54a75
*
* cast create2 --starts-with FEEe --case-sensitive --deployer 0xd7729CC26096035e1A7e834cE0b72599Da25FA7f --init-code-hash 0xefe18de3888fd4c30afdd243d43fa8763c95e8ed0faa142f76a67d94062b3c83
* Salt: 0xc262cd83fe003707ee84344a60b91f7fe4ecf9f2699c79415942c5277e5a3985
* cast create2 --starts-with 00D --case-sensitive --deployer 0xC5f2C81d16764908B18379D95f410912d928Adc2 --init-code-hash 0xefe18de3888fd4c30afdd243d43fa8763c95e8ed0faa142f76a67d94062b3c83
*
* cast create2 --starts-with FEE --case-sensitive --deployer 0xd7729CC26096035e1A7e834cE0b72599Da25FA7f --init-code-hash 0x72826cfc58dad84e93750b991b5b55307bccd08ec741ca412a5b01a465ac2c65
* Salt: 0x2bfa56b0ce602655b440d2aa008f0900d12ef45823378bf9cb8d32eba74439c3
* cast create2 --starts-with 00D --case-sensitive --deployer 0xC5f2C81d16764908B18379D95f410912d928Adc2 --init-code-hash 0x72826cfc58dad84e93750b991b5b55307bccd08ec741ca412a5b01a465ac2c65
*/
contract ComputeAdress is Script, Test {
bytes internal _systemTokenInitCode;
Expand Down

0 comments on commit 09a0cf2

Please sign in to comment.