Function: _handleBridging(address _assetContract, bool _transferAsset, byte[32] _receiver, uint256 _amount, uint256 _messageToll, uint256 _mojoToTokenFactor)
This function is used to build message contents and send a message to the portal contract.
Inputs
_assetContractControl: Arbitrary.
Constraints: None.
Impact: Address of the ERC-20 token to bridge.
_transferAssetControl: Arbitrary.
Constraints: None.
Impact: Whether to transfer the asset to this contract or not.
_receiverControl: Arbitrary.
Constraints: None.
Impact: Receiver puzzle hash for the wrapped tokens (receiver address).
_amountControl: Arbitrary.
Constraints: None.
Impact: Amount of CAT tokens to be minted on Chia, in Mojos.
_messageTollControl: Arbitrary.
Constraints: None.
Impact: Value of the message toll.
_mojoToTokenFactorControl: Arbitrary.
Constraints: None.
Impact: A power of 10 to convert from CAT amount (Mojos) to the ERC-20 token's smallest unit.
Branches and code coverage
Intended branches
Calculate the transfer tip.
Build message contents.
If
_transferAssetis true, transfer the asset to this contract from the sender.Transfer the tip to the portal.
Send a message to the portal.
Negative behavior
Revert if the amount is less than the transfer tip.