Created
May 23, 2022 13:39
-
-
Save shredding/b6ec90b6300ea8057ec6444a59e2b4be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: UNLICENSED | |
pragma solidity 0.8.13; | |
import {Router} from "@abacus-network/app/contracts/Router.sol"; | |
contract Playground is Router { | |
constructor(address abacusConnectionManager_) { | |
__AbacusConnectionClient_initialize(abacusConnectionManager_); | |
} | |
string public message; | |
function foo(uint32 destination_, string memory message_) external { | |
_dispatch( | |
destination_, | |
abi.encodeWithSelector( | |
this.handleBar.selector, | |
message_ | |
) | |
); | |
} | |
function _handle(uint32 origin_, bytes32 sender_, bytes memory message_) internal virtual override { | |
// is origin_ / sender_ validated / guaranteed to be correct? | |
address(this).call(message_); | |
} | |
function handleBar(string memory message_) external onlyInbox { | |
message = message_; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment