Events – How to Subscribe to Native Ethereum Transfer from Argent Wallets

eventssmart-contract-wallets

I am wondering how do I subscribe to native ETH transfer events such as this one https://etherscan.io/tx/0x7357f1f0885811b2888dad7e7b1aa0f3016c7b0f8a179e37e463d5e941889bab#eventlog with topic[0]: 0x7d2476ab50663f025cff0be85655bcf355f62768615c0c478f3cd5293f807365.

If my understanding is correct, from the docs linked below, this is a native ETH transfer from the Argent Relayer EOA to the BaseWallet contract invoked by some Module contracts.

https://github.com/argentlabs/argent-contracts/blob/develop/specifications/specifications.pdf
https://docs.argent.xyz/wallet-connect-and-argent#meta-transactions-and-relayers

My question is where is the specific event/function for this? I tried looking through the smart contract code https://github.com/argentlabs/argent-contracts, attempting to find the event signature that I can use the ABI to extract the event from the log but I could not find the appropriate event. Is this an anonymous event without an explicit event signature? How should I securely identified the transfer from the log?

My current approach is to match the event logs with topic[0]: 0x7d2476ab50663f025cff0be85655bcf355f62768615c0c478f3cd5293f807365 then get the sender, recipient and value from topics[1,2,3] accordingly. Is this the way to do it and is this secure?

Best Answer

You can search for known event signatures in the Ethereum Signature Database.

It corresponds to Invoked(address,address,uint256,bytes).

Using Etherscan vmtrace it reveals it is calling invoke functiun from BaseWallet. It performs the transfer with .call() and emits the invoke event.

function invoke(address _target, uint _value, bytes calldata _data) external moduleOnly returns (bytes memory _result) {
    bool success;
    // solium-disable-next-line security/no-call-value
    (success, _result) = _target.call.value(_value)(_data);
    if (!success) {
        // solium-disable-next-line security/no-inline-assembly
        assembly {
            returndatacopy(0, 0, returndatasize)
            revert(0, returndatasize)
        }
    }
    emit Invoked(msg.sender, _target, _value, _data);
}
Related Topic