Skip to content

Instantly share code, notes, and snippets.

@eth-jashan
Created January 24, 2022 20:07
Show Gist options
  • Save eth-jashan/5d5129e3c5fbbf9156753e57145cd41e to your computer and use it in GitHub Desktop.
Save eth-jashan/5d5129e3c5fbbf9156753e57145cd41e 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=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;
library TestsAccounts {
function getAccount(uint index) pure public returns (address) {
address[15] memory accounts;
accounts[0] = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4;
accounts[1] = 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2;
accounts[2] = 0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db;
accounts[3] = 0x78731D3Ca6b7E34aC0F824c42a7cC18A495cabaB;
accounts[4] = 0x617F2E2fD72FD9D5503197092aC168c91465E7f2;
accounts[5] = 0x17F6AD8Ef982297579C203069C1DbfFE4348c372;
accounts[6] = 0x5c6B0f7Bf3E7ce046039Bd8FABdfD3f9F5021678;
accounts[7] = 0x03C6FcED478cBbC9a4FAB34eF9f40767739D1Ff7;
accounts[8] = 0x1aE0EA34a72D944a8C7603FfB3eC30a6669E454C;
accounts[9] = 0x0A098Eda01Ce92ff4A4CCb7A4fFFb5A43EBC70DC;
accounts[10] = 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c;
accounts[11] = 0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C;
accounts[12] = 0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB;
accounts[13] = 0x583031D1113aD414F02576BD6afaBfb302140225;
accounts[14] = 0xdD870fA1b7C4700F2BD7f44238821C26f7392148;
return accounts[index];
}
}
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;
library Assert {
event AssertionEvent(
bool passed,
string message,
string methodName
);
event AssertionEventUint(
bool passed,
string message,
string methodName,
uint256 returned,
uint256 expected
);
event AssertionEventInt(
bool passed,
string message,
string methodName,
int256 returned,
int256 expected
);
event AssertionEventBool(
bool passed,
string message,
string methodName,
bool returned,
bool expected
);
event AssertionEventAddress(
bool passed,
string message,
string methodName,
address returned,
address expected
);
event AssertionEventBytes32(
bool passed,
string message,
string methodName,
bytes32 returned,
bytes32 expected
);
event AssertionEventString(
bool passed,
string message,
string methodName,
string returned,
string expected
);
event AssertionEventUintInt(
bool passed,
string message,
string methodName,
uint256 returned,
int256 expected
);
event AssertionEventIntUint(
bool passed,
string message,
string methodName,
int256 returned,
uint256 expected
);
function ok(bool a, string memory message) public returns (bool result) {
result = a;
emit AssertionEvent(result, message, "ok");
}
function equal(uint256 a, uint256 b, string memory message) public returns (bool result) {
result = (a == b);
emit AssertionEventUint(result, message, "equal", a, b);
}
function equal(int256 a, int256 b, string memory message) public returns (bool result) {
result = (a == b);
emit AssertionEventInt(result, message, "equal", a, b);
}
function equal(bool a, bool b, string memory message) public returns (bool result) {
result = (a == b);
emit AssertionEventBool(result, message, "equal", a, b);
}
// TODO: only for certain versions of solc
//function equal(fixed a, fixed b, string message) public returns (bool result) {
// result = (a == b);
// emit AssertionEvent(result, message);
//}
// TODO: only for certain versions of solc
//function equal(ufixed a, ufixed b, string message) public returns (bool result) {
// result = (a == b);
// emit AssertionEvent(result, message);
//}
function equal(address a, address b, string memory message) public returns (bool result) {
result = (a == b);
emit AssertionEventAddress(result, message, "equal", a, b);
}
function equal(bytes32 a, bytes32 b, string memory message) public returns (bool result) {
result = (a == b);
emit AssertionEventBytes32(result, message, "equal", a, b);
}
function equal(string memory a, string memory b, string memory message) public returns (bool result) {
result = (keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b)));
emit AssertionEventString(result, message, "equal", a, b);
}
function notEqual(uint256 a, uint256 b, string memory message) public returns (bool result) {
result = (a != b);
emit AssertionEventUint(result, message, "notEqual", a, b);
}
function notEqual(int256 a, int256 b, string memory message) public returns (bool result) {
result = (a != b);
emit AssertionEventInt(result, message, "notEqual", a, b);
}
function notEqual(bool a, bool b, string memory message) public returns (bool result) {
result = (a != b);
emit AssertionEventBool(result, message, "notEqual", a, b);
}
// TODO: only for certain versions of solc
//function notEqual(fixed a, fixed b, string message) public returns (bool result) {
// result = (a != b);
// emit AssertionEvent(result, message);
//}
// TODO: only for certain versions of solc
//function notEqual(ufixed a, ufixed b, string message) public returns (bool result) {
// result = (a != b);
// emit AssertionEvent(result, message);
//}
function notEqual(address a, address b, string memory message) public returns (bool result) {
result = (a != b);
emit AssertionEventAddress(result, message, "notEqual", a, b);
}
function notEqual(bytes32 a, bytes32 b, string memory message) public returns (bool result) {
result = (a != b);
emit AssertionEventBytes32(result, message, "notEqual", a, b);
}
function notEqual(string memory a, string memory b, string memory message) public returns (bool result) {
result = (keccak256(abi.encodePacked(a)) != keccak256(abi.encodePacked(b)));
emit AssertionEventString(result, message, "notEqual", a, b);
}
/*----------------- Greater than --------------------*/
function greaterThan(uint256 a, uint256 b, string memory message) public returns (bool result) {
result = (a > b);
emit AssertionEventUint(result, message, "greaterThan", a, b);
}
function greaterThan(int256 a, int256 b, string memory message) public returns (bool result) {
result = (a > b);
emit AssertionEventInt(result, message, "greaterThan", a, b);
}
// TODO: safely compare between uint and int
function greaterThan(uint256 a, int256 b, string memory message) public returns (bool result) {
if(b < int(0)) {
// int is negative uint "a" always greater
result = true;
} else {
result = (a > uint(b));
}
emit AssertionEventUintInt(result, message, "greaterThan", a, b);
}
function greaterThan(int256 a, uint256 b, string memory message) public returns (bool result) {
if(a < int(0)) {
// int is negative uint "b" always greater
result = false;
} else {
result = (uint(a) > b);
}
emit AssertionEventIntUint(result, message, "greaterThan", a, b);
}
/*----------------- Lesser than --------------------*/
function lesserThan(uint256 a, uint256 b, string memory message) public returns (bool result) {
result = (a < b);
emit AssertionEventUint(result, message, "lesserThan", a, b);
}
function lesserThan(int256 a, int256 b, string memory message) public returns (bool result) {
result = (a < b);
emit AssertionEventInt(result, message, "lesserThan", a, b);
}
// TODO: safely compare between uint and int
function lesserThan(uint256 a, int256 b, string memory message) public returns (bool result) {
if(b < int(0)) {
// int is negative int "b" always lesser
result = false;
} else {
result = (a < uint(b));
}
emit AssertionEventUintInt(result, message, "lesserThan", a, b);
}
function lesserThan(int256 a, uint256 b, string memory message) public returns (bool result) {
if(a < int(0)) {
// int is negative int "a" always lesser
result = true;
} else {
result = (uint(a) < b);
}
emit AssertionEventIntUint(result, message, "lesserThan", a, b);
}
}
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
The 'scripts' folder contains example async/await scripts for deploying the 'Storage' contract.
For the deployment of any other contract, 'contractName' and 'constructorArgs' should be updated (along with other code if required).
Scripts have full access to the web3.js and ethers.js libraries.
To run a script, right click on file name in the file explorer and click 'Run'. Remember, Solidity file must already be compiled.
Output from script will appear in remix terminal.
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"görli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "608060405234801561001057600080fd5b506102fd806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80635524107714610051578063634899ce1461006d5780637c66884414610077578063b92ba3b8146100a7575b600080fd5b61006b600480360381019061006691906101f5565b6100d7565b005b610075610105565b005b610091600480360381019061008c91906101f5565b61015e565b60405161009e9190610231565b60405180910390f35b6100c160048036038101906100bc91906101c8565b61017e565b6040516100ce9190610231565b60405180910390f35b600160008083815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550565b60006020528060005260406000206000915054906101000a900460ff1681565b60016020528060005260406000206000915054906101000a900460ff1681565b6000813590506101ad81610299565b92915050565b6000813590506101c2816102b0565b92915050565b6000602082840312156101de576101dd610294565b5b60006101ec8482850161019e565b91505092915050565b60006020828403121561020b5761020a610294565b5b6000610219848285016101b3565b91505092915050565b61022b8161025e565b82525050565b60006020820190506102466000830184610222565b92915050565b60006102578261026a565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600080fd5b6102a28161024c565b81146102ad57600080fd5b50565b6102b98161028a565b81146102c457600080fd5b5056fea2646970667358221220218588f45febc3a7d0210661831f58a8cb77d7528e23b21065c2ff111236f75e64736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2FD DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x4C JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x55241077 EQ PUSH2 0x51 JUMPI DUP1 PUSH4 0x634899CE EQ PUSH2 0x6D JUMPI DUP1 PUSH4 0x7C668844 EQ PUSH2 0x77 JUMPI DUP1 PUSH4 0xB92BA3B8 EQ PUSH2 0xA7 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x6B PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x66 SWAP2 SWAP1 PUSH2 0x1F5 JUMP JUMPDEST PUSH2 0xD7 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x75 PUSH2 0x105 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x91 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x8C SWAP2 SWAP1 PUSH2 0x1F5 JUMP JUMPDEST PUSH2 0x15E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x9E SWAP2 SWAP1 PUSH2 0x231 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0xC1 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0xBC SWAP2 SWAP1 PUSH2 0x1C8 JUMP JUMPDEST PUSH2 0x17E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xCE SWAP2 SWAP1 PUSH2 0x231 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x1 PUSH1 0x0 DUP1 DUP4 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH1 0x1 DUP1 PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x1AD DUP2 PUSH2 0x299 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x1C2 DUP2 PUSH2 0x2B0 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1DE JUMPI PUSH2 0x1DD PUSH2 0x294 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x1EC DUP5 DUP3 DUP6 ADD PUSH2 0x19E JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x20B JUMPI PUSH2 0x20A PUSH2 0x294 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x219 DUP5 DUP3 DUP6 ADD PUSH2 0x1B3 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x22B DUP2 PUSH2 0x25E JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x246 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x222 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x257 DUP3 PUSH2 0x26A JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 ISZERO ISZERO SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x2A2 DUP2 PUSH2 0x24C JUMP JUMPDEST DUP2 EQ PUSH2 0x2AD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH2 0x2B9 DUP2 PUSH2 0x28A JUMP JUMPDEST DUP2 EQ PUSH2 0x2C4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x21 DUP6 DUP9 DELEGATECALL 0x5F 0xEB 0xC3 0xA7 0xD0 0x21 MOD PUSH2 0x831F PC 0xA8 0xCB PUSH24 0xD7528E23B21065C2FF111236F75E64736F6C634300080700 CALLER ",
"sourceMap": "25:314:0:-:0;;;;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {
"@myAddressMapping_9": {
"entryPoint": 382,
"id": 9,
"parameterSlots": 0,
"returnSlots": 0
},
"@myMapping_5": {
"entryPoint": 350,
"id": 5,
"parameterSlots": 0,
"returnSlots": 0
},
"@setMyAddressToTrue_32": {
"entryPoint": 261,
"id": 32,
"parameterSlots": 0,
"returnSlots": 0
},
"@setValue_21": {
"entryPoint": 215,
"id": 21,
"parameterSlots": 1,
"returnSlots": 0
},
"abi_decode_t_address": {
"entryPoint": 414,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_uint256": {
"entryPoint": 435,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_address": {
"entryPoint": 456,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_uint256": {
"entryPoint": 501,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_t_bool_to_t_bool_fromStack": {
"entryPoint": 546,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed": {
"entryPoint": 561,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"allocate_unbounded": {
"entryPoint": null,
"id": null,
"parameterSlots": 0,
"returnSlots": 1
},
"cleanup_t_address": {
"entryPoint": 588,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_bool": {
"entryPoint": 606,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_uint160": {
"entryPoint": 618,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_uint256": {
"entryPoint": 650,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db": {
"entryPoint": null,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b": {
"entryPoint": 660,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"validator_revert_t_address": {
"entryPoint": 665,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_uint256": {
"entryPoint": 688,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
}
},
"generatedSources": [
{
"ast": {
"nodeType": "YulBlock",
"src": "0:2291:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "59:87:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "69:29:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "91:6:1"
}
],
"functionName": {
"name": "calldataload",
"nodeType": "YulIdentifier",
"src": "78:12:1"
},
"nodeType": "YulFunctionCall",
"src": "78:20:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "69:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "134:5:1"
}
],
"functionName": {
"name": "validator_revert_t_address",
"nodeType": "YulIdentifier",
"src": "107:26:1"
},
"nodeType": "YulFunctionCall",
"src": "107:33:1"
},
"nodeType": "YulExpressionStatement",
"src": "107:33:1"
}
]
},
"name": "abi_decode_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "37:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "45:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "53:5:1",
"type": ""
}
],
"src": "7:139:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "204:87:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "214:29:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "236:6:1"
}
],
"functionName": {
"name": "calldataload",
"nodeType": "YulIdentifier",
"src": "223:12:1"
},
"nodeType": "YulFunctionCall",
"src": "223:20:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "214:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "279:5:1"
}
],
"functionName": {
"name": "validator_revert_t_uint256",
"nodeType": "YulIdentifier",
"src": "252:26:1"
},
"nodeType": "YulFunctionCall",
"src": "252:33:1"
},
"nodeType": "YulExpressionStatement",
"src": "252:33:1"
}
]
},
"name": "abi_decode_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "182:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "190:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "198:5:1",
"type": ""
}
],
"src": "152:139:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "363:263:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "409:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulIdentifier",
"src": "411:77:1"
},
"nodeType": "YulFunctionCall",
"src": "411:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "411:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "384:7:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "393:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "380:3:1"
},
"nodeType": "YulFunctionCall",
"src": "380:23:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "405:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "slt",
"nodeType": "YulIdentifier",
"src": "376:3:1"
},
"nodeType": "YulFunctionCall",
"src": "376:32:1"
},
"nodeType": "YulIf",
"src": "373:119:1"
},
{
"nodeType": "YulBlock",
"src": "502:117:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "517:15:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "531:1:1",
"type": "",
"value": "0"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "521:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "546:63:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "581:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "592:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "577:3:1"
},
"nodeType": "YulFunctionCall",
"src": "577:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "601:7:1"
}
],
"functionName": {
"name": "abi_decode_t_address",
"nodeType": "YulIdentifier",
"src": "556:20:1"
},
"nodeType": "YulFunctionCall",
"src": "556:53:1"
},
"variableNames": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "546:6:1"
}
]
}
]
}
]
},
"name": "abi_decode_tuple_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "333:9:1",
"type": ""
},
{
"name": "dataEnd",
"nodeType": "YulTypedName",
"src": "344:7:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "356:6:1",
"type": ""
}
],
"src": "297:329:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "698:263:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "744:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulIdentifier",
"src": "746:77:1"
},
"nodeType": "YulFunctionCall",
"src": "746:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "746:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "719:7:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "728:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "715:3:1"
},
"nodeType": "YulFunctionCall",
"src": "715:23:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "740:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "slt",
"nodeType": "YulIdentifier",
"src": "711:3:1"
},
"nodeType": "YulFunctionCall",
"src": "711:32:1"
},
"nodeType": "YulIf",
"src": "708:119:1"
},
{
"nodeType": "YulBlock",
"src": "837:117:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "852:15:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "866:1:1",
"type": "",
"value": "0"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "856:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "881:63:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "916:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "927:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "912:3:1"
},
"nodeType": "YulFunctionCall",
"src": "912:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "936:7:1"
}
],
"functionName": {
"name": "abi_decode_t_uint256",
"nodeType": "YulIdentifier",
"src": "891:20:1"
},
"nodeType": "YulFunctionCall",
"src": "891:53:1"
},
"variableNames": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "881:6:1"
}
]
}
]
}
]
},
"name": "abi_decode_tuple_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "668:9:1",
"type": ""
},
{
"name": "dataEnd",
"nodeType": "YulTypedName",
"src": "679:7:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "691:6:1",
"type": ""
}
],
"src": "632:329:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1026:50:1",
"statements": [
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "1043:3:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1063:5:1"
}
],
"functionName": {
"name": "cleanup_t_bool",
"nodeType": "YulIdentifier",
"src": "1048:14:1"
},
"nodeType": "YulFunctionCall",
"src": "1048:21:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "1036:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1036:34:1"
},
"nodeType": "YulExpressionStatement",
"src": "1036:34:1"
}
]
},
"name": "abi_encode_t_bool_to_t_bool_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1014:5:1",
"type": ""
},
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "1021:3:1",
"type": ""
}
],
"src": "967:109:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1174:118:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1184:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "1196:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1207:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "1192:3:1"
},
"nodeType": "YulFunctionCall",
"src": "1192:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "1184:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "1258:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "1271:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1282:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "1267:3:1"
},
"nodeType": "YulFunctionCall",
"src": "1267:17:1"
}
],
"functionName": {
"name": "abi_encode_t_bool_to_t_bool_fromStack",
"nodeType": "YulIdentifier",
"src": "1220:37:1"
},
"nodeType": "YulFunctionCall",
"src": "1220:65:1"
},
"nodeType": "YulExpressionStatement",
"src": "1220:65:1"
}
]
},
"name": "abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "1146:9:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "1158:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "1169:4:1",
"type": ""
}
],
"src": "1082:210:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1338:35:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1348:19:1",
"value": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1364:2:1",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "1358:5:1"
},
"nodeType": "YulFunctionCall",
"src": "1358:9:1"
},
"variableNames": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "1348:6:1"
}
]
}
]
},
"name": "allocate_unbounded",
"nodeType": "YulFunctionDefinition",
"returnVariables": [
{
"name": "memPtr",
"nodeType": "YulTypedName",
"src": "1331:6:1",
"type": ""
}
],
"src": "1298:75:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1424:51:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1434:35:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1463:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint160",
"nodeType": "YulIdentifier",
"src": "1445:17:1"
},
"nodeType": "YulFunctionCall",
"src": "1445:24:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "1434:7:1"
}
]
}
]
},
"name": "cleanup_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1406:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "1416:7:1",
"type": ""
}
],
"src": "1379:96:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1523:48:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1533:32:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1558:5:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "1551:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1551:13:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "1544:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1544:21:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "1533:7:1"
}
]
}
]
},
"name": "cleanup_t_bool",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1505:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "1515:7:1",
"type": ""
}
],
"src": "1481:90:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1622:81:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1632:65:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1647:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1654:42:1",
"type": "",
"value": "0xffffffffffffffffffffffffffffffffffffffff"
}
],
"functionName": {
"name": "and",
"nodeType": "YulIdentifier",
"src": "1643:3:1"
},
"nodeType": "YulFunctionCall",
"src": "1643:54:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "1632:7:1"
}
]
}
]
},
"name": "cleanup_t_uint160",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1604:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "1614:7:1",
"type": ""
}
],
"src": "1577:126:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1754:32:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1764:16:1",
"value": {
"name": "value",
"nodeType": "YulIdentifier",
"src": "1775:5:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "1764:7:1"
}
]
}
]
},
"name": "cleanup_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1736:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "1746:7:1",
"type": ""
}
],
"src": "1709:77:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1881:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1898:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1901:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "1891:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1891:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "1891:12:1"
}
]
},
"name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db",
"nodeType": "YulFunctionDefinition",
"src": "1792:117:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "2004:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2021:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2024:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "2014:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2014:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "2014:12:1"
}
]
},
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulFunctionDefinition",
"src": "1915:117:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "2081:79:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "2138:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2147:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2150:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "2140:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2140:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "2140:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2104:5:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2129:5:1"
}
],
"functionName": {
"name": "cleanup_t_address",
"nodeType": "YulIdentifier",
"src": "2111:17:1"
},
"nodeType": "YulFunctionCall",
"src": "2111:24:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "2101:2:1"
},
"nodeType": "YulFunctionCall",
"src": "2101:35:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "2094:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2094:43:1"
},
"nodeType": "YulIf",
"src": "2091:63:1"
}
]
},
"name": "validator_revert_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "2074:5:1",
"type": ""
}
],
"src": "2038:122:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "2209:79:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "2266:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2275:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2278:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "2268:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2268:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "2268:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2232:5:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2257:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "2239:17:1"
},
"nodeType": "YulFunctionCall",
"src": "2239:24:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "2229:2:1"
},
"nodeType": "YulFunctionCall",
"src": "2229:35:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "2222:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2222:43:1"
},
"nodeType": "YulIf",
"src": "2219:63:1"
}
]
},
"name": "validator_revert_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "2202:5:1",
"type": ""
}
],
"src": "2166:122:1"
}
]
},
"contents": "{\n\n function abi_decode_t_address(offset, end) -> value {\n value := calldataload(offset)\n validator_revert_t_address(value)\n }\n\n function abi_decode_t_uint256(offset, end) -> value {\n value := calldataload(offset)\n validator_revert_t_uint256(value)\n }\n\n function abi_decode_tuple_t_address(headStart, dataEnd) -> value0 {\n if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_address(add(headStart, offset), dataEnd)\n }\n\n }\n\n function abi_decode_tuple_t_uint256(headStart, dataEnd) -> value0 {\n if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_uint256(add(headStart, offset), dataEnd)\n }\n\n }\n\n function abi_encode_t_bool_to_t_bool_fromStack(value, pos) {\n mstore(pos, cleanup_t_bool(value))\n }\n\n function abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_bool_to_t_bool_fromStack(value0, add(headStart, 0))\n\n }\n\n function allocate_unbounded() -> memPtr {\n memPtr := mload(64)\n }\n\n function cleanup_t_address(value) -> cleaned {\n cleaned := cleanup_t_uint160(value)\n }\n\n function cleanup_t_bool(value) -> cleaned {\n cleaned := iszero(iszero(value))\n }\n\n function cleanup_t_uint160(value) -> cleaned {\n cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff)\n }\n\n function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\n }\n\n function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() {\n revert(0, 0)\n }\n\n function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {\n revert(0, 0)\n }\n\n function validator_revert_t_address(value) {\n if iszero(eq(value, cleanup_t_address(value))) { revert(0, 0) }\n }\n\n function validator_revert_t_uint256(value) {\n if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) }\n }\n\n}\n",
"id": 1,
"language": "Yul",
"name": "#utility.yul"
}
],
"immutableReferences": {},
"linkReferences": {},
"object": "608060405234801561001057600080fd5b506004361061004c5760003560e01c80635524107714610051578063634899ce1461006d5780637c66884414610077578063b92ba3b8146100a7575b600080fd5b61006b600480360381019061006691906101f5565b6100d7565b005b610075610105565b005b610091600480360381019061008c91906101f5565b61015e565b60405161009e9190610231565b60405180910390f35b6100c160048036038101906100bc91906101c8565b61017e565b6040516100ce9190610231565b60405180910390f35b600160008083815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550565b60006020528060005260406000206000915054906101000a900460ff1681565b60016020528060005260406000206000915054906101000a900460ff1681565b6000813590506101ad81610299565b92915050565b6000813590506101c2816102b0565b92915050565b6000602082840312156101de576101dd610294565b5b60006101ec8482850161019e565b91505092915050565b60006020828403121561020b5761020a610294565b5b6000610219848285016101b3565b91505092915050565b61022b8161025e565b82525050565b60006020820190506102466000830184610222565b92915050565b60006102578261026a565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600080fd5b6102a28161024c565b81146102ad57600080fd5b50565b6102b98161028a565b81146102c457600080fd5b5056fea2646970667358221220218588f45febc3a7d0210661831f58a8cb77d7528e23b21065c2ff111236f75e64736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x4C JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x55241077 EQ PUSH2 0x51 JUMPI DUP1 PUSH4 0x634899CE EQ PUSH2 0x6D JUMPI DUP1 PUSH4 0x7C668844 EQ PUSH2 0x77 JUMPI DUP1 PUSH4 0xB92BA3B8 EQ PUSH2 0xA7 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x6B PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x66 SWAP2 SWAP1 PUSH2 0x1F5 JUMP JUMPDEST PUSH2 0xD7 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x75 PUSH2 0x105 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x91 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x8C SWAP2 SWAP1 PUSH2 0x1F5 JUMP JUMPDEST PUSH2 0x15E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x9E SWAP2 SWAP1 PUSH2 0x231 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0xC1 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0xBC SWAP2 SWAP1 PUSH2 0x1C8 JUMP JUMPDEST PUSH2 0x17E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xCE SWAP2 SWAP1 PUSH2 0x231 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x1 PUSH1 0x0 DUP1 DUP4 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH1 0x1 DUP1 PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x1AD DUP2 PUSH2 0x299 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x1C2 DUP2 PUSH2 0x2B0 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1DE JUMPI PUSH2 0x1DD PUSH2 0x294 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x1EC DUP5 DUP3 DUP6 ADD PUSH2 0x19E JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x20B JUMPI PUSH2 0x20A PUSH2 0x294 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x219 DUP5 DUP3 DUP6 ADD PUSH2 0x1B3 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x22B DUP2 PUSH2 0x25E JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x246 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x222 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x257 DUP3 PUSH2 0x26A JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 ISZERO ISZERO SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x2A2 DUP2 PUSH2 0x24C JUMP JUMPDEST DUP2 EQ PUSH2 0x2AD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH2 0x2B9 DUP2 PUSH2 0x28A JUMP JUMPDEST DUP2 EQ PUSH2 0x2C4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x21 DUP6 DUP9 DELEGATECALL 0x5F 0xEB 0xC3 0xA7 0xD0 0x21 MOD PUSH2 0x831F PC 0xA8 0xCB PUSH24 0xD7528E23B21065C2FF111236F75E64736F6C634300080700 CALLER ",
"sourceMap": "25:314:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;161:79;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;246:89;;;:::i;:::-;;62:38;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;106:48;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;161:79;229:4;209:9;:17;219:6;209:17;;;;;;;;;;;;:24;;;;;;;;;;;;;;;;;;161:79;:::o;246:89::-;324:4;293:16;:28;310:10;293:28;;;;;;;;;;;;;;;;:35;;;;;;;;;;;;;;;;;;246:89::o;62:38::-;;;;;;;;;;;;;;;;;;;;;;:::o;106:48::-;;;;;;;;;;;;;;;;;;;;;;:::o;7:139:1:-;53:5;91:6;78:20;69:29;;107:33;134:5;107:33;:::i;:::-;7:139;;;;:::o;152:::-;198:5;236:6;223:20;214:29;;252:33;279:5;252:33;:::i;:::-;152:139;;;;:::o;297:329::-;356:6;405:2;393:9;384:7;380:23;376:32;373:119;;;411:79;;:::i;:::-;373:119;531:1;556:53;601:7;592:6;581:9;577:22;556:53;:::i;:::-;546:63;;502:117;297:329;;;;:::o;632:::-;691:6;740:2;728:9;719:7;715:23;711:32;708:119;;;746:79;;:::i;:::-;708:119;866:1;891:53;936:7;927:6;916:9;912:22;891:53;:::i;:::-;881:63;;837:117;632:329;;;;:::o;967:109::-;1048:21;1063:5;1048:21;:::i;:::-;1043:3;1036:34;967:109;;:::o;1082:210::-;1169:4;1207:2;1196:9;1192:18;1184:26;;1220:65;1282:1;1271:9;1267:17;1258:6;1220:65;:::i;:::-;1082:210;;;;:::o;1379:96::-;1416:7;1445:24;1463:5;1445:24;:::i;:::-;1434:35;;1379:96;;;:::o;1481:90::-;1515:7;1558:5;1551:13;1544:21;1533:32;;1481:90;;;:::o;1577:126::-;1614:7;1654:42;1647:5;1643:54;1632:65;;1577:126;;;:::o;1709:77::-;1746:7;1775:5;1764:16;;1709:77;;;:::o;1915:117::-;2024:1;2021;2014:12;2038:122;2111:24;2129:5;2111:24;:::i;:::-;2104:5;2101:35;2091:63;;2150:1;2147;2140:12;2091:63;2038:122;:::o;2166:::-;2239:24;2257:5;2239:24;:::i;:::-;2232:5;2229:35;2219:63;;2278:1;2275;2268:12;2219:63;2166:122;:::o"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "153000",
"executionCost": "196",
"totalCost": "153196"
},
"external": {
"myAddressMapping(address)": "2889",
"myMapping(uint256)": "2818",
"setMyAddressToTrue()": "24500",
"setValue(uint256)": "24729"
}
},
"methodIdentifiers": {
"myAddressMapping(address)": "b92ba3b8",
"myMapping(uint256)": "7c668844",
"setMyAddressToTrue()": "634899ce",
"setValue(uint256)": "55241077"
}
},
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "myAddressMapping",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "myMapping",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "setMyAddressToTrue",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_index",
"type": "uint256"
}
],
"name": "setValue",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
}
{
"compiler": {
"version": "0.8.7+commit.e28d00a7"
},
"language": "Solidity",
"output": {
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "myAddressMapping",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "myMapping",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "setMyAddressToTrue",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_index",
"type": "uint256"
}
],
"name": "setValue",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/mappingBasicss.sol": "SimpleMappingExample"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"contracts/mappingBasicss.sol": {
"keccak256": "0x7344d6140a39d92caae0d6cfa4a36fa5e0bd5d3264347fc1717b6700cdbe0e91",
"urls": [
"bzz-raw://0c9e30eb43879da4c054da368620cbc77c8d9746964e610b8437531bf7252556",
"dweb:/ipfs/QmTTDp8fXgD4imJQe5P3XSdhU3zZH9rGgYteBe8C9MAxM6"
]
}
},
"version": 1
}
pragma solidity ^0.8.4;
contract SimpleMappingExample {
mapping(uint => bool) public myMapping;
mapping(address => bool) public myAddressMapping;
function setValue(uint _index) public {
myMapping[_index] = true;
}
function setMyAddressToTrue() public {
myAddressMapping[msg.sender] = true;
}
}
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.1;
contract StartStopUpdateExample {
address public owner;
bool public pause;
constructor(){
owner = msg.sender;
}
function pauseTranx(bool _paused) public {
require(owner == msg.sender, "Sorry you aren't owner");
pause = _paused;
}
function sendMoney() public payable {
}
function withdrawAllMoney(address payable _to) public {
require(owner == msg.sender, "Sorry you aren't owner. ");
require(!pause, "Sorry Account is Disabled.");
_to.transfer(address(this).balance);
}
}
pragma solidity ^0.8.1;
contract SendMoneyExample {
uint public balanceReceived;
function receiveMoney() public payable {
balanceReceived += msg.value;
}
function getBalance() public view returns(uint) {
return address(this).balance;
}
// function withdrawMoney() public {
// address payable to = payable(msg.sender);
// to.transfer(getBalance());
// }
function withdrawMoney(address payable _to) public {
// address payable to = payable(msg.sender);
_to.transfer(getBalance());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment