blacklist.remote.json
Get the contract creation block number for the target FiatTokenProxy contract either using a block explorer, or the command below.
$ yarn hardhat getContractCreationBlock --network ${NETWORK} ${FiatTokenProxy address}
Get a list of accounts that are currently blacklisted on the target
FiatTokenProxy contract by running the following command. startBlockNumber
should be set to the contract creation block number of the target
FiatTokenProxy contract.
$ yarn hardhat downloadBlacklistedAccounts --network ${NETWORK} \
--proxy-address ${FiatTokenProxy address} \
--start-block-number ${startBlockNumber}
From project root folder, make a copy of .env.example
and name the file
.env
. Ensure .env
is configured with the correct values. The environment
variables PROXY_ADMIN_ADDRESS
, FIAT_TOKEN_PROXY_ADDRESS
must be defined.
Set the NETWORK
variable to the network that you will like to deploy to in
your terminal.
$ NETWORK=<mainnet|testnet>;
Look for the deploy-impl-and-upgrader.s.sol
script in
./scripts/deploy/
. Ensure the the following variables
are correctly configured in your local .env
file:
$ DEPLOYER_PRIVATE_KEY=<DEPLOYER_PRIVATE_KEY>
$ FIAT_TOKEN_PROXY_ADDRESS=<FIAT_TOKEN_PROXY_ADDRESS>
$ PROXY_ADMIN_ADDRESS=<PROXY_ADMIN_ADDRESS>
$ LOST_AND_FOUND_ADDRESS=<LOST_AND_FOUND_ADDRESS>
$ TOKEN_SYMBOL=<TOKEN_SYMBOL>
# [Optional] Fill in if an implementation contract already exists
$ FIAT_TOKEN_IMPLEMENTATION_ADDRESS=<FIAT_TOKEN_IMPLEMENTATION_ADDRESS>
Ensure that the blacklist.remote.json
file in the project root folder is
configured with the correct list of addresses to blacklist.
Run foundry deploy simulation by running the following command
yarn forge:simulate scripts/deploy/deploy-impl-and-upgrader.s.sol --rpc-url $NETWORK
Validate all fields are filled in correctly.
NOTE: For additional information, you may also validate each of the
transactions to be broadcasted by checking the
./broadcast/deploy-impl-and-upgrader.s.sol/:chainId/dry-run
folder that
gets auto created in your local machine.
Deploy the contracts by running the following command
yarn forge:broadcast scripts/deploy/deploy-impl-and-upgrader.s.sol --rpc-url $NETWORK
Verify the contracts on an Etherscan flavored block explorer by running the
following command. Ensure that ETHERSCAN_KEY
is set in the .env
file.
yarn forge:verify scripts/deploy/deploy-impl-and-upgrader.s.sol --rpc-url $NETWORK
Verify that the upgrader contract is deployed correctly. Verify that the
values returned by proxy()
, implementation()
and newProxyAdmin()
on the
V2_2Upgrader
contract are correct either using a block explorer, or the
command below.
$ yarn compile
$ yarn hardhat readValuesFromContract --network ${NETWORK} \
--contract-name V2_2Upgrader \
--contract-address ${V2_2Upgrader address} \
proxy implementation newProxyAdmin
Verify that the V2_2UpgraderHelper
contract is deployed correctly. Retrieve
the address from the V2_2Upgrader
contract helper()
method, and verify
that the return values of each view methods correspond with the
FiatTokenProxy
contract to be upgraded either using a block explorer, or
the command below.
$ yarn compile
$ yarn hardhat readValuesFromContract --network ${NETWORK} \
--contract-name V2_2Upgrader \
--contract-address ${V2_2Upgrader address} \
helper
$ yarn hardhat readValuesFromContract --network ${NETWORK} \
--contract-name V2_2UpgraderHelper \
--contract-address ${V2_2UpgraderHelper address} \
name symbol decimals currency masterMinter fiatTokenOwner pauser blacklister version DOMAIN_SEPARATOR rescuer paused totalSupply
# Compare results above with
$ yarn hardhat readValuesFromContract --network ${NETWORK} \
--contract-name FiatTokenV2_1 \
--contract-address ${FiatTokenProxy address} \
name symbol decimals currency masterMinter fiatTokenOwner pauser blacklister version DOMAIN_SEPARATOR rescuer paused totalSupply
Verify that the list of accounts to blacklist is correct, and is set correctly in the upgrader contract. Run the following command to check the list.
$ yarn hardhat validateAccountsToBlacklist --network=${NETWORK} \
--proxy-address ${FiatTokenProxy address} \
--upgrader-address ${V2_2Upgrader address}
Using the Admin Key, transfer the proxy admin role to the V2_2Upgrader
contract address by calling changeAdmin(address)
method on the
FiatTokenProxy
contract.
Send 0.20 FiatToken (eg USDC) to the V2_2Upgrader
contract address.
(200,000 tokens)
Using the Deployer Key, call upgrade()
(0xd55ec697
) method on the
V2_2Upgrader
.
upgrade
function call will be reverted.abortUpgrade()
(0xd8f6a8f6
) method on the V2_2Upgrader
contract to
tear it down.