- Truffle Deployer Key ("Deployer Key")
- Proxy Admin Key ("Admin Key")
- A list of currently blacklisted accounts stored in
blacklist.remote.json
-
Get the contract creation block number for the target FiatTokenProxy contract either using a block explorer, or the command below.
$ yarn truffle exec scripts/getContractCreationBlock.js ${FiatTokenProxy address} --network ${NETWORK}
-
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 truffle exec scripts/getBlacklistedAccounts.js ${FiatTokenProxy address} ${startBlockNumber} --network ${NETWORK}
-
Ensure that the
config.js
file in the project root folder is configured with the correct values. The environment variablesPROXY_ADMIN_ADDRESS
,PROXY_CONTRACT_ADDRESS
must be defined. -
Set the
NETWORK
variable to the network that you will like to deploy to in your terminal. Ensure that theNETWORK
that the contracts are to be deployed to are defined in./truffle-config.js
.$ NETWORK=<mainnet|ropsten>;
-
Look for the
deploy_v2_2
anddeploy_v2_2_upgrader
scripts in./migrations/
. Set theMIGRATION_START
andMIGRATION_END
variables based off the migration numbers of these scripts.$ MIGRATION_START=<first_migration_number> $ MIGRATION_END=<last_migration_number>
-
Ensure that the
blacklist.remote.json
file in the project root folder is configured with the correct list of addresses to blacklist. -
Run Truffle migrations using the Deployer Key, and get the address of the newly deployed
V2_2Upgrader
contract.$ yarn migrate --network ${NETWORK} --f ${MIGRATION_START} --to ${MIGRATION_END} ... ... Dry-run successful. Do you want to proceed with real deployment? >> (y/n): y ... ... >>>>>>> Deployed V2_2Upgrader at 0x12345678 <<<<<<<
-
Verify that the upgrader contract is deployed correctly. Verify that the values returned by
proxy()
,implementation()
andnewProxyAdmin()
on theV2_2Upgrader
contract are correct either using a block explorer, or the command below.$ yarn compile $ yarn truffle exec scripts/callContractROFunctions.js --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 theV2_2Upgrader
contracthelper()
method, and verify that the return values of each view methods correspond with theFiatTokenProxy
contract to be upgraded either using a block explorer, or the command below.$ yarn compile $ yarn truffle exec scripts/callContractROFunctions.js --network ${NETWORK} \ --contract-name V2_2Upgrader --contract-address ${V2_2Upgrader address} \ helper $ yarn truffle exec scripts/callContractROFunctions.js --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 truffle exec scripts/callContractROFunctions.js --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 truffle exec scripts/validateAccountsToBlacklist.js ${FiatTokenProxy address} ${V2_2Upgrader address} --network=${NETWORK}
-
Using the Admin Key, transfer the proxy admin role to the
V2_2Upgrader
contract address by callingchangeAdmin(address)
method on theFiatTokenProxy
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 theV2_2Upgrader
.
- Verify that the proxy admin role is transferred back to the Admin Key.
- No further action needed.
- If the transaction fails, any state change that happened during the
upgrade
function call will be reverted. - Call
abortUpgrade()
(0xd8f6a8f6
) method on theV2_2Upgrader
contract to tear it down.
FiatToken version 2.2 supports signature validation on the ERC-2612 and ERC-3009 features for ERC-1271 compatible wallets. You may test this with a sample ERC-1271 wallet to the network.
- Prepare a FiatToken version 2.2 contract for testing. If a FiatToken contract has never been deployed to the network, follow the steps in the deployment doc to deploy the contract to the network. Otherwise, follow the steps above to upgrade your FiatToken contract to version 2.2.
- Prepare an address A (Wallet Owner Address) that you own the private key to. This address does not require any chain-native token (e.g. ETH) for gas usage.
- Prepare an address B (Relayer Address) that you own the private key to. Add some chain-native token (e.g. ETH) to this address to pay for gas.
-
Look for the
deploy_erc1271_wallet
scripts in./migrations/
. Set theMIGRATION_START
andMIGRATION_END
variables based off the migration numbers of these scripts.$ MIGRATION_START=<first_migration_number> $ MIGRATION_END=<last_migration_number>
-
Set the
MOCK_ERC1271_WALLET_OWNER_ADDRESS
in yourconfig.js
file to address A. -
Run Truffle migrations using the Deployer Key, and get the address of the newly deployed
MockERC1271Wallet
contract.$ yarn migrate --network ${NETWORK} --f ${MIGRATION_START} --to ${MIGRATION_END} ... ... Dry-run successful. Do you want to proceed with real deployment? >> (y/n): y ... ... >>>>>>> Deployed MockERC1271Wallet at 0x12345678 <<<<<<<
-
Generate a
permit
transaction signature using address A. This transaction signature would update the allowance of a designated spender to pull funds from the deployed smart contract wallet (MockERC1271Wallet). -
Broadcast the signed transaction using address B. You may rely on public tools (example for ETH mainnet) to complete this step.
-
The transaction should succeed and the allowance should also be updated. You may validate these using a block explorer.