Assessment reports>Orderly Network>Threat Model>deposit

Function: deposit(VaultTypes.VaultDepositFE data)

This allows any caller to deposit the funds to the Vault. All data about the deposit action will be transferred to the Ledger contract in main chain.

Inputs

  • data

    • Control: Caller has full control.

    • Constraints: brokerHash and tokenHash should be allowed, user should have enough amount of tokens to deposit them.

    • Impact: The caller of this function will deposit the funds to contract.

Branches and code coverage

Intended branches

  • Check if the branch has test coverage.

  • Include function calls.

  • End sentences with periods.

Negative behavior

  • Caller is a service admin.

  • Negative behavior should be what the function requires.

Function Call Analysis

  • allowedTokenSet.contains(data.tokenHash)

    • External/Internal? Internal.

    • Argument control? data.tokenHash.

    • Impact: Return true if tokenHash is allowed. The result of this function should synchronize with the state of allowed tokens in the Ledger contact in main chain.

  • allowedBrokerSet.contains(data.brokerHash)

    • External/Internal? Internal.

    • Argument control? data.brokerHash.

    • Impact: Return true if brokerHash is allowed. The result of this function should synchronize with the state of allowed brokers in the Ledger contact in main chain.

  • Utils.validateAccountId(data.accountId, data.brokerHash, msg.sender)

    • External/Internal? Internal.

    • Argument control? data.accountId and data.brokerHash.

    • Impact: Calculate that accountId is equal to hash from data.brokerHash and msg.sender.

  • tokenAddress.safeTransferFrom(msg.sender, address(this), data.tokenAmount)

    • External/Internal? External.

    • Argument control? data.tokenAmount.

    • Impact: Transfer the amount of tokens that will be deposited. Will revert if msg.sender does not have enough tokens.

  • IVaultCrossChainManager(crossChainManagerAddress).deposit(depositData)

    • External/Internal? External.

    • Argument control? depositData.

    • Impact: Initiate the cross-chain message to keep track of the deposited funds in the Ledger contract in main chain.

Zellic © 2024Back to top ↑