---
# System prepended metadata

title: Untitled

---

    /**
        @notice A deposit is initiated by making a deposit in the Bridge contract.
        @param resourceID ResourceID used to find address of contract to be used for deposit.
        @param depositor Address of the account making deposit in the Bridge contract.
        @param data Structure should be constructed as follows:
          maxFee:                       uint256  bytes  0                                                                                      -  32
          len(executeFuncSignature):    uint16   bytes  32                                                                                     -  34
          executeFuncSignature:         bytes    bytes  34                                                                                     -  34 + len(executeFuncSignature)
          len(executeContractAddress):  uint8    bytes  34 + len(executeFuncSignature)                                                         -  35 + len(executeFuncSignature)
          executeContractAddress        bytes    bytes  35 + len(executeFuncSignature)                                                         -  35 + len(executeFuncSignature) + len(executeContractAddress)
          len(metadataDepositor):       uint8    bytes  35 + len(executeFuncSignature) + len(executeContractAddress)                           -  36 + len(executeFuncSignature) + len(executeContractAddress)
          metadataDepositor:            bytes    bytes  36 + len(executeFuncSignature) + len(executeContractAddress)                           -  36 + len(executeFuncSignature) + len(executeContractAddress) + len(metadataDepositor)
          executionData:                bytes    bytes  36 + len(executeFuncSignature) + len(executeContractAddress) + len(metadataDepositor)  -  END
     */
    function deposit(bytes32 resourceID, address depositor, bytes calldata data) external returns (bytes memory) {
        require(data.length > 160, "Incorrect data length");

        uint256        maxFee;
        uint16         lenExecuteFuncSignature;
        bytes   memory executeFuncSignature;
        uint8          lenExecuteContractAddress;
        bytes   memory executeContractAddress;
        uint8          lenMetadataDepositor;
        bytes   memory metadataDepositor;
        bytes   memory executionData;

        (maxFee, lenExecuteFuncSignature) = abi.decode(data, (uint256, uint16));
        executeFuncSignature              = bytes(data[34:34 + lenExecuteFuncSignature]);
        lenExecuteContractAddress         = bytes(data[34 + lenExecuteFuncSignature:35 + lenExecuteFuncSignature]);
        executeContractAddress            = bytes(data[35 + lenExecuteFuncSignature:35 + lenExecuteFuncSignature + lenExecuteContractAddress]);
        lenMetadataDepositor              = bytes(data[35 + lenExecuteFuncSignature + lenExecuteContractAddress:36 + lenExecuteFuncSignature + lenExecuteContractAddress]);
        metadataDepositor                 = bytes(data[36 + lenExecuteFuncSignature + lenExecuteContractAddress:36 + lenExecuteFuncSignature + lenExecuteContractAddress + lenMetadataDepositor]);
        executionData  
    }