Callback
// Example external contract that uses InitCore's callback
contract ExternalContract {
function coreCallback(address sender, bytes calldata data) external payable returns (bytes memory result) {
// check msg.sender is InitCore
require(msg.sender == INIT_CORE, 'sender not allowed');
// perform a swap on a DEX
// returns bytes result
}
function executeCallback(bytes calldata data) payable {
IInitCore(INIT_CORE).callback{value: msg.value}(msg.sender, data);
}
}Last updated