Assessment reports>warpdotgreen-cli>Threat Model>_handleBridging

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

  • _assetContract

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Address of the ERC-20 token to bridge.

  • _transferAsset

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Whether to transfer the asset to this contract or not.

  • _receiver

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Receiver puzzle hash for the wrapped tokens (receiver address).

  • _amount

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Amount of CAT tokens to be minted on Chia, in Mojos.

  • _messageToll

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Value of the message toll.

  • _mojoToTokenFactor

    • Control: 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 _transferAsset is 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.

Zellic © 2024Back to top ↑