Decrypting
Last updated
Last updated
Decrypting is the process of converting your confidential FHERC20 balance back into a public ERC20 balance. This process has 2 steps:
Decrypting some amount of FHERC20
Claiming the decrypted amount as ERC20
After selecting the FHERC20 token to decrypt and the amount to decrypt, we execute the Decrypt transaction. In ConfidentialERC20.sol the function decrypt()
is used, which burns the FHERC20 and requests an on-chain FHE decryption of the amount burned. Once the on-chain FHE decryption is finalized, that amount is marked as "Claimable" and can be claimed as the underlying ERC20 in the upcoming step.
In Redact, this is the expected Decrypt flow:
After the Decryption transaction has succeeded, you can note that in the wallet the public ERC20 balance has been replaced with two balances: The public balance, and the claimable balance.
You can claim these decrypted tokens either from the main page component, or from within the wallet using the CLAIM button
After the successful on-chain FHE decryption has resolved, we are ready to claim the ERC20s. Claiming will add the claimable amount to your ERC20 balance, and in Redact it looks like this:
In order to encrypt (or wrap) your ERC20 tokens, they must first approve them for use in the ConfidentialERC20 smart contract. Only the amount to wrap must be approved.
In the Redact UI, this is step 2 of the wrapping process, and appears like so:
TX:
Tx:
If you would like to read more about claiming take a look here: