Skip to content

Instantly share code, notes, and snippets.

@shredding
Created May 23, 2022 13:39
Show Gist options
  • Select an option

  • Save shredding/b6ec90b6300ea8057ec6444a59e2b4be to your computer and use it in GitHub Desktop.

Select an option

Save shredding/b6ec90b6300ea8057ec6444a59e2b4be to your computer and use it in GitHub Desktop.

Revisions

  1. shredding created this gist May 23, 2022.
    32 changes: 32 additions & 0 deletions Playground.sol
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    // 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_;
    }
    }