Created
September 1, 2021 20:14
-
-
Save lucas-manuel/7a137e70d2afffa40355a3b2934d80cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
export ETH_GAS=4000000 | |
########################################################## | |
## Deploy ProxyFactory, InitializerV1, ImplementationV1 ## | |
########################################################## | |
echo 'Deploying ProxyFactory' | |
PROXY_FACTORY=$(dapp create ProxyFactory) | |
echo 'Deploying InitializerV1' | |
INITIALIZER_V1=$(dapp create MockInitializerV1) | |
echo 'Deploying ImplementationV1' | |
IMPLEMENTATION_V1=$(dapp create MockV1) | |
######################################################## | |
## Register Version 1 and ImplementationV1 in Factory ## | |
######################################################## | |
echo 'Registering Implementation' | |
seth send $PROXY_FACTORY 'registerImplementation(uint256,address,address)' 1 $IMPLEMENTATION_V1 $INITIALIZER_V1 | |
echo 'Setting Recommended Version' | |
seth send $PROXY_FACTORY 'setRecommendedVersion(uint256)' 1 | |
####################################### | |
## Deploy New Proxy Instance with V1 ## | |
####################################### | |
# new bytes(0) | |
ENCODED_V1_INIT_PARAMS=0x0000000000000000000000000000000000000000000000000000000000002382 | |
echo 'Deploying New Proxy Instance with V1' | |
seth send $PROXY_FACTORY 'newInstance(bytes)' $ENCODED_V1_INIT_PARAMS | |
############################################### | |
## Deploy InitializerV2 and ImplementationV2 ## | |
############################################### | |
echo 'Deploying InitializerV2' | |
INITIALIZER_V2=$(dapp create MockInitializerV2) | |
echo 'Deploying ImplementationV2' | |
IMPLEMENTATION_V2=$(dapp create MockV2) | |
######################################################## | |
## Register Version 2 and ImplementationV2 in Factory ## | |
######################################################## | |
echo 'Registering Implementation' | |
seth send $PROXY_FACTORY 'registerImplementation(uint256,address,address)' 2 $IMPLEMENTATION_V2 $INITIALIZER_V2 | |
echo 'Setting Recommended Version' | |
seth send $PROXY_FACTORY 'setRecommendedVersion(uint256)' 2 | |
####################################### | |
## Deploy New Proxy Instance with V2 ## | |
####################################### | |
# abi.encode(10, 20, 30) | |
ENCODED_V2_INIT_PARAMS=0x000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000014 | |
echo 'Deploying New Proxy Instance' | |
seth send $PROXY_FACTORY 'newInstance(bytes)' $ENCODED_V2_INIT_PARAMS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment