deployer touchup; deploy script

This commit is contained in:
Tim Olson
2023-09-01 18:58:55 -04:00
parent 75150949dd
commit 44f17c14c1
6 changed files with 42 additions and 0 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
cache/ cache/
out/ out/
.idea/ .idea/
.env

2
bin/deploy.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
forge script script/Deploy.sol --fork-url http://localhost:8545 --broadcast

21
bin/reset.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
#cd ../server
#pwd
#db-migrate down
#db-migrate up
#cd ../contract
anvil -f arbitrum_ankr &
ANVIL_PID=$!
sleep 2
forge script script/Deploy.sol --fork-url http://localhost:8545 --broadcast
trap_ctrlc() {
echo
kill $ANVIL_PID
}
trap trap_ctrlc INT
# wait for all background processes to terminate
wait

View File

@@ -18,3 +18,4 @@ gas_reports_ignore = []
arbitrum_alchemy='https://arb-mainnet.g.alchemy.com/v2/L0eaUwWEoWzszCK9EhqHdl_p7VHStkaC' arbitrum_alchemy='https://arb-mainnet.g.alchemy.com/v2/L0eaUwWEoWzszCK9EhqHdl_p7VHStkaC'
arbitrum_ankr='https://rpc.ankr.com/arbitrum/056ed471570655a3bb77cf31b9e3576658d63d2acb88911f84e7acaf211b55ac' arbitrum_ankr='https://rpc.ankr.com/arbitrum/056ed471570655a3bb77cf31b9e3576658d63d2acb88911f84e7acaf211b55ac'
arbitrum_publicnode='https://arbitrum-one.publicnode.com' arbitrum_publicnode='https://arbitrum-one.publicnode.com'
arbitrum_quicknode='https://muddy-methodical-sheet.arbitrum-mainnet.discover.quiknode.pro/9e24248720b067953db96d462c8dd131a0a234b0/'

14
script/Deploy.sol Normal file
View File

@@ -0,0 +1,14 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
import "forge-std/Script.sol";
import "../src/VaultDeployer.sol";
contract Deploy is Script {
function run() external {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);
VaultDeployer deployer = new VaultDeployer{salt:keccak256(abi.encode(1))}();
vm.stopBroadcast();
}
}

View File

@@ -10,11 +10,14 @@ contract VaultDeployer {
address owner; address owner;
} }
event VaultCreated( address deployer, address owner );
Parameters public parameters; Parameters public parameters;
function deployVault(address owner) public returns (address vault) { function deployVault(address owner) public returns (address vault) {
parameters = Parameters(owner); parameters = Parameters(owner);
vault = address(new Vault{salt: keccak256(abi.encode(owner))}()); vault = address(new Vault{salt: keccak256(abi.encode(owner))}());
delete parameters; delete parameters;
emit VaultCreated( address(this), owner );
} }
} }