Interacting with closed source contract

bytecodesolidity

I am an experienced developer but relatively new to blockchain development. There is a close source contract that I can interact with via the provider's web interface. The screenshot below is the receipt of one of the transactions.

If I can work out what the params are and inject my own data, how do I make a call to this contract from my own contract (in Solidity)?

Transaction Receipt


Update:
As pointed out by Alex's answer, the screenshot above is the event emitted by the contract, not the function call metadata. The new screenshot below is of the transaction overview with Input Data.

Transaction made with Contract

I'm now trying to figure out how to make a call to this payable function using the suggested code below:

contract CallsFunctions {
    // for when you want to call any function on any contract
    function callAnything(address contractAddress, bytes memory args) payable external {
        (bool success, ) = contractAddress.call{ gas: 100000, value: msg.value }(args);
        require(success);
    }
}

In Remix, when I attempt to make a transaction, I get the following error:

Gas estimation errored with the following message (see below). The
transaction execution will likely fail. Do you want to force sending?
Internal JSON-RPC error. { "code": -32000, "message": "execution
reverted" }

Making transaction from Remix


I have confirmed that the input data (args) is correct by attempting to make a transaction from the provider's web interface, then copy/paste the pre-signed data into Remix. I tried this on a test net with a custom callee contract and it worked fine.


Update:
I tried to deploy a custom callee contract that disallows other contracts, the call returned the same error. I have came to a conclusion that the contract that I'm trying to interact with also blocks contracts.

Best Answer

You are viewing the logs for that transaction, which are data for the events emitted in response to a function call. Calling those doesn't do anything. If you have the etherscan page, what you should be looking for is the "Input Data" section in the "Overview" tab to see the actual method that was called and its input data (example in image). enter image description here

From there, you can create a smart contract that calls those functions specifically OR one that arbitrarily interacts with functions by passing in the function signature and its arguments as bytes (it will look like the value of the Input Data field from the screenshot). Dummy code for accomplishing both is below:

contract ArbitraryFunctions is IArbitraryFunctions {
    uint public stateVar;
    address public stateAddr;
    function first(uint val, address addr) public override {
        // does something
    }
}

contract CallsFunctions {
    // for when you know the name of the method you want to call
    function callArbitraryFunctionsContract(address contractAddress, uint callVal, address callAddr) public {
        ArbitraryFunctions(contractAddress).first(callVal, callAddr);
    }
    
    // for when you want to call any function on any contract
    function callAnything(address contractAddress, bytes memory args) public {
        (bool success, ) = contractAddress.call(args);
        require(success);
        // do something
    }
}