andrecronje / anyswap-v1-core

Anyswap core libraries and assets for permissionless cross-chain AMM swaps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could we add a crossChainContextCall?

hope2028 opened this issue · comments

function anyCall(address[] memory to, bytes[] memory data, address[] memory callbacks, uint[] memory nonces, uint toChainID) external {
emit LogAnyCall(msg.sender, to, data, callbacks, nonces, cID(), toChainID);
}

Thanks for creating this method for us, it's very useful for us. And we also hope we can add a crosschainContextCall method. As sometimes, we need to pass the trust from one contract to another contract, like contract a trust contract b. And this may happen between chains. Contract a is on chain a', and contract b is on chain b'. Therefore, could we add a crossChainContextCall like the following pseudo code.

function crossChainContextCall(address memory to, bytes memory param, address memory callback, uint memory nonce, uint toChainID) external {
        bytes[] memory data = encodeContextCall(param);
        emit LogAnyCall(msg.sender, to, data, callbacks, nonces, cID(), toChainID);
}

function encodeContextCall(bytes param) external pure returns (bytes memory) {
        return abi.encodeWithSignature("contextCall(address,address,bytes)", tx.origin, msg.sender, param);
}