Created
November 8, 2022 09:48
-
-
Save Reinis-FRP/1d6b5517f5585c3d8d663fa38d16643d to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
This file contains 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: AGPL-3.0-only | |
pragma solidity 0.8.16; | |
interface OracleInterface { | |
function request() external; | |
} | |
abstract contract AssertorInterface { | |
OracleInterface public oracle; | |
} | |
contract Wrapper { | |
OracleInterface public oracle; | |
AssertorInterface public assertor; | |
constructor(AssertorInterface _assertor) { | |
oracle = _assertor.oracle(); | |
assertor = _assertor; | |
} | |
event WrappedAsserted(address _this, address _sender); | |
function wrappedAssert() external { | |
emit WrappedAsserted(address(this), msg.sender); | |
address(assertor).delegatecall(abi.encodeWithSignature("assert()")); | |
} | |
} | |
contract Assertor { | |
OracleInterface public oracle; | |
constructor(OracleInterface _oracle) { | |
oracle = _oracle; | |
} | |
event Asserted(address _this, address _sender); | |
function assert() external { | |
oracle.request(); | |
emit Asserted(address(this), msg.sender); | |
} | |
} | |
contract Oracle { | |
event Requested(address _this, address _sender); | |
function request() external { | |
emit Requested(address(this), msg.sender); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment