Verified contractExactMIT
GatewaySlotDataReader
Address0xcb57158b03351e37a6cec3db3bf359e84df49e18
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.25
- Same code
Only this contract
Details
- Compiler
- solc 0.8.25+commit.b61c2a91
- Language
- solidity
- Optimization
- Yes, 1 runs
- EVM version
- cancun
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 22,096,068
- Creation transaction
- 0x58bce697a0…847937e8c1
6 files
contracts/debug/GatewaySlotDataReader.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {GatewayFetchTarget, IGatewayVerifier} from '../../contracts/GatewayFetchTarget.sol';
import {GatewayFetcher, GatewayRequest} from '../../contracts/GatewayFetcher.sol';
contract GatewaySlotDataReader is GatewayFetchTarget {
using GatewayFetcher for GatewayRequest;
struct VerifierConfig {
IGatewayVerifier verifier;
address target;
address pointer;
string[] urls;
}
function uint256Callback(
bytes[] memory m,
uint8,
bytes memory
) external pure returns (uint256) {
return abi.decode(m[0], (uint256));
}
function stringCallback(
bytes[] memory m,
uint8,
bytes memory
) external pure returns (string memory) {
return string(m[0]);
}
function readSlot(
uint256 slot,
VerifierConfig memory verifierConfig
) public view returns (uint256) {
GatewayRequest memory r = GatewayFetcher
.newRequest(1)
.setTarget(verifierConfig.target)
.setSlot(slot)
.read()
.setOutput(0);
fetch(
verifierConfig.verifier,
r,
this.uint256Callback.selector,
'',
verifierConfig.urls
);
}
function readLatest(
VerifierConfig memory verifierConfig
) external view returns (uint256) {
return readSlot(0, verifierConfig);
}
function readLatestViaPointer(
VerifierConfig memory verifierConfig
) external view returns (uint256) {
GatewayRequest memory r = GatewayFetcher
.newRequest(1)
.setTarget(verifierConfig.pointer)
.setSlot(0)
.read()
.target()
.setSlot(0)
.read()
.setOutput(0);
fetch(
verifierConfig.verifier,
r,
this.uint256Callback.selector,
'',
verifierConfig.urls
);
}
function readName(
VerifierConfig memory verifierConfig
) external view returns (string memory) {
GatewayRequest memory r = GatewayFetcher
.newRequest(1)
.setTarget(verifierConfig.target)
.setSlot(1)
.readBytes()
.setOutput(0);
fetch(
verifierConfig.verifier,
r,
this.stringCallback.selector,
'',
verifierConfig.urls
);
}
function readHighscore(
uint256 key,
VerifierConfig memory verifierConfig
) external view returns (uint256) {
GatewayRequest memory r = GatewayFetcher
.newRequest(1)
.setTarget(verifierConfig.target)
.setSlot(2)
.push(key)
.follow()
.read()
.setOutput(0);
fetch(
verifierConfig.verifier,
r,
this.uint256Callback.selector,
'',
verifierConfig.urls
);
}
function readLatestHighscore(
VerifierConfig memory verifierConfig
) external view returns (uint256) {
GatewayRequest memory r = GatewayFetcher
.newRequest(1)
.setTarget(verifierConfig.target)
.setSlot(0)
.read()
.setSlot(2)
.follow()
.read()
.setOutput(0);
fetch(
verifierConfig.verifier,
r,
this.uint256Callback.selector,
'',
verifierConfig.urls
);
}
function readLatestHighscorer(
VerifierConfig memory verifierConfig
) external view returns (string memory) {
GatewayRequest memory r = GatewayFetcher
.newRequest(1)
.setTarget(verifierConfig.target)
.setSlot(0)
.read()
.setSlot(3)
.follow()
.readBytes()
.setOutput(0);
fetch(
verifierConfig.verifier,
r,
this.stringCallback.selector,
'',
verifierConfig.urls
);
}
function readRealName(
string memory key,
VerifierConfig memory verifierConfig
) external view returns (string memory) {
GatewayRequest memory r = GatewayFetcher
.newRequest(1)
.setTarget(verifierConfig.target)
.setSlot(4)
.push(key)
.follow()
.readBytes()
.setOutput(0);
fetch(
verifierConfig.verifier,
r,
this.stringCallback.selector,
'',
verifierConfig.urls
);
}
function readLatestHighscorerRealName(
VerifierConfig memory verifierConfig
) external view returns (string memory) {
GatewayRequest memory r = GatewayFetcher.newRequest(1).setTarget(
verifierConfig.target
);
r.setSlot(0).read();
r.setSlot(3).follow().readBytes();
r.setSlot(4).follow().readBytes().setOutput(0);
fetch(
verifierConfig.verifier,
r,
this.stringCallback.selector,
'',
verifierConfig.urls
);
}
function readZero(
VerifierConfig memory verifierConfig
) external view returns (uint256) {
GatewayRequest memory r = GatewayFetcher
.newRequest(1)
.setTarget(verifierConfig.target)
.setSlot(5)
.read()
.setOutput(0);
fetch(
verifierConfig.verifier,
r,
this.uint256Callback.selector,
'',
verifierConfig.urls
);
}
function readRootStr(
string[] memory keys,
VerifierConfig memory verifierConfig
) external view returns (string memory) {
GatewayRequest memory r = GatewayFetcher
.newRequest(1)
.setTarget(verifierConfig.target)
.setSlot(12);
for (uint256 i; i < keys.length; i++) {
r.offset(2).push(keys[i]).follow();
}
r.offset(1).readBytes().setOutput(0);
fetch(
verifierConfig.verifier,
r,
this.stringCallback.selector,
'',
verifierConfig.urls
);
}
function readSlicedKeccak(
VerifierConfig memory verifierConfig
) external view returns (string memory) {
GatewayRequest memory r = GatewayFetcher.newRequest(1).setTarget(
verifierConfig.target
);
r.setSlot(0).read();
r.setSlot(3).follow().readBytes();
r.setSlot(4).follow().readBytes().slice(0, 3); // "Hal"
r.setSlot(0).read().setSlot(2).follow().read().slice(16, 16); // uint128(12345)
r.concat().keccak().setSlot(3).follow().readBytes().setOutput(0); // highscorers[keccak("Hal"+12345)]
fetch(
verifierConfig.verifier,
r,
this.stringCallback.selector,
'',
verifierConfig.urls
);
}
}
contracts/GatewayFetchTarget.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {GatewayRequest} from './GatewayRequest.sol';
import {IGatewayVerifier} from './IGatewayVerifier.sol';
import {IGatewayProtocol} from './IGatewayProtocol.sol';
error OffchainLookup(
address from,
string[] urls,
bytes request,
bytes4 callback,
bytes carry
);
abstract contract GatewayFetchTarget {
struct Session {
IGatewayVerifier verifier;
bytes context;
GatewayRequest req;
bytes4 callback;
bytes carry;
}
function fetch(
IGatewayVerifier verifier,
GatewayRequest memory req,
bytes4 callback
) internal view {
fetch(verifier, req, callback, '', new string[](0));
}
function fetch(
IGatewayVerifier verifier,
GatewayRequest memory req,
bytes4 callback,
bytes memory carry,
string[] memory urls
) internal view {
bytes memory context = verifier.getLatestContext();
if (urls.length == 0) urls = verifier.gatewayURLs();
revert OffchainLookup(
address(this),
urls,
abi.encodeCall(IGatewayProtocol.proveRequest, (context, req)),
this.fetchCallback.selector,
abi.encode(Session(verifier, context, req, callback, carry))
);
}
function fetchCallback(
bytes calldata response,
bytes calldata carry
) external view {
Session memory ses = abi.decode(carry, (Session));
(bytes[] memory values, uint8 exitCode) = ses.verifier.getStorageValues(
ses.context,
ses.req,
response
);
(bool ok, bytes memory ret) = address(this).staticcall(
abi.encodeWithSelector(ses.callback, values, exitCode, ses.carry)
);
if (ok) {
assembly {
return(add(ret, 32), mload(ret))
}
} else {
assembly {
revert(add(ret, 32), mload(ret))
}
}
}
}
contracts/GatewayFetcher.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {GatewayRequest, GatewayOP} from './GatewayRequest.sol';
// only happens during request construction
error RequestOverflow();
library GatewayFetcher {
// verifier execution is only constrainted by stack and gas
// max outputs = 255
// NOTE: this is developer configurable
uint256 constant MAX_OPS = 8192;
using GatewayFetcher for GatewayRequest;
function newRequest(
uint8 outputs
) internal pure returns (GatewayRequest memory) {
return newCommand().addByte(outputs);
}
function newCommand() internal pure returns (GatewayRequest memory) {
bytes memory v = new bytes(MAX_OPS);
assembly {
mstore(v, 0) // length = 0
}
return GatewayRequest(v);
}
function encode(
GatewayRequest memory r
) internal pure returns (bytes memory) {
return abi.encodePacked(r.ops);
}
function addByte(
GatewayRequest memory r,
uint8 i
) internal pure returns (GatewayRequest memory) {
bytes memory v = r.ops;
uint256 n = v.length;
if (n >= MAX_OPS) revert RequestOverflow();
assembly {
mstore(v, add(n, 1)) // length += 1
mstore8(add(add(v, 32), n), i) // append(i)
}
return r;
}
function addBytes(
GatewayRequest memory r,
bytes memory v
) internal pure returns (GatewayRequest memory) {
bytes memory buf = r.ops;
if (r.ops.length + v.length > MAX_OPS) revert RequestOverflow();
assembly {
let dst := add(add(buf, 32), mload(buf)) // ptr to write
let src := add(v, 32) // ptr to start read
for {
let src_end := add(src, mload(v)) // ptr to stop read
} lt(src, src_end) {
src := add(src, 32)
dst := add(dst, 32)
} {
mstore(dst, mload(src)) // copy word
}
mstore(buf, add(mload(buf), mload(v))) // length += v.length
}
return r;
}
function debug(
GatewayRequest memory r,
string memory label
) internal pure returns (GatewayRequest memory) {
bytes memory v = bytes(label);
if (v.length >= 256) revert RequestOverflow();
return r.addByte(GatewayOP.DEBUG).addByte(uint8(v.length)).addBytes(v);
}
function push(
GatewayRequest memory r,
bool x
) internal pure returns (GatewayRequest memory) {
return r.push(x ? 1 : 0);
}
function push(
GatewayRequest memory r,
bytes32 x
) internal pure returns (GatewayRequest memory) {
return r.push(uint256(x));
}
function push(
GatewayRequest memory r,
address x
) internal pure returns (GatewayRequest memory) {
return r.push(uint160(x));
}
function push(
GatewayRequest memory r,
uint256 x
) internal pure returns (GatewayRequest memory) {
// NOTE: compact request building is not necessary
// this could just be: return r.addByte(GatewayOP.PUSH_32).addBytes(abi.encode(x));
if (x == 0) return r.addByte(GatewayOP.PUSH_0);
uint8 n = clz(x); // number of leading zeros
x <<= (n << 3); // right pad
n = 32 - n; // width w/o pad
r.addByte(GatewayOP.PUSH_0 + n);
bytes memory v = r.ops;
if (v.length + n > MAX_OPS) revert RequestOverflow();
assembly {
let len := mload(v)
mstore(add(add(v, 32), len), x) // append(x)
mstore(v, add(len, n)) // length += n
}
return r;
}
function clz(uint256 x) private pure returns (uint8 n) {
if (x < (1 << 128)) {
x <<= 128;
n |= 16;
}
if (x < (1 << 192)) {
x <<= 64;
n |= 8;
}
if (x < (1 << 224)) {
x <<= 32;
n |= 4;
}
if (x < (1 << 240)) {
x <<= 16;
n |= 2;
}
if (x < (1 << 248)) {
n |= 1;
}
}
function push(
GatewayRequest memory r,
string memory s
) internal pure returns (GatewayRequest memory) {
return r.push(bytes(s));
}
function push(
GatewayRequest memory r,
GatewayRequest memory p
) internal pure returns (GatewayRequest memory) {
return r.push(p.encode());
}
function push(
GatewayRequest memory r,
bytes memory v
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.PUSH_BYTES).push(v.length).addBytes(v);
}
function getSlot(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.GET_SLOT);
}
function getTarget(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.GET_TARGET);
}
function stackCount(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.STACK_SIZE);
}
function isContract(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.IS_CONTRACT);
}
function pushStack(
GatewayRequest memory r,
uint256 i
) internal pure returns (GatewayRequest memory) {
return r.push(i).addByte(GatewayOP.PUSH_STACK);
// r.stackCount().push(1).subtract().push(i).subtract().addByte(GatewayOP.DUP);
}
function pushOutput(
GatewayRequest memory r,
uint256 i
) internal pure returns (GatewayRequest memory) {
return r.push(i).addByte(GatewayOP.PUSH_OUTPUT);
}
function target(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.SET_TARGET);
}
function setTarget(
GatewayRequest memory r,
address a
) internal pure returns (GatewayRequest memory) {
return r.push(a).target();
}
function output(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.SET_OUTPUT);
}
function setOutput(
GatewayRequest memory r,
uint8 i
) internal pure returns (GatewayRequest memory) {
return r.push(i).output();
}
function eval(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.push(true).evalIf();
}
function evalIf(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.EVAL);
}
function evalLoop(
GatewayRequest memory r,
uint8 flags
) internal pure returns (GatewayRequest memory) {
return r.evalLoop(flags, 255);
}
function evalLoop(
GatewayRequest memory r,
uint8 flags,
uint256 count
) internal pure returns (GatewayRequest memory) {
return r.push(count).addByte(GatewayOP.EVAL_LOOP).addByte(flags);
}
function exit(
GatewayRequest memory r,
uint8 exitCode
) internal pure returns (GatewayRequest memory) {
return r.push(false).assertNonzero(exitCode);
}
function assertNonzero(
GatewayRequest memory r,
uint8 exitCode
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.ASSERT).addByte(exitCode);
}
function requireContract(
GatewayRequest memory r,
uint8 exitCode
) internal pure returns (GatewayRequest memory) {
return r.isContract().assertNonzero(exitCode);
}
function requireNonzero(
GatewayRequest memory r,
uint8 exitCode
) internal pure returns (GatewayRequest memory) {
return r.dup().assertNonzero(exitCode);
}
function setSlot(
GatewayRequest memory r,
uint256 x
) internal pure returns (GatewayRequest memory) {
return r.push(x).slot();
}
function offset(
GatewayRequest memory r,
uint256 dx
) internal pure returns (GatewayRequest memory) {
return r.push(dx).addSlot();
}
function addSlot(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.ADD_SLOT);
// return r.getSlot().add().slot();
}
function slot(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.SET_SLOT);
}
function follow(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.FOLLOW);
// return r.getSlot().concat().keccak().slot();
}
function followIndex(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.getSlot().keccak().slot().addSlot();
}
function read(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.READ_SLOT);
}
function read(
GatewayRequest memory r,
uint256 n
) internal pure returns (GatewayRequest memory) {
return r.push(n).addByte(GatewayOP.READ_SLOTS);
}
function readBytes(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.READ_BYTES);
}
function readHashedBytes(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.READ_HASHED_BYTES);
}
function readArray(
GatewayRequest memory r,
uint256 step
) internal pure returns (GatewayRequest memory) {
return r.push(step).addByte(GatewayOP.READ_ARRAY);
}
function pop(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.POP);
}
function dup(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.dup(0);
}
function dup(
GatewayRequest memory r,
uint256 back
) internal pure returns (GatewayRequest memory) {
return r.push(back).addByte(GatewayOP.DUP);
}
function swap(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.swap(1);
}
function swap(
GatewayRequest memory r,
uint256 back
) internal pure returns (GatewayRequest memory) {
return r.push(back).addByte(GatewayOP.SWAP);
}
function concat(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.CONCAT);
}
function keccak(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.KECCAK);
}
function slice(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.SLICE);
}
function slice(
GatewayRequest memory r,
uint256 pos,
uint256 len
) internal pure returns (GatewayRequest memory) {
return r.push(pos).push(len).slice();
}
function length(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.LENGTH);
}
function plus(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.PLUS);
}
function twosComplement(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.not().push(1).plus();
}
function subtract(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.twosComplement().plus();
}
function times(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.TIMES);
}
function divide(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.DIVIDE);
}
function mod(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.MOD);
}
function pow(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.POW);
}
function and(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.AND);
}
function or(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.OR);
}
function xor(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.XOR);
}
function isZero(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.IS_ZERO);
}
function not(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.NOT);
}
function shl(
GatewayRequest memory r,
uint8 shift
) internal pure returns (GatewayRequest memory) {
return r.push(shift).addByte(GatewayOP.SHIFT_LEFT);
}
function shr(
GatewayRequest memory r,
uint8 shift
) internal pure returns (GatewayRequest memory) {
return r.push(shift).addByte(GatewayOP.SHIFT_RIGHT);
}
function eq(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.EQ);
}
function lt(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.LT);
}
function gt(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.addByte(GatewayOP.GT);
}
function neq(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.eq().isZero();
}
function lte(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.gt().isZero();
}
function gte(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.lt().isZero();
}
function dup2(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.dup(1).dup(1);
}
function min(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.dup2().gt().addByte(GatewayOP.SWAP).pop();
}
function max(
GatewayRequest memory r
) internal pure returns (GatewayRequest memory) {
return r.dup2().lt().addByte(GatewayOP.SWAP).pop();
}
}
contracts/GatewayRequest.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
struct GatewayRequest {
bytes ops;
}
library EvalFlag {
uint8 constant STOP_ON_SUCCESS = 1 << 0;
uint8 constant STOP_ON_FAILURE = 1 << 1;
uint8 constant ACQUIRE_STATE = 1 << 2;
uint8 constant KEEP_ARGS = 1 << 3;
}
library GatewayOP {
uint8 constant PUSH_0 = 0;
uint8 constant PUSH_1 = 1;
uint8 constant PUSH_2 = 2;
uint8 constant PUSH_3 = 3;
uint8 constant PUSH_4 = 4;
uint8 constant PUSH_5 = 5;
uint8 constant PUSH_6 = 6;
uint8 constant PUSH_7 = 7;
uint8 constant PUSH_8 = 8;
uint8 constant PUSH_9 = 9;
uint8 constant PUSH_10 = 10;
uint8 constant PUSH_11 = 11;
uint8 constant PUSH_12 = 12;
uint8 constant PUSH_13 = 13;
uint8 constant PUSH_14 = 14;
uint8 constant PUSH_15 = 15;
uint8 constant PUSH_16 = 16;
uint8 constant PUSH_17 = 17;
uint8 constant PUSH_18 = 18;
uint8 constant PUSH_19 = 19;
uint8 constant PUSH_20 = 20;
uint8 constant PUSH_21 = 21;
uint8 constant PUSH_22 = 22;
uint8 constant PUSH_23 = 23;
uint8 constant PUSH_24 = 24;
uint8 constant PUSH_25 = 25;
uint8 constant PUSH_26 = 26;
uint8 constant PUSH_27 = 27;
uint8 constant PUSH_28 = 28;
uint8 constant PUSH_29 = 29;
uint8 constant PUSH_30 = 30;
uint8 constant PUSH_31 = 31;
uint8 constant PUSH_32 = 32;
uint8 constant GET_SLOT = 33;
uint8 constant GET_TARGET = 34;
uint8 constant STACK_SIZE = 35;
uint8 constant IS_CONTRACT = 36;
uint8 constant PUSH_BYTES = 40;
uint8 constant PUSH_STACK = 41;
uint8 constant PUSH_OUTPUT = 42;
uint8 constant SET_TARGET = 50;
uint8 constant SET_OUTPUT = 51;
uint8 constant EVAL_LOOP = 52;
uint8 constant EVAL = 53;
uint8 constant ASSERT = 54;
uint8 constant READ_SLOT = 60;
uint8 constant READ_BYTES = 61;
uint8 constant READ_ARRAY = 62;
uint8 constant READ_HASHED_BYTES = 63;
uint8 constant READ_SLOTS = 64;
uint8 constant SET_SLOT = 70;
uint8 constant ADD_SLOT = 71;
uint8 constant FOLLOW = 72;
uint8 constant DUP = 80;
uint8 constant POP = 81;
uint8 constant SWAP = 82;
uint8 constant KECCAK = 90;
uint8 constant CONCAT = 91;
uint8 constant SLICE = 92;
uint8 constant LENGTH = 93;
uint8 constant PLUS = 100;
uint8 constant TIMES = 101;
uint8 constant DIVIDE = 102;
uint8 constant MOD = 103;
uint8 constant POW = 104;
uint8 constant AND = 110;
uint8 constant OR = 111;
uint8 constant XOR = 112;
uint8 constant SHIFT_LEFT = 113;
uint8 constant SHIFT_RIGHT = 114;
uint8 constant NOT = 115;
uint8 constant IS_ZERO = 120;
uint8 constant EQ = 121;
uint8 constant LT = 122;
uint8 constant GT = 123;
uint8 constant DEBUG = 255;
}
contracts/IGatewayProtocol.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {GatewayRequest} from './GatewayRequest.sol';
interface IGatewayProtocol {
function proveRequest(
bytes memory context,
GatewayRequest memory req
) external pure returns (bytes memory);
}
contracts/IGatewayVerifier.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {GatewayRequest} from './GatewayRequest.sol';
error CommitTooOld(uint256 latest, uint256 got, uint256 window);
error CommitTooNew(uint256 latest, uint256 got);
interface IGatewayVerifier {
function getLatestContext() external view returns (bytes memory);
function gatewayURLs() external view returns (string[] memory);
function getStorageValues(
bytes memory context,
GatewayRequest memory req,
bytes memory proof
) external view returns (bytes[] memory values, uint8 exitCode);
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"libraries": {},
"optimizer": {
"runs": 1,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@eth-optimism/=lib/optimism/packages/",
"ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"optimism/=lib/optimism/packages/contracts-bedrock/src/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.