Two-step process of Signature Gated Contract Deployment
Code examples are based on viem
-
Get the contract bytecode and ABI from the endpoint
-
Deploy the contract:
const hash = await walletClient.deployContract({
abi,
bytecode,
account, // e.g. metamask account
});
- Save the deployed ERC20 address:
const receipt = await client.waitForTransactionReceipt({ hash });
const contractAddress = receipt.contractAddress;
-
Use this address as the
erc20Address
in this endpoint Get ERC1967Proxy. Provide other fields too. -
Use the call result as the parameters for deployment of ERC1967 Proxy, which is required by previously deployed upgradable ERC20:
const hash = await walletClient.deployContract({
abi,
bytecode,
args
account // e.g. metamask account
});
const receipt = await client.waitForTransactionReceipt({ hash });
const finalAddress = receipt.contractAddress;
- The upgradable and signature-gated ERC20 token is deployed at the address
finalAddress
. - Grant a desired address WHITELISTED_SPENDER_ROLE by invoking
/issuance/erc20/grantRole
. In case of Fractions Platform, this role must be given to the Wrapper of the platform in order to allow wrapping of this ERC20.