-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathGelatoRelay1BalanceV2.json
More file actions
98 lines (98 loc) · 17.7 KB
/
Copy pathGelatoRelay1BalanceV2.json
File metadata and controls
98 lines (98 loc) · 17.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{
"address": "0xceA8aAa918bc6C19e5B77841ebD77ff3188385AF",
"abi": [
{
"anonymous": false,
"inputs": [],
"name": "LogUseGelato1BalanceV2",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "_target",
"type": "address"
},
{
"internalType": "bytes",
"name": "_data",
"type": "bytes"
},
{
"internalType": "bytes32",
"name": "_correlationId",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "_r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "_vs",
"type": "bytes32"
}
],
"name": "sponsoredCallV2",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"transactionHash": "0xeb077ff0f10d3f99b42ff41d08b5840323e1a22f357d05ba7ab1fae42739445a",
"receipt": {
"to": "0x4e59b44847b379578588920cA78FbF26c0B4956C",
"from": "0x7aD7b5F4F0E5Df7D6Aa5444516429AF77babc3A0",
"contractAddress": null,
"transactionIndex": 1,
"gasUsed": "323212",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0xd34cb8b219101594034467a2efac0d0dde653f7e70bb25f1a1482a1793d0d0c2",
"transactionHash": "0xeb077ff0f10d3f99b42ff41d08b5840323e1a22f357d05ba7ab1fae42739445a",
"logs": [],
"blockNumber": 27756370,
"cumulativeGasUsed": "367099",
"status": 1,
"byzantium": true
},
"args": [],
"numDeployments": 2,
"solcInputHash": "2b39cf5f136ec862698d537ad4d091d9",
"metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[],\"name\":\"LogUseGelato1BalanceV2\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"_correlationId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_vs\",\"type\":\"bytes32\"}],\"name\":\"sponsoredCallV2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"This contract must NEVER hold funds!Maliciously crafted transaction payloads could wipe out any funds left here\",\"kind\":\"dev\",\"methods\":{\"sponsoredCallV2(address,bytes,bytes32,bytes32,bytes32)\":{\"details\":\"This method can be called directly without passing through the diamondThe validity of the emitted LogUseGelato1BalanceV2 event must be verified off-chainPayment is handled with off-chain accounting using Gelato's 1Balance system\",\"params\":{\"_correlationId\":\"Unique task identifier generated by gelato Signature is split into `r` and `vs` - See https://eips.ethereum.org/EIPS/eip-2098\",\"_data\":\"Relay call data\",\"_r\":\"Checker signature\",\"_target\":\"Relay call target\",\"_vs\":\"Checker signature\"}}},\"title\":\"Gelato Relay V2 contract\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"sponsoredCallV2(address,bytes,bytes32,bytes32,bytes32)\":{\"notice\":\"Relay call + One Balance payment - with sponsor authentication\"}},\"notice\":\"This contract deals with Gelato 1Balance payments\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/GelatoRelay1BalanceV2.sol\":\"GelatoRelay1BalanceV2\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"contracts/GelatoRelay1BalanceV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.20;\\n\\nimport {IGelatoRelay1BalanceV2} from \\\"./interfaces/IGelatoRelay1BalanceV2.sol\\\";\\nimport {IGelato1BalanceV2} from \\\"./interfaces/IGelato1BalanceV2.sol\\\";\\nimport {GelatoCallUtils} from \\\"./lib/GelatoCallUtils.sol\\\";\\n\\n/// @title Gelato Relay V2 contract\\n/// @notice This contract deals with Gelato 1Balance payments\\n/// @dev This contract must NEVER hold funds!\\n/// @dev Maliciously crafted transaction payloads could wipe out any funds left here\\n// solhint-disable-next-line max-states-count\\ncontract GelatoRelay1BalanceV2 is IGelatoRelay1BalanceV2, IGelato1BalanceV2 {\\n using GelatoCallUtils for address;\\n\\n /// @notice Relay call + One Balance payment - with sponsor authentication\\n /// @dev This method can be called directly without passing through the diamond\\n /// @dev The validity of the emitted LogUseGelato1BalanceV2 event must be verified off-chain\\n /// @dev Payment is handled with off-chain accounting using Gelato's 1Balance system\\n /// @param _target Relay call target\\n /// @param _data Relay call data\\n /// @param _correlationId Unique task identifier generated by gelato\\n /// Signature is split into `r` and `vs` - See https://eips.ethereum.org/EIPS/eip-2098\\n /// @param _r Checker signature\\n /// @param _vs Checker signature\\n function sponsoredCallV2(\\n address _target,\\n bytes calldata _data,\\n bytes32 _correlationId,\\n bytes32 _r,\\n bytes32 _vs\\n ) external {\\n // These parameters are decoded from calldata\\n (_correlationId);\\n (_r);\\n (_vs);\\n\\n // INTERACTIONS\\n _target.revertingContractCallNoCopy(\\n _data,\\n \\\"GelatoRelay.sponsoredCallV2:\\\"\\n );\\n\\n emit LogUseGelato1BalanceV2();\\n }\\n}\\n\",\"keccak256\":\"0x56466cf79bd245b103f3b66fea61c494c38270b30b7d5cacbbbd75875d0fe864\",\"license\":\"MIT\"},\"contracts/interfaces/IGelato1BalanceV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.20;\\n\\ninterface IGelato1BalanceV2 {\\n event LogUseGelato1BalanceV2();\\n}\\n\",\"keccak256\":\"0x7d5d62de9998c577a97b6c064891916ba6cbe9698c717dfc340f664062beeb42\",\"license\":\"MIT\"},\"contracts/interfaces/IGelatoRelay1BalanceV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.20;\\n\\ninterface IGelatoRelay1BalanceV2 {\\n function sponsoredCallV2(\\n address _target,\\n bytes calldata _data,\\n bytes32 _correlationId,\\n bytes32 _r,\\n bytes32 _vs\\n ) external;\\n}\\n\",\"keccak256\":\"0x983cd869cc01d78754054d93fafa34418142ab96e3697e1a9775fb1884911db5\",\"license\":\"MIT\"},\"contracts/lib/GelatoBytes.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.20;\\n\\nlibrary GelatoBytes {\\n function calldataSliceSelector(\\n bytes calldata _bytes\\n ) internal pure returns (bytes4 selector) {\\n selector =\\n _bytes[0] |\\n (bytes4(_bytes[1]) >> 8) |\\n (bytes4(_bytes[2]) >> 16) |\\n (bytes4(_bytes[3]) >> 24);\\n }\\n\\n function memorySliceSelector(\\n bytes memory _bytes\\n ) internal pure returns (bytes4 selector) {\\n selector =\\n _bytes[0] |\\n (bytes4(_bytes[1]) >> 8) |\\n (bytes4(_bytes[2]) >> 16) |\\n (bytes4(_bytes[3]) >> 24);\\n }\\n\\n function revertWithError(\\n bytes memory _bytes,\\n string memory _tracingInfo\\n ) internal pure {\\n // 68: 32-location, 32-length, 4-ErrorSelector, UTF-8 err\\n if (_bytes.length % 32 == 4) {\\n bytes4 selector;\\n assembly {\\n selector := mload(add(0x20, _bytes))\\n }\\n if (selector == 0x08c379a0) {\\n // Function selector for Error(string)\\n assembly {\\n _bytes := add(_bytes, 68)\\n }\\n revert(string(abi.encodePacked(_tracingInfo, string(_bytes))));\\n }\\n }\\n\\n // Bubble up unrecognised errors directly\\n assembly {\\n revert(add(_bytes, 0x20), mload(_bytes))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x464f7c05c5fe809688705485525109dfd9ff278f5ade546ad97db343e4c87706\",\"license\":\"MIT\"},\"contracts/lib/GelatoCallUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.20;\\n\\nimport {GelatoBytes} from \\\"./GelatoBytes.sol\\\";\\n\\nlibrary GelatoCallUtils {\\n using GelatoBytes for bytes;\\n\\n function revertingContractCall(\\n address _contract,\\n bytes memory _data,\\n string memory _errorMsg\\n ) internal returns (bytes memory returndata) {\\n bool success;\\n (success, returndata) = _contract.call(_data);\\n\\n // solhint-disable-next-line max-line-length\\n // https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/f9b6fc3fdab7aca33a9cfa8837c5cd7f67e176be/contracts/utils/AddressUpgradeable.sol#L177\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(\\n isContract(_contract),\\n string(abi.encodePacked(_errorMsg, \\\"Call to non contract\\\"))\\n );\\n }\\n } else {\\n returndata.revertWithError(_errorMsg);\\n }\\n }\\n\\n function revertingContractCallNoCopy(\\n address _contract,\\n bytes calldata _data,\\n string memory _errorMsg\\n ) internal returns (bytes memory returndata) {\\n bool success;\\n (success, returndata) = _contract.call(_data);\\n\\n // solhint-disable-next-line max-line-length\\n // https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/f9b6fc3fdab7aca33a9cfa8837c5cd7f67e176be/contracts/utils/AddressUpgradeable.sol#L177\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(\\n isContract(_contract),\\n string(abi.encodePacked(_errorMsg, \\\"Call to non contract\\\"))\\n );\\n }\\n } else {\\n returndata.revertWithError(_errorMsg);\\n }\\n }\\n\\n // solhint-disable-next-line max-line-length\\n // https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/f9b6fc3fdab7aca33a9cfa8837c5cd7f67e176be/contracts/utils/AddressUpgradeable.sol#L36\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n}\\n\",\"keccak256\":\"0x854291df273aa55e25e4ef0176aef410b03979895cbac613cef882efbb769bf6\",\"license\":\"MIT\"}},\"version\":1}",
"bytecode": "0x608060405234801561001057600080fd5b506104e5806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063ad718d2a14610030575b600080fd5b61004361003e3660046102ca565b610045565b005b60408051808201909152601c81527f47656c61746f52656c61792e73706f6e736f72656443616c6c56323a00000000602082015261009e9073ffffffffffffffffffffffffffffffffffffffff881690879087906100d0565b506040517f8e4f8b7f1299a63a6b46587ec357933d2006e5697cd46d99297e670cee1dbeb190600090a1505050505050565b606060008573ffffffffffffffffffffffffffffffffffffffff1685856040516100fb92919061037f565b6000604051808303816000865af19150503d8060008114610138576040519150601f19603f3d011682016040523d82523d6000602084013e61013d565b606091505b509250905080156101d35781516000036101ce5773ffffffffffffffffffffffffffffffffffffffff86163b15158360405160200161017c91906103b3565b604051602081830303815290604052906101cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101c391906103f4565b60405180910390fd5b505b6101dd565b6101dd82846101e6565b50949350505050565b602082516101f49190610445565b6004036102c25760208201517fffffffff0000000000000000000000000000000000000000000000000000000081167f08c379a000000000000000000000000000000000000000000000000000000000036102c0576044830192508183604051602001610262929190610480565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526101c3916004016103f4565b505b815160208301fd5b60008060008060008060a087890312156102e357600080fd5b863573ffffffffffffffffffffffffffffffffffffffff8116811461030757600080fd5b9550602087013567ffffffffffffffff8082111561032457600080fd5b818901915089601f83011261033857600080fd5b81358181111561034757600080fd5b8a602082850101111561035957600080fd5b979a60209290920199509697604081013597506060810135965060800135945092505050565b8183823760009101908152919050565b60005b838110156103aa578181015183820152602001610392565b50506000910152565b600082516103c581846020870161038f565b7f43616c6c20746f206e6f6e20636f6e7472616374000000000000000000000000920191825250601401919050565b602081526000825180602084015261041381604085016020870161038f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60008261047b577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500690565b6000835161049281846020880161038f565b8351908301906104a681836020880161038f565b0194935050505056fea2646970667358221220db14341cd5dc3b9436bdac3c021e2866bfe4f04219cb79808b7163e0ab4b055164736f6c63430008140033",
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063ad718d2a14610030575b600080fd5b61004361003e3660046102ca565b610045565b005b60408051808201909152601c81527f47656c61746f52656c61792e73706f6e736f72656443616c6c56323a00000000602082015261009e9073ffffffffffffffffffffffffffffffffffffffff881690879087906100d0565b506040517f8e4f8b7f1299a63a6b46587ec357933d2006e5697cd46d99297e670cee1dbeb190600090a1505050505050565b606060008573ffffffffffffffffffffffffffffffffffffffff1685856040516100fb92919061037f565b6000604051808303816000865af19150503d8060008114610138576040519150601f19603f3d011682016040523d82523d6000602084013e61013d565b606091505b509250905080156101d35781516000036101ce5773ffffffffffffffffffffffffffffffffffffffff86163b15158360405160200161017c91906103b3565b604051602081830303815290604052906101cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101c391906103f4565b60405180910390fd5b505b6101dd565b6101dd82846101e6565b50949350505050565b602082516101f49190610445565b6004036102c25760208201517fffffffff0000000000000000000000000000000000000000000000000000000081167f08c379a000000000000000000000000000000000000000000000000000000000036102c0576044830192508183604051602001610262929190610480565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526101c3916004016103f4565b505b815160208301fd5b60008060008060008060a087890312156102e357600080fd5b863573ffffffffffffffffffffffffffffffffffffffff8116811461030757600080fd5b9550602087013567ffffffffffffffff8082111561032457600080fd5b818901915089601f83011261033857600080fd5b81358181111561034757600080fd5b8a602082850101111561035957600080fd5b979a60209290920199509697604081013597506060810135965060800135945092505050565b8183823760009101908152919050565b60005b838110156103aa578181015183820152602001610392565b50506000910152565b600082516103c581846020870161038f565b7f43616c6c20746f206e6f6e20636f6e7472616374000000000000000000000000920191825250601401919050565b602081526000825180602084015261041381604085016020870161038f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60008261047b577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500690565b6000835161049281846020880161038f565b8351908301906104a681836020880161038f565b0194935050505056fea2646970667358221220db14341cd5dc3b9436bdac3c021e2866bfe4f04219cb79808b7163e0ab4b055164736f6c63430008140033",
"devdoc": {
"details": "This contract must NEVER hold funds!Maliciously crafted transaction payloads could wipe out any funds left here",
"kind": "dev",
"methods": {
"sponsoredCallV2(address,bytes,bytes32,bytes32,bytes32)": {
"details": "This method can be called directly without passing through the diamondThe validity of the emitted LogUseGelato1BalanceV2 event must be verified off-chainPayment is handled with off-chain accounting using Gelato's 1Balance system",
"params": {
"_correlationId": "Unique task identifier generated by gelato Signature is split into `r` and `vs` - See https://eips.ethereum.org/EIPS/eip-2098",
"_data": "Relay call data",
"_r": "Checker signature",
"_target": "Relay call target",
"_vs": "Checker signature"
}
}
},
"title": "Gelato Relay V2 contract",
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {
"sponsoredCallV2(address,bytes,bytes32,bytes32,bytes32)": {
"notice": "Relay call + One Balance payment - with sponsor authentication"
}
},
"notice": "This contract deals with Gelato 1Balance payments",
"version": 1
},
"storageLayout": {
"storage": [],
"types": null
}
}