yarn run audit-H1:internal-to-address
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.7;

/// @title Smart Contract Waller
/// @author Code4rena Warden
/// @notice This is not a complete wallet, it is just for demonistrating the vulnerability
contract InternalWallet {
    // to be able to receive ETH
    receive() external payable {}

    // Sending funds to `TSS_ADDRESS` to receive it on zetachain account
    // NOTE: this function should fail, and the funds will be locked in the `TSS_ADDRESS` when sending
    function transferOmnichain(uint256 amount, address tssAddress, bytes memory to) public payable returns (bool) {
        require(amount <= address(this).balance, "InternalWallet: not enough suffiecent");
        (bool success, ) = tssAddress.call{value: amount}(to);
        require(success, "InternalWallet: failed to make Omnichain call");
        return true;
    }

    // Withdraw funds after completeing testing
    function withdraw(address to) public returns (bool) {
        (bool success, ) = to.call{value: address(this).balance}("");
        require(success, "InternalWallet: failed to withdraw funds");
        return true;
    }
}
func (ob *EVMChainClient) observeInTX() error {
    ...
    
    //task 1:  Query evm chain for zeta sent logs
    func() { ... }()
    
    // task 2: Query evm chain for deposited logs
    func() { ... }()
    
    // task 3: query the incoming tx to TSS address ==============
    func() {
        tssAddress := ob.Tss.EVMAddress() // after keygen, ob.Tss.pubkey will be updated
        if tssAddress == (ethcommon.Address{}) {
            ob.logger.ExternalChainWatcher.Warn().Msgf("observeInTx: TSS address not set")
            return
        }
    
        // query incoming gas asset
        for bn := startBlock; bn <= toBlock; bn++ {
            ...
    
            for _, tx := range block.Transactions() {
                ...
    
                // Checking for tx.to only not including internal transactions for each transaction
                if *tx.To() == tssAddress { ... }
            }
        }
    }()
...
}
 Method: 4696616c // transferOmnichain(uint256,address,bytes)
 ------------
 [000]: 000000000000000000000000000000000000000000000000016345785d8a0000 // amount sent 
 [020]: 0000000000000000000000008531a5ab847ff5b22d855633c25ed1da3255247e // tssAddress
 [040]: 0000000000000000000000000000000000000000000000000000000000000060 // The location of the bytes array
 [060]: 0000000000000000000000000000000000000000000000000000000000000014 // bytes array length hex(14) = 20 bytes
 [080]: 0a485f234d49f28b688495d071d164e7db0cbd9a000000000000000000000000 // The bytes array data (receiver address on ZetaChain)
