- 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.
startBlockNumbershould 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.jsfile in the project root folder is configured with the correct values. The environment variablesPROXY_ADMIN_ADDRESS,PROXY_CONTRACT_ADDRESSmust be defined. -
Set the
NETWORKvariable to the network that you will like to deploy to in your terminal. Ensure that theNETWORKthat the contracts are to be deployed to are defined in./truffle-config.js.$ NETWORK=<mainnet|ropsten>;
-
Look for the
deploy_v2_2anddeploy_v2_2_upgraderscripts in./migrations/. Set theMIGRATION_STARTandMIGRATION_ENDvariables based off the migration numbers of these scripts.$ MIGRATION_START=<first_migration_number> $ MIGRATION_END=<last_migration_number>
-
Ensure that the
blacklist.remote.jsonfile 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_2Upgradercontract.$ 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_2Upgradercontract 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_2UpgraderHelpercontract is deployed correctly. Retrieve the address from theV2_2Upgradercontracthelper()method, and verify that the return values of each view methods correspond with theFiatTokenProxycontract 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_2Upgradercontract address by callingchangeAdmin(address)method on theFiatTokenProxycontract. -
Send 0.20 FiatToken (eg USDC) to the
V2_2Upgradercontract 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
upgradefunction call will be reverted. - Call
abortUpgrade()(0xd8f6a8f6) method on theV2_2Upgradercontract 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_walletscripts in./migrations/. Set theMIGRATION_STARTandMIGRATION_ENDvariables based off the migration numbers of these scripts.$ MIGRATION_START=<first_migration_number> $ MIGRATION_END=<last_migration_number>
-
Set the
MOCK_ERC1271_WALLET_OWNER_ADDRESSin yourconfig.jsfile to address A. -
Run Truffle migrations using the Deployer Key, and get the address of the newly deployed
MockERC1271Walletcontract.$ 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
permittransaction 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.