Hi. I am Hyung from B-Harvest.
We are doing various R&D for Canto contribution, including Liquid Staking development, Ethermint R&D and also this topic.
We are suggesting the second CPIP candidate to improve Canto onboarding UX from Ethereum.
Please feel free to drop any feedback so that we can suggest improved version of the document.
Canto Onboarding UX Improvement Feature
Introduction
B-Harvest suggests to implement below functionality on Canto-SDK to
- Improve the UX for onboarding Canto by solving problem having no Canto for gas usage
- Allow transferring Ethereum assets to Canto EVM by single transaction on Ethereum
Problem
When users onboard to Canto from Ethereum, they need little amount of Canto for gas. However, since they don’t have any Canto, they are unable to proceed:
- Create an address on Canto EVM
- Convert their sdk assets to ERC20 on Canto EVM
- Swap their Ethereum assets to Canto for gas usage
Suggested Solution
When users transfer assets to the Canto network through Gravity Bridge, the IBC transfer automatically triggers swap and conversion to Canto ERC20 via IBC middleware.
Entire Process Description
- IBC arrival from Gravity Bridge → (if users do not have more than 4 Canto) swap necessary portion of arrived tokens to get 4 Canto → convert rest of arrived tokens to Canto ERC20
- The process is non-atomic, meaning that even if the swap or conversion fails, it does not revert IBC transfer
Swap Process
- Process
- IBC middleware hooks swap msg upon IBC arrival from Gravity Bridge
- If the address has less Canto than certain amount(4 Canto), swap proportion of transferred assets to Canto
- Using exactOut swap, user gets exactly 4 Canto
- The AMM
- For AMM, we uses existing Coinswap v1.6 (link) AMM module (basic XYK) from IrisNet including following changes:
- Whitelist of token pairs which can be created
- Pool creation fails if the token pair is not in the whitelist
- Initial whitelist :
Canto/USDC.grv
,Canto/USDT.grv
,Canto/ETH.grv
- Limit number of Canto for each pool
- Deposit fails when amount of Canto for the pool exceeds 10,000 Canto
- Disable double swap
- Whitelist of token pairs which can be created
- For AMM, we uses existing Coinswap v1.6 (link) AMM module (basic XYK) from IrisNet including following changes:
- Risk Management
- Swap fails when:
- input coin amount exceeds pre-defined limit ( 10 USDC, 10 USDT, 0.01 ETH)
- swap amount limit is not defined
- Swap fails when:
Conversion Process
- Auto convert transferred asset to Canto ERC20
- Evmos reference (link)
Rejected Alternative Solution
Modify the AnteHandler to set transaction fees to zero under certain conditions, such as account state, transaction types, destination EVM contracts, and others.
- This solution enables users to perform the onboarding process without incurring additional gas consumption
- Opening up zero transaction fees increases the possibility of spamming attacks