├── contracts ├── SampleFallBack.sol ├── ExampleBoolean.sol ├── 2_TestWeb3.sol ├── MyContract.sol ├── ExampleContract.sol ├── 3_practice.sol ├── ExampleAddress.sol ├── ExampleMsgSender.sol ├── ExampleMapping.sol ├── ExampleConstructor.sol ├── TheBlockChianMessenger.sol ├── ExampleStruct.sol ├── ExampleUnit.sol ├── 1_SendMoney.sol ├── 1_Storage.sol ├── EventExample.sol ├── SmartMoney.sol ├── ExamplePayable.sol ├── ExampleMappingWithdraw.sol ├── ExampleViewPure.sol ├── 4_mappingStructArray.sol ├── ExampleExceptionRequire.sol ├── artifacts │ ├── Owned_metadata.json │ ├── Wallet2_metadata.json │ ├── Wallet_metadata.json │ ├── TestWeb3_metadata.json │ ├── ExampleBoolean_metadata.json │ ├── MyContract_metadata.json │ ├── ExamplePayable_metadata.json │ ├── SampleContract_metadata.json │ ├── ExampleContract_metadata.json │ ├── ExampleMappingWithdraws_metadata.json │ ├── SmartWallet_metadata.json │ ├── ExampleAddress_metadata.json │ ├── SendMoney_metadata.json │ ├── ExceptionExample_metadata.json │ ├── ExampleConstructor_metadata.json │ ├── ExceptionRequireExample_metadata.json │ ├── SmartMoney_metadata.json │ ├── ExampleMsgSender_metadata.json │ ├── SimpleMappingExample_metadata.json │ ├── TheBlockchainMessenger_metadata.json │ ├── ExampleViewPure_metadata.json │ ├── ExampleUnit_metadata.json │ ├── InheritanceModifierExample_metadata.json │ ├── build-info │ │ ├── 21961d2c84f53cc2686625aacc986561.json │ │ └── 7f510c21d83fef8826c9d75898f70ee2.json │ ├── EventExample_metadata.json │ ├── Owned.json │ ├── SimpleStorage_metadata.json │ ├── SampleWallet_metadata.json │ ├── ExceptionRequireExample.json │ ├── DevCoin_metadata.json │ ├── ExceptionExample.json │ ├── ExampleMsgSender.json │ └── Wallet.json ├── InheritanceModifiers.sol ├── ExampleMappingStruct.sol ├── 2_Owner.sol ├── SmartWalletProject.sol └── 3_Ballot.sol ├── scripts ├── accounts.js ├── deploy_with_web3.ts ├── deploy_with_ethers.ts ├── updateString.js ├── ethers-lib.ts └── web3-lib.ts ├── .deps ├── github │ └── OpenZeppelin │ │ └── openzeppelin-contracts │ │ └── contracts │ │ ├── token │ │ └── ERC20 │ │ │ ├── extensions │ │ │ └── IERC20Metadata.sol │ │ │ ├── IERC20.sol │ │ │ └── ERC20.sol │ │ ├── utils │ │ └── Context.sol │ │ └── access │ │ └── Ownable.sol └── remix-tests │ ├── remix_accounts.sol │ └── remix_tests.sol ├── .prettierrc.json ├── tests ├── storage.test.js ├── Ballot_test.sol └── artifacts │ └── BallotTest_metadata.json └── README.txt /contracts/SampleFallBack.sol: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /contracts/ExampleBoolean.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.14; 3 | 4 | contract ExampleBoolean { 5 | bool public myBool; 6 | 7 | function setBool(bool _myBool) public { 8 | myBool = _myBool; 9 | } 10 | } -------------------------------------------------------------------------------- /contracts/2_TestWeb3.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.16; 4 | 5 | contract TestWeb3{ 6 | 7 | uint public myUint = 10; 8 | 9 | function setmyUint(uint _newUint) public { 10 | myUint = _newUint; 11 | } 12 | } -------------------------------------------------------------------------------- /contracts/MyContract.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.14; 3 | 4 | contract MyContract { 5 | string public ourString = "Hello World"; 6 | 7 | function updateOurString(string memory _updateString) public { 8 | ourString = _updateString; 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /contracts/ExampleContract.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.8.14; 4 | 5 | contract ExampleContract { 6 | 7 | string public myString = "Hello world"; 8 | 9 | function updateString(string memory _newString) public { 10 | myString = _newString; 11 | } 12 | } -------------------------------------------------------------------------------- /contracts/3_practice.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.16; 4 | import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; 5 | 6 | contract DevCoin is ERC20 { 7 | constructor() ERC20("DevCoin", "DEV"){ 8 | _mint(msg.sender, 10 * 10 ** 10); 9 | } 10 | } -------------------------------------------------------------------------------- /contracts/ExampleAddress.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.14; 3 | 4 | contract ExampleAddress { 5 | address public someAddress; 6 | 7 | function setSomeAddress(address _someAddress) public { 8 | someAddress = _someAddress; 9 | } 10 | 11 | function getAddressBalance() public view returns(uint){ 12 | return someAddress.balance; 13 | } 14 | } -------------------------------------------------------------------------------- /contracts/ExampleMsgSender.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.14; 3 | 4 | import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol"; 5 | contract ExampleMsgSender { 6 | 7 | address public myAddress; 8 | 9 | function setMyAddress() public { 10 | myAddress = msg.sender; // msg.sender address is the user's account address who is interacting with the contract. 11 | } 12 | } -------------------------------------------------------------------------------- /scripts/accounts.js: -------------------------------------------------------------------------------- 1 | //getting accounts 2 | 3 | (async()=>{ 4 | let accounts = await web3.eth.getAccounts(); // getting accounts selected into metamask 5 | console.log(accounts, accounts.length); 6 | 7 | let balance = await web3.eth.getBalance(accounts[0]); 8 | console.log(balance); //wei 9 | 10 | console.log( await web3.utils.fromWei(balance, "ether")); // converting balance wei to eth 11 | })() // anonymous arrow function and calling the function 12 | -------------------------------------------------------------------------------- /contracts/ExampleMapping.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract SimpleMappingExample { 6 | 7 | mapping(uint => bool) public myMapping; 8 | mapping(address => bool) public myAddressMapping; 9 | 10 | function setValue(uint _index) public { 11 | myMapping[_index] = true; 12 | } 13 | 14 | function setMyAddressToTrue() public { 15 | myAddressMapping[msg.sender] = true; 16 | } 17 | 18 | 19 | } -------------------------------------------------------------------------------- /contracts/ExampleConstructor.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.8.14; 4 | 5 | contract ExampleConstructor { 6 | 7 | address public myAddress; 8 | 9 | //constructors run automatically only for once. 10 | constructor(address _someAddress) { 11 | myAddress = _someAddress; 12 | } 13 | 14 | function setMyAddress(address _myAddress) public { 15 | myAddress = _myAddress; 16 | } 17 | function setMyAddressToMsgSender() public { 18 | myAddress = msg.sender; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /contracts/TheBlockChianMessenger.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.8.14; 4 | 5 | contract TheBlockchainMessenger { 6 | 7 | uint public changeCounter; 8 | 9 | address public owner; 10 | 11 | string public theMessage; 12 | 13 | constructor() { 14 | owner = msg.sender; 15 | } 16 | 17 | function updateTheMessage(string memory _newMessage) public { 18 | if(msg.sender == owner) { 19 | theMessage = _newMessage; 20 | changeCounter++; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /contracts/ExampleStruct.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.8.15; 4 | 5 | contract Wallet { 6 | struct PaymentReceivedStruct { 7 | address from; 8 | uint amount; 9 | } 10 | 11 | PaymentReceivedStruct public payment; 12 | 13 | function payContract() public payable { 14 | payment = PaymentReceivedStruct(msg.sender, msg.value); //this line indicate the menaing of line below calling the struct and acessing value 15 | // payment.from = from; 16 | // payment.amout = amount; 17 | } 18 | } -------------------------------------------------------------------------------- /scripts/deploy_with_web3.ts: -------------------------------------------------------------------------------- 1 | // This script can be used to deploy the "Storage" contract using Web3 library. 2 | // Please make sure to compile "./contracts/1_Storage.sol" file before running this script. 3 | // And use Right click -> "Run" from context menu of the file to run the script. Shortcut: Ctrl+Shift+S 4 | 5 | import { deploy } from './web3-lib' 6 | 7 | (async () => { 8 | try { 9 | const result = await deploy('Storage', []) 10 | console.log(`address: ${result.address}`) 11 | } catch (e) { 12 | console.log(e.message) 13 | } 14 | })() -------------------------------------------------------------------------------- /contracts/ExampleUnit.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.14; 3 | 4 | contract ExampleUnit { 5 | uint256 public myUint; // range 0 to 2^256-1 6 | uint8 public unit8; // range 0 - 2^8-1; 7 | int public myInt = -10; // int can store negative value also. range -2^128 to +2^128-1 8 | 9 | function setUnit(uint _myUint) public { 10 | myUint = _myUint; 11 | } 12 | 13 | function increamentMyUint () public { 14 | myUint++; 15 | } 16 | 17 | function increamentInt () public { 18 | myInt++; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /scripts/deploy_with_ethers.ts: -------------------------------------------------------------------------------- 1 | // This script can be used to deploy the "Storage" contract using ethers.js library. 2 | // Please make sure to compile "./contracts/1_Storage.sol" file before running this script. 3 | // And use Right click -> "Run" from context menu of the file to run the script. Shortcut: Ctrl+Shift+S 4 | 5 | import { deploy } from './ethers-lib' 6 | 7 | (async () => { 8 | try { 9 | const result = await deploy('Storage', []) 10 | console.log(`address: ${result.address}`) 11 | } catch (e) { 12 | console.log(e.message) 13 | } 14 | })() -------------------------------------------------------------------------------- /contracts/1_SendMoney.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.16; 4 | 5 | contract SendMoney { 6 | 7 | function sendMoneyToContract() public payable { 8 | //this function send money to smart contract 9 | } 10 | 11 | function getContractBalance() public view returns(uint){ 12 | return address(this).balance; 13 | } 14 | //adress should be payable to transfer or recive money. 15 | function transferMoneyFromContract(address payable _to, uint _amount) public { 16 | require(address(this).balance >= _amount, "Not enough money"); 17 | _to.transfer(_amount); 18 | } 19 | } -------------------------------------------------------------------------------- /contracts/1_Storage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.8.2 <0.9.0; 4 | 5 | /** 6 | * @title Storage 7 | * @dev Store & retrieve value in a variable 8 | * @custom:dev-run-script ./scripts/deploy_with_ethers.ts 9 | */ 10 | contract Storage { 11 | 12 | uint256 number; 13 | 14 | /** 15 | * @dev Store value in variable 16 | * @param num value to store 17 | */ 18 | function store(uint256 num) public { 19 | number = num; 20 | } 21 | 22 | /** 23 | * @dev Return value 24 | * @return value of 'number' 25 | */ 26 | function retrieve() public view returns (uint256){ 27 | return number; 28 | } 29 | } -------------------------------------------------------------------------------- /contracts/EventExample.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.16; 3 | 4 | contract EventExample { 5 | 6 | mapping(address => uint) public tokenBalance; 7 | 8 | event TokensSent(address _from, address _to, uint _amount); 9 | 10 | constructor() { 11 | tokenBalance[msg.sender] = 100; 12 | } 13 | 14 | function sendToken(address _to, uint _amount) public returns(bool) { 15 | require(tokenBalance[msg.sender] >= _amount, "Not enough tokens"); 16 | tokenBalance[msg.sender] -= _amount; 17 | tokenBalance[_to] += _amount; 18 | 19 | emit TokensSent(msg.sender, _to, _amount); 20 | return true; 21 | } 22 | } -------------------------------------------------------------------------------- /contracts/SmartMoney.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.8.14; 4 | 5 | contract SmartMoney { 6 | 7 | uint public balanceReceived; 8 | function deposit() public payable { 9 | balanceReceived += msg.value; 10 | } 11 | 12 | function getContractBalance() public view returns(uint){ 13 | return address(this).balance; //address.this.balcne return the balance of the addresss 14 | } 15 | 16 | function withdrawALL() public { 17 | address payable to = payable(msg.sender); 18 | to.transfer(getContractBalance()); 19 | } 20 | 21 | function withdrawToAddress(address payable to) public { 22 | to.transfer(getContractBalance()); 23 | } 24 | } -------------------------------------------------------------------------------- /contracts/ExamplePayable.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.8.14; 4 | 5 | contract ExamplePayable{ 6 | // if we send 1 eth with transaction only then string will be updated. 7 | 8 | string public myString = "Hello world"; 9 | 10 | function updateString(string memory _newString) public payable { //payable modifer allowe to recieve eth 11 | if(msg.value == 1 ether){ 12 | myString = _newString; 13 | } else{ 14 | payable(msg.sender).transfer(msg.value);// user jodi 1 ether send na kore 1 gwei send kore transaction hocce ebong tar gwei kete jacche 15 | //se jonno se gwei tar access e back korte dicche ba transfer kore dicchi. ba 1 eth er kom ba besi dileo se eth back kore dibe user k 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /contracts/ExampleMappingWithdraw.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.14; 4 | 5 | contract ExampleMappingWithdraws { 6 | 7 | mapping(address => uint) balanceReceived; 8 | function sendMoney() public payable { 9 | //this function send money to smart contract automatically 10 | balanceReceived[msg.sender] += msg.value; 11 | } 12 | 13 | function getBalance() public view returns(uint) { 14 | return address(this).balance; //checking balance of smart contract balance; 15 | } 16 | 17 | function withdrawAllMoney(address payable _to) public { 18 | // _to.transfer(getBalance()); 19 | uint balacneToSendOut = balanceReceived[msg.sender]; 20 | balanceReceived[msg.sender] = 0; 21 | _to.transfer(balacneToSendOut); 22 | } 23 | } -------------------------------------------------------------------------------- /contracts/ExampleViewPure.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.14; 3 | 4 | contract ExampleViewPure { 5 | //difference between view function and pure function 6 | //view fucntion can access storeAge varibale. can access outside scope variable. 7 | //but pure function cannot access storeage variable and outside scope variable. 8 | //reading function should not contain returns(uint/something) 9 | 10 | 11 | uint public myStoreageVariable; 12 | 13 | function getMyStoreageVariable () public view returns(uint){ 14 | return myStoreageVariable; 15 | } 16 | 17 | function setMyStoreVariable(uint _newVariable) public { 18 | myStoreageVariable = _newVariable; 19 | } 20 | 21 | //view fucntion 22 | function viewFunction(uint a, uint b) public pure returns(uint){ 23 | return a + b; 24 | } 25 | } -------------------------------------------------------------------------------- /.deps/github/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../IERC20.sol"; 7 | 8 | /** 9 | * @dev Interface for the optional metadata functions from the ERC20 standard. 10 | * 11 | * _Available since v4.1._ 12 | */ 13 | interface IERC20Metadata is IERC20 { 14 | /** 15 | * @dev Returns the name of the token. 16 | */ 17 | function name() external view returns (string memory); 18 | 19 | /** 20 | * @dev Returns the symbol of the token. 21 | */ 22 | function symbol() external view returns (string memory); 23 | 24 | /** 25 | * @dev Returns the decimals places of the token. 26 | */ 27 | function decimals() external view returns (uint8); 28 | } 29 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "overrides": [ 3 | { 4 | "files": "*.sol", 5 | "options": { 6 | "printWidth": 80, 7 | "tabWidth": 4, 8 | "useTabs": false, 9 | "singleQuote": false, 10 | "bracketSpacing": false 11 | } 12 | }, 13 | { 14 | "files": "*.yml", 15 | "options": {} 16 | }, 17 | { 18 | "files": "*.yaml", 19 | "options": {} 20 | }, 21 | { 22 | "files": "*.toml", 23 | "options": {} 24 | }, 25 | { 26 | "files": "*.json", 27 | "options": {} 28 | }, 29 | { 30 | "files": "*.js", 31 | "options": {} 32 | }, 33 | { 34 | "files": "*.ts", 35 | "options": {} 36 | } 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /contracts/4_mappingStructArray.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.17; 3 | 4 | contract SimpleStorage { 5 | mapping(address => Pass[]) passes; 6 | 7 | struct Pass { 8 | string first_name; 9 | string last_name; 10 | } 11 | 12 | struct Test { 13 | address to; 14 | string first_name; 15 | string last_name; 16 | } 17 | 18 | Test[] private test; 19 | 20 | function submitPass(address to, string memory firstName, string memory lastName) public { 21 | passes[to].push(Pass({ 22 | first_name: firstName, 23 | last_name: lastName 24 | })); 25 | test.push( 26 | Test(to, firstName, lastName) 27 | ); 28 | } 29 | 30 | function getResponseByAddress() public view returns(Pass[] memory){ 31 | return passes[msg.sender]; 32 | } 33 | 34 | function getAllResponses() public view returns(Test[] memory){ 35 | return test; 36 | } 37 | } -------------------------------------------------------------------------------- /.deps/github/OpenZeppelin/openzeppelin-contracts/contracts/utils/Context.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Provides information about the current execution context, including the 8 | * sender of the transaction and its data. While these are generally available 9 | * via msg.sender and msg.data, they should not be accessed in such a direct 10 | * manner, since when dealing with meta-transactions the account sending and 11 | * paying for execution may not be the actual sender (as far as an application 12 | * is concerned). 13 | * 14 | * This contract is only required for intermediate, library-like contracts. 15 | */ 16 | abstract contract Context { 17 | function _msgSender() internal view virtual returns (address) { 18 | return msg.sender; 19 | } 20 | 21 | function _msgData() internal view virtual returns (bytes calldata) { 22 | return msg.data; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/storage.test.js: -------------------------------------------------------------------------------- 1 | // Right click on the script name and hit "Run" to execute 2 | const { expect } = require("chai"); 3 | const { ethers } = require("hardhat"); 4 | 5 | describe("Storage", function () { 6 | it("test initial value", async function () { 7 | const Storage = await ethers.getContractFactory("Storage"); 8 | const storage = await Storage.deploy(); 9 | await storage.deployed(); 10 | console.log('storage deployed at:'+ storage.address) 11 | expect((await storage.retrieve()).toNumber()).to.equal(0); 12 | }); 13 | it("test updating and retrieving updated value", async function () { 14 | const Storage = await ethers.getContractFactory("Storage"); 15 | const storage = await Storage.deploy(); 16 | await storage.deployed(); 17 | const storage2 = await ethers.getContractAt("Storage", storage.address); 18 | const setValue = await storage2.store(56); 19 | await setValue.wait(); 20 | expect((await storage2.retrieve()).toNumber()).to.equal(56); 21 | }); 22 | }); -------------------------------------------------------------------------------- /contracts/ExampleExceptionRequire.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | contract ExceptionExample { 6 | 7 | mapping(address => uint) public balanceReceived; 8 | 9 | function receiveMoney() public payable { 10 | balanceReceived[msg.sender] += msg.value; 11 | } 12 | 13 | function withdrawMoney(address payable _to, uint _amount) public { 14 | // if(_amount <= balanceReceived[msg.sender]) { 15 | // balanceReceived[msg.sender] -= _amount; 16 | // _to.transfer(_amount); 17 | // } 18 | 19 | // require diye if er same kaj tai kora hoise but ekhane ektu validation kora hoise. first e smart contract e 100 gwei send korlam then 101 gwei witdraw korbo tahole transaction faild hobe error dibe.. if die korle transaction hobe but withdraw hobe na.. 20 | require(_amount <= balanceReceived[msg.sender], "Not Enough Funds, aborting"); 21 | 22 | balanceReceived[msg.sender] -= _amount; 23 | _to.transfer(_amount); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/Ballot_test.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | import "remix_tests.sol"; // this import is automatically injected by Remix. 5 | import "hardhat/console.sol"; 6 | import "../contracts/3_Ballot.sol"; 7 | 8 | contract BallotTest { 9 | 10 | bytes32[] proposalNames; 11 | 12 | Ballot ballotToTest; 13 | function beforeAll () public { 14 | proposalNames.push(bytes32("candidate1")); 15 | ballotToTest = new Ballot(proposalNames); 16 | } 17 | 18 | function checkWinningProposal () public { 19 | console.log("Running checkWinningProposal"); 20 | ballotToTest.vote(0); 21 | Assert.equal(ballotToTest.winningProposal(), uint(0), "proposal at index 0 should be the winning proposal"); 22 | Assert.equal(ballotToTest.winnerName(), bytes32("candidate1"), "candidate1 should be the winner name"); 23 | } 24 | 25 | function checkWinninProposalWithReturnValue () public view returns (bool) { 26 | return ballotToTest.winningProposal() == 0; 27 | } 28 | } -------------------------------------------------------------------------------- /contracts/artifacts/Owned_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.19+commit.7dd6d404" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "stateMutability": "nonpayable", 11 | "type": "constructor" 12 | } 13 | ], 14 | "devdoc": { 15 | "kind": "dev", 16 | "methods": {}, 17 | "version": 1 18 | }, 19 | "userdoc": { 20 | "kind": "user", 21 | "methods": {}, 22 | "version": 1 23 | } 24 | }, 25 | "settings": { 26 | "compilationTarget": { 27 | "contracts/InheritanceModifiers.sol": "Owned" 28 | }, 29 | "evmVersion": "paris", 30 | "libraries": {}, 31 | "metadata": { 32 | "bytecodeHash": "ipfs" 33 | }, 34 | "optimizer": { 35 | "enabled": false, 36 | "runs": 200 37 | }, 38 | "remappings": [] 39 | }, 40 | "sources": { 41 | "contracts/InheritanceModifiers.sol": { 42 | "keccak256": "0x9a0a09562e2e02c6dd516dd3088965bd77db44f5e2538e05078e3324ce943353", 43 | "license": "MIT", 44 | "urls": [ 45 | "bzz-raw://8572bada340c43e6c44ea9c8edd907a8380f9e9bee568949a1ea1df9ac717fb8", 46 | "dweb:/ipfs/QmX9SFBvvpNc5yMjHoY329Hb1mh4yERJhccrwBH6CrLejW" 47 | ] 48 | } 49 | }, 50 | "version": 1 51 | } -------------------------------------------------------------------------------- /scripts/updateString.js: -------------------------------------------------------------------------------- 1 | //accessing MyContract contract using js 2 | (async()=>{ 3 | const address = "0xd8b934580fcE35a11B58C6D73aDeE468a2833fa8"; // deployed smart contract address 4 | const abiArray = [ 5 | { 6 | "inputs": [], 7 | "name": "ourString", 8 | "outputs": [ 9 | { 10 | "internalType": "string", 11 | "name": "", 12 | "type": "string" 13 | } 14 | ], 15 | "stateMutability": "view", 16 | "type": "function" 17 | }, 18 | { 19 | "inputs": [ 20 | { 21 | "internalType": "string", 22 | "name": "_updateString", 23 | "type": "string" 24 | } 25 | ], 26 | "name": "updateOurString", 27 | "outputs": [], 28 | "stateMutability": "nonpayable", 29 | "type": "function" 30 | } 31 | ] 32 | 33 | const contractInstance = new web3.eth.Contract(abiArray, address); 34 | 35 | 36 | console.log(await contractInstance.methods.ourString().call()); // 37 | 38 | let accounts = await web3.eth.getAccounts(); 39 | let transactionResult = await contractInstance.methods.updateOurString("Love you eth").send({from: accounts[0]}); //updating string accessing write function 40 | console.log(await contractInstance.methods.ourString().call()); //reading ourStringFunction/variable 41 | console.log(transactionResult); 42 | 43 | })() -------------------------------------------------------------------------------- /.deps/remix-tests/remix_accounts.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.4.22 <0.9.0; 4 | 5 | library TestsAccounts { 6 | function getAccount(uint index) pure public returns (address) { 7 | address[15] memory accounts; 8 | accounts[0] = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4; 9 | 10 | accounts[1] = 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2; 11 | 12 | accounts[2] = 0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db; 13 | 14 | accounts[3] = 0x78731D3Ca6b7E34aC0F824c42a7cC18A495cabaB; 15 | 16 | accounts[4] = 0x617F2E2fD72FD9D5503197092aC168c91465E7f2; 17 | 18 | accounts[5] = 0x17F6AD8Ef982297579C203069C1DbfFE4348c372; 19 | 20 | accounts[6] = 0x5c6B0f7Bf3E7ce046039Bd8FABdfD3f9F5021678; 21 | 22 | accounts[7] = 0x03C6FcED478cBbC9a4FAB34eF9f40767739D1Ff7; 23 | 24 | accounts[8] = 0x1aE0EA34a72D944a8C7603FfB3eC30a6669E454C; 25 | 26 | accounts[9] = 0x0A098Eda01Ce92ff4A4CCb7A4fFFb5A43EBC70DC; 27 | 28 | accounts[10] = 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c; 29 | 30 | accounts[11] = 0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C; 31 | 32 | accounts[12] = 0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB; 33 | 34 | accounts[13] = 0x583031D1113aD414F02576BD6afaBfb302140225; 35 | 36 | accounts[14] = 0xdD870fA1b7C4700F2BD7f44238821C26f7392148; 37 | 38 | return accounts[index]; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /scripts/ethers-lib.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers' 2 | 3 | /** 4 | * Deploy the given contract 5 | * @param {string} contractName name of the contract to deploy 6 | * @param {Array} args list of constructor' parameters 7 | * @param {Number} accountIndex account index from the exposed account 8 | * @return {Contract} deployed contract 9 | */ 10 | export const deploy = async (contractName: string, args: Array, accountIndex?: number): Promise => { 11 | 12 | console.log(`deploying ${contractName}`) 13 | // Note that the script needs the ABI which is generated from the compilation artifact. 14 | // Make sure contract is compiled and artifacts are generated 15 | const artifactsPath = `browser/contracts/artifacts/${contractName}.json` // Change this for different path 16 | 17 | const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath)) 18 | // 'web3Provider' is a remix global variable object 19 | 20 | const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner(accountIndex) 21 | 22 | const factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer) 23 | 24 | const contract = await factory.deploy(...args) 25 | 26 | // The contract is NOT deployed yet; we must wait until it is mined 27 | await contract.deployed() 28 | return contract 29 | } -------------------------------------------------------------------------------- /contracts/InheritanceModifiers.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.16; 4 | 5 | contract Owned { 6 | address owner; 7 | 8 | constructor() { 9 | owner = msg.sender; 10 | } 11 | 12 | modifier onlyOwner() { 13 | require(msg.sender == owner, "You are not allowed"); 14 | _; 15 | } 16 | } 17 | 18 | contract InheritanceModifierExample is Owned { 19 | 20 | mapping(address => uint) public tokenBalance; 21 | 22 | uint tokenPrice = 1 ether; 23 | 24 | constructor() { 25 | tokenBalance[owner] = 100; 26 | } 27 | 28 | function createNewToken() public onlyOwner { 29 | tokenBalance[owner]++; 30 | } 31 | 32 | function burnToken() public onlyOwner { 33 | tokenBalance[owner]--; 34 | } 35 | 36 | function purchaseToken() public payable { 37 | require((tokenBalance[owner] * tokenPrice) / msg.value > 0, "not enough tokens"); 38 | tokenBalance[owner] -= msg.value / tokenPrice; 39 | tokenBalance[msg.sender] += msg.value / tokenPrice; 40 | } 41 | 42 | function sendToken(address _to, uint _amount) public { 43 | require(tokenBalance[msg.sender] >= _amount, "Not enough tokens"); 44 | assert(tokenBalance[_to] + _amount >= tokenBalance[_to]); 45 | assert(tokenBalance[msg.sender] - _amount <= tokenBalance[msg.sender]); 46 | tokenBalance[msg.sender] -= _amount; 47 | tokenBalance[_to] += _amount; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /scripts/web3-lib.ts: -------------------------------------------------------------------------------- 1 | import Web3 from 'web3' 2 | import { Contract, ContractSendMethod, Options } from 'web3-eth-contract' 3 | 4 | /** 5 | * Deploy the given contract 6 | * @param {string} contractName name of the contract to deploy 7 | * @param {Array} args list of constructor' parameters 8 | * @param {string} from account used to send the transaction 9 | * @param {number} gas gas limit 10 | * @return {Options} deployed contract 11 | */ 12 | export const deploy = async (contractName: string, args: Array, from?: string, gas?: number): Promise => { 13 | 14 | const web3 = new Web3(web3Provider) 15 | console.log(`deploying ${contractName}`) 16 | // Note that the script needs the ABI which is generated from the compilation artifact. 17 | // Make sure contract is compiled and artifacts are generated 18 | const artifactsPath = `browser/contracts/artifacts/${contractName}.json` 19 | 20 | const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath)) 21 | 22 | const accounts = await web3.eth.getAccounts() 23 | 24 | const contract: Contract = new web3.eth.Contract(metadata.abi) 25 | 26 | const contractSend: ContractSendMethod = contract.deploy({ 27 | data: metadata.data.bytecode.object, 28 | arguments: args 29 | }) 30 | 31 | const newContractInstance = await contractSend.send({ 32 | from: from || accounts[0], 33 | gas: gas || 1500000 34 | }) 35 | return newContractInstance.options 36 | } -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | REMIX DEFAULT WORKSPACE 2 | 3 | Remix default workspace is present when: 4 | i. Remix loads for the very first time 5 | ii. A new workspace is created with 'Default' template 6 | iii. There are no files existing in the File Explorer 7 | 8 | This workspace contains 3 directories: 9 | 10 | 1. 'contracts': Holds three contracts with increasing levels of complexity. 11 | 2. 'scripts': Contains four typescript files to deploy a contract. It is explained below. 12 | 3. 'tests': Contains one Solidity test file for 'Ballot' contract & one JS test file for 'Storage' contract. 13 | 14 | SCRIPTS 15 | 16 | The 'scripts' folder has four typescript files which help to deploy the 'Storage' contract using 'web3.js' and 'ethers.js' libraries. 17 | 18 | For the deployment of any other contract, just update the contract's name from 'Storage' to the desired contract and provide constructor arguments accordingly 19 | in the file `deploy_with_ethers.ts` or `deploy_with_web3.ts` 20 | 21 | In the 'tests' folder there is a script containing Mocha-Chai unit tests for 'Storage' contract. 22 | 23 | To run a script, right click on file name in the file explorer and click 'Run'. Remember, Solidity file must already be compiled. 24 | Output from script will appear in remix terminal. 25 | 26 | Please note, require/import is supported in a limited manner for Remix supported modules. 27 | For now, modules supported by Remix are ethers, web3, swarmgw, chai, multihashes, remix and hardhat only for hardhat.ethers object/plugin. 28 | For unsupported modules, an error like this will be thrown: ' module require is not supported by Remix IDE' will be shown. 29 | -------------------------------------------------------------------------------- /contracts/artifacts/Wallet2_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.15+commit.e14f2714" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "payContract", 11 | "outputs": [], 12 | "stateMutability": "payable", 13 | "type": "function" 14 | }, 15 | { 16 | "inputs": [], 17 | "name": "payment", 18 | "outputs": [ 19 | { 20 | "internalType": "address", 21 | "name": "from", 22 | "type": "address" 23 | }, 24 | { 25 | "internalType": "uint256", 26 | "name": "amount", 27 | "type": "uint256" 28 | } 29 | ], 30 | "stateMutability": "view", 31 | "type": "function" 32 | } 33 | ], 34 | "devdoc": { 35 | "kind": "dev", 36 | "methods": {}, 37 | "version": 1 38 | }, 39 | "userdoc": { 40 | "kind": "user", 41 | "methods": {}, 42 | "version": 1 43 | } 44 | }, 45 | "settings": { 46 | "compilationTarget": { 47 | "contracts/ExampleStruct.sol": "Wallet2" 48 | }, 49 | "evmVersion": "london", 50 | "libraries": {}, 51 | "metadata": { 52 | "bytecodeHash": "ipfs" 53 | }, 54 | "optimizer": { 55 | "enabled": false, 56 | "runs": 200 57 | }, 58 | "remappings": [] 59 | }, 60 | "sources": { 61 | "contracts/ExampleStruct.sol": { 62 | "keccak256": "0x28b68bba03efad84f84974047e4e7df276970a98d8a8d4d528dac8f4250eabf0", 63 | "license": "MIT", 64 | "urls": [ 65 | "bzz-raw://ac4dff5527e52adc4cf30ac9a5bb32ef9ca18fa8e2dd96d35fa9729ee19f754b", 66 | "dweb:/ipfs/QmbFuWK31FJ85GUDonaFtNyC89N13ks3w4Zmb4R8TjL42c" 67 | ] 68 | } 69 | }, 70 | "version": 1 71 | } -------------------------------------------------------------------------------- /contracts/artifacts/Wallet_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.15+commit.e14f2714" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "payContract", 11 | "outputs": [], 12 | "stateMutability": "payable", 13 | "type": "function" 14 | }, 15 | { 16 | "inputs": [], 17 | "name": "payment", 18 | "outputs": [ 19 | { 20 | "internalType": "address", 21 | "name": "from", 22 | "type": "address" 23 | }, 24 | { 25 | "internalType": "uint256", 26 | "name": "amount", 27 | "type": "uint256" 28 | } 29 | ], 30 | "stateMutability": "view", 31 | "type": "function" 32 | } 33 | ], 34 | "devdoc": { 35 | "kind": "dev", 36 | "methods": {}, 37 | "version": 1 38 | }, 39 | "userdoc": { 40 | "kind": "user", 41 | "methods": {}, 42 | "version": 1 43 | } 44 | }, 45 | "settings": { 46 | "compilationTarget": { 47 | "contracts/ExampleStruct.sol": "Wallet" 48 | }, 49 | "evmVersion": "london", 50 | "libraries": {}, 51 | "metadata": { 52 | "bytecodeHash": "ipfs" 53 | }, 54 | "optimizer": { 55 | "enabled": false, 56 | "runs": 200 57 | }, 58 | "remappings": [] 59 | }, 60 | "sources": { 61 | "contracts/ExampleStruct.sol": { 62 | "keccak256": "0xf48e2081cad01e44f372b2cfaf977d816c43dc7b98a5785a158b78e3100243fa", 63 | "license": "MIT", 64 | "urls": [ 65 | "bzz-raw://cbc1e516c6df7e2e2ab6fa973406fbed19fa49deae11df9b1f8ebae9f877052c", 66 | "dweb:/ipfs/QmQcwqthohHsE7qe3iXEXjUMqKpX8hWztG9euiJs2BVGvF" 67 | ] 68 | } 69 | }, 70 | "version": 1 71 | } -------------------------------------------------------------------------------- /contracts/artifacts/TestWeb3_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.19+commit.7dd6d404" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "myUint", 11 | "outputs": [ 12 | { 13 | "internalType": "uint256", 14 | "name": "", 15 | "type": "uint256" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [ 23 | { 24 | "internalType": "uint256", 25 | "name": "_newUint", 26 | "type": "uint256" 27 | } 28 | ], 29 | "name": "setmyUint", 30 | "outputs": [], 31 | "stateMutability": "nonpayable", 32 | "type": "function" 33 | } 34 | ], 35 | "devdoc": { 36 | "kind": "dev", 37 | "methods": {}, 38 | "version": 1 39 | }, 40 | "userdoc": { 41 | "kind": "user", 42 | "methods": {}, 43 | "version": 1 44 | } 45 | }, 46 | "settings": { 47 | "compilationTarget": { 48 | "contracts/2_TestWeb3.sol": "TestWeb3" 49 | }, 50 | "evmVersion": "paris", 51 | "libraries": {}, 52 | "metadata": { 53 | "bytecodeHash": "ipfs" 54 | }, 55 | "optimizer": { 56 | "enabled": false, 57 | "runs": 200 58 | }, 59 | "remappings": [] 60 | }, 61 | "sources": { 62 | "contracts/2_TestWeb3.sol": { 63 | "keccak256": "0x4c9200d0c6ce7e303ddca373eb6bd15d930368a5e8448156e7819d103819ebdc", 64 | "license": "MIT", 65 | "urls": [ 66 | "bzz-raw://52a14c2d1e006c40a30179c47140b88d698ecf902223e24642433aef35d7d02f", 67 | "dweb:/ipfs/QmV4vBLnHT13NxJdbHr2iBLJq4ojBm21hhx1WjPsZA3uKp" 68 | ] 69 | } 70 | }, 71 | "version": 1 72 | } -------------------------------------------------------------------------------- /contracts/artifacts/ExampleBoolean_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.14+commit.80d49f37" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "myBool", 11 | "outputs": [ 12 | { 13 | "internalType": "bool", 14 | "name": "", 15 | "type": "bool" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [ 23 | { 24 | "internalType": "bool", 25 | "name": "_myBool", 26 | "type": "bool" 27 | } 28 | ], 29 | "name": "setBool", 30 | "outputs": [], 31 | "stateMutability": "nonpayable", 32 | "type": "function" 33 | } 34 | ], 35 | "devdoc": { 36 | "kind": "dev", 37 | "methods": {}, 38 | "version": 1 39 | }, 40 | "userdoc": { 41 | "kind": "user", 42 | "methods": {}, 43 | "version": 1 44 | } 45 | }, 46 | "settings": { 47 | "compilationTarget": { 48 | "contracts/ExampleBoolean.sol": "ExampleBoolean" 49 | }, 50 | "evmVersion": "london", 51 | "libraries": {}, 52 | "metadata": { 53 | "bytecodeHash": "ipfs" 54 | }, 55 | "optimizer": { 56 | "enabled": false, 57 | "runs": 200 58 | }, 59 | "remappings": [] 60 | }, 61 | "sources": { 62 | "contracts/ExampleBoolean.sol": { 63 | "keccak256": "0x11788eea999ea595f8b874a122e53b1490f79f68754ea96b175292d264288400", 64 | "license": "MIT", 65 | "urls": [ 66 | "bzz-raw://6a22096abba602755ba10213b00feead389b8bbce4f57321c2ca33bd306930d8", 67 | "dweb:/ipfs/QmSZaJskEYRSW3YvdHXmvSV9whmiqttFxmtP6Z6ZBAkx4D" 68 | ] 69 | } 70 | }, 71 | "version": 1 72 | } -------------------------------------------------------------------------------- /contracts/artifacts/MyContract_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.14+commit.80d49f37" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "ourString", 11 | "outputs": [ 12 | { 13 | "internalType": "string", 14 | "name": "", 15 | "type": "string" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [ 23 | { 24 | "internalType": "string", 25 | "name": "_updateString", 26 | "type": "string" 27 | } 28 | ], 29 | "name": "updateOurString", 30 | "outputs": [], 31 | "stateMutability": "nonpayable", 32 | "type": "function" 33 | } 34 | ], 35 | "devdoc": { 36 | "kind": "dev", 37 | "methods": {}, 38 | "version": 1 39 | }, 40 | "userdoc": { 41 | "kind": "user", 42 | "methods": {}, 43 | "version": 1 44 | } 45 | }, 46 | "settings": { 47 | "compilationTarget": { 48 | "contracts/MyContract.sol": "MyContract" 49 | }, 50 | "evmVersion": "london", 51 | "libraries": {}, 52 | "metadata": { 53 | "bytecodeHash": "ipfs" 54 | }, 55 | "optimizer": { 56 | "enabled": false, 57 | "runs": 200 58 | }, 59 | "remappings": [] 60 | }, 61 | "sources": { 62 | "contracts/MyContract.sol": { 63 | "keccak256": "0xc5d3c5cfbf5df78648197308dd89e34ce057095fe77a944904ea793cd9353014", 64 | "license": "MIT", 65 | "urls": [ 66 | "bzz-raw://967835c15a2f1f393a1b5f8a4c4d67655b15981f8a804fd57fc19bc2dfa2497e", 67 | "dweb:/ipfs/QmVW9Pa4MMXQf7H2R7DrY8g8dnEMnd2ChTXKZ1gZQfpUwn" 68 | ] 69 | } 70 | }, 71 | "version": 1 72 | } -------------------------------------------------------------------------------- /contracts/artifacts/ExamplePayable_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.14+commit.80d49f37" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "myString", 11 | "outputs": [ 12 | { 13 | "internalType": "string", 14 | "name": "", 15 | "type": "string" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [ 23 | { 24 | "internalType": "string", 25 | "name": "_newString", 26 | "type": "string" 27 | } 28 | ], 29 | "name": "updateString", 30 | "outputs": [], 31 | "stateMutability": "payable", 32 | "type": "function" 33 | } 34 | ], 35 | "devdoc": { 36 | "kind": "dev", 37 | "methods": {}, 38 | "version": 1 39 | }, 40 | "userdoc": { 41 | "kind": "user", 42 | "methods": {}, 43 | "version": 1 44 | } 45 | }, 46 | "settings": { 47 | "compilationTarget": { 48 | "contracts/ExamplePayable.sol": "ExamplePayable" 49 | }, 50 | "evmVersion": "london", 51 | "libraries": {}, 52 | "metadata": { 53 | "bytecodeHash": "ipfs" 54 | }, 55 | "optimizer": { 56 | "enabled": false, 57 | "runs": 200 58 | }, 59 | "remappings": [] 60 | }, 61 | "sources": { 62 | "contracts/ExamplePayable.sol": { 63 | "keccak256": "0xa29e31deef03883ef6e03a4102be17d98af059a4fa09356c2252be63350c4ca6", 64 | "license": "MIT", 65 | "urls": [ 66 | "bzz-raw://a2c67d89414c3c7ba26b6a1dcb5ab5ebbe742d7e4a8a20495adf31933adcf228", 67 | "dweb:/ipfs/QmPnqZxJACqCbFw28wfSRaZRuV1LBtHvRnKVMAHGu6k41m" 68 | ] 69 | } 70 | }, 71 | "version": 1 72 | } -------------------------------------------------------------------------------- /contracts/artifacts/SampleContract_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.15+commit.e14f2714" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "myString", 11 | "outputs": [ 12 | { 13 | "internalType": "string", 14 | "name": "", 15 | "type": "string" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [ 23 | { 24 | "internalType": "string", 25 | "name": "_newString", 26 | "type": "string" 27 | } 28 | ], 29 | "name": "updateString", 30 | "outputs": [], 31 | "stateMutability": "payable", 32 | "type": "function" 33 | } 34 | ], 35 | "devdoc": { 36 | "kind": "dev", 37 | "methods": {}, 38 | "version": 1 39 | }, 40 | "userdoc": { 41 | "kind": "user", 42 | "methods": {}, 43 | "version": 1 44 | } 45 | }, 46 | "settings": { 47 | "compilationTarget": { 48 | "contracts/ExamplePayable.sol": "SampleContract" 49 | }, 50 | "evmVersion": "london", 51 | "libraries": {}, 52 | "metadata": { 53 | "bytecodeHash": "ipfs" 54 | }, 55 | "optimizer": { 56 | "enabled": false, 57 | "runs": 200 58 | }, 59 | "remappings": [] 60 | }, 61 | "sources": { 62 | "contracts/ExamplePayable.sol": { 63 | "keccak256": "0x76bbaeb3359b4bc65e0e413f2bf7f3173aa7f87d6f4f9dee5e7a7ba347b6e646", 64 | "license": "MIT", 65 | "urls": [ 66 | "bzz-raw://aed01c60b2ad11f9b157dacfdff09d8d01635400e1704f584ea518a83e6a5fe0", 67 | "dweb:/ipfs/QmewqKDcom9P7Qj2NtYeC66UtzJEeTbmvfTiDzFicb3VvU" 68 | ] 69 | } 70 | }, 71 | "version": 1 72 | } -------------------------------------------------------------------------------- /contracts/artifacts/ExampleContract_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.14+commit.80d49f37" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "myString", 11 | "outputs": [ 12 | { 13 | "internalType": "string", 14 | "name": "", 15 | "type": "string" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [ 23 | { 24 | "internalType": "string", 25 | "name": "_newString", 26 | "type": "string" 27 | } 28 | ], 29 | "name": "updateString", 30 | "outputs": [], 31 | "stateMutability": "nonpayable", 32 | "type": "function" 33 | } 34 | ], 35 | "devdoc": { 36 | "kind": "dev", 37 | "methods": {}, 38 | "version": 1 39 | }, 40 | "userdoc": { 41 | "kind": "user", 42 | "methods": {}, 43 | "version": 1 44 | } 45 | }, 46 | "settings": { 47 | "compilationTarget": { 48 | "contracts/ExampleContract.sol": "ExampleContract" 49 | }, 50 | "evmVersion": "london", 51 | "libraries": {}, 52 | "metadata": { 53 | "bytecodeHash": "ipfs" 54 | }, 55 | "optimizer": { 56 | "enabled": false, 57 | "runs": 200 58 | }, 59 | "remappings": [] 60 | }, 61 | "sources": { 62 | "contracts/ExampleContract.sol": { 63 | "keccak256": "0x4dce19c8106b068266ab73390cb718d67eefd696313cb1df965a44edb9c4a766", 64 | "license": "MIT", 65 | "urls": [ 66 | "bzz-raw://3e4a2c78eb2edbee1e42cdb2f01bba048e412128e048a0321b3fb2242d89be6f", 67 | "dweb:/ipfs/QmYTfnmyqXMYcTzMuwgq7zTza1c5HEAhsu5453hdVM7Eu9" 68 | ] 69 | } 70 | }, 71 | "version": 1 72 | } -------------------------------------------------------------------------------- /contracts/ExampleMappingStruct.sol: -------------------------------------------------------------------------------- 1 | // //SPDX-License-Identifier: MIT 2 | 3 | // pragma solidity ^0.8.14; 4 | 5 | // contract MappingsStructExample { 6 | 7 | // struct Transaction { 8 | // uint amount; 9 | // uint timestamp; 10 | // } 11 | 12 | // struct Balance { 13 | // uint totalBalance; 14 | // uint numDeposits; 15 | // mapping(uint => Transaction) deposits; 16 | // uint numWithdrawals; 17 | // mapping(uint => Transaction) withdrawals; 18 | // } 19 | 20 | // mapping(address => Balance) public balanceReceived; 21 | 22 | 23 | // function getBalance(address _addr) public view returns(uint) { 24 | // return balanceReceived[_addr].totalBalance; 25 | // } 26 | 27 | // function depositMoney() public payable { 28 | // balanceReceived[msg.sender].totalBalance += msg.value; 29 | 30 | // Transaction memory deposit = Transaction(msg.value, block.timestamp); 31 | // balanceReceived[msg.sender].deposits[balanceReceived[msg.sender].numDeposits] = deposit; 32 | // balanceReceived[msg.sender].numDeposits++; 33 | // } 34 | 35 | // function withdrawMoney(address payable _to, uint _amount) public { 36 | // balanceReceived[msg.sender].totalBalance -= _amount; //reduce the balance by the amount ot withdraw 37 | 38 | // //record a new withdrawal 39 | // Transaction memory withdrawal = Transaction(msg.value, block.timestamp); 40 | // balanceReceived[msg.sender].withdrawals[balanceReceived[msg.sender].numWithdrawals] = withdrawals; 41 | // balanceReceived[msg.sender].numWithdrawals++; 42 | 43 | // //send the amount out. 44 | // _to.transfer(_amount); 45 | // } 46 | // } 47 | -------------------------------------------------------------------------------- /contracts/2_Owner.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | import "hardhat/console.sol"; 6 | 7 | /** 8 | * @title Owner 9 | * @dev Set & change owner 10 | */ 11 | contract Owner { 12 | 13 | address private owner; 14 | 15 | // event for EVM logging 16 | event OwnerSet(address indexed oldOwner, address indexed newOwner); 17 | 18 | // modifier to check if caller is owner 19 | modifier isOwner() { 20 | // If the first argument of 'require' evaluates to 'false', execution terminates and all 21 | // changes to the state and to Ether balances are reverted. 22 | // This used to consume all gas in old EVM versions, but not anymore. 23 | // It is often a good idea to use 'require' to check if functions are called correctly. 24 | // As a second argument, you can also provide an explanation about what went wrong. 25 | require(msg.sender == owner, "Caller is not owner"); 26 | _; 27 | } 28 | 29 | /** 30 | * @dev Set contract deployer as owner 31 | */ 32 | constructor() { 33 | console.log("Owner contract deployed by:", msg.sender); 34 | owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor 35 | emit OwnerSet(address(0), owner); 36 | } 37 | 38 | /** 39 | * @dev Change owner 40 | * @param newOwner address of new owner 41 | */ 42 | function changeOwner(address newOwner) public isOwner { 43 | emit OwnerSet(owner, newOwner); 44 | owner = newOwner; 45 | } 46 | 47 | /** 48 | * @dev Return owner address 49 | * @return address of owner 50 | */ 51 | function getOwner() external view returns (address) { 52 | return owner; 53 | } 54 | } -------------------------------------------------------------------------------- /contracts/artifacts/ExampleMappingWithdraws_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.14+commit.80d49f37" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "getBalance", 11 | "outputs": [ 12 | { 13 | "internalType": "uint256", 14 | "name": "", 15 | "type": "uint256" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [], 23 | "name": "sendMoney", 24 | "outputs": [], 25 | "stateMutability": "payable", 26 | "type": "function" 27 | }, 28 | { 29 | "inputs": [ 30 | { 31 | "internalType": "address payable", 32 | "name": "_to", 33 | "type": "address" 34 | } 35 | ], 36 | "name": "withdrawAllMoney", 37 | "outputs": [], 38 | "stateMutability": "nonpayable", 39 | "type": "function" 40 | } 41 | ], 42 | "devdoc": { 43 | "kind": "dev", 44 | "methods": {}, 45 | "version": 1 46 | }, 47 | "userdoc": { 48 | "kind": "user", 49 | "methods": {}, 50 | "version": 1 51 | } 52 | }, 53 | "settings": { 54 | "compilationTarget": { 55 | "contracts/ExampleMappingWithdraw.sol": "ExampleMappingWithdraws" 56 | }, 57 | "evmVersion": "london", 58 | "libraries": {}, 59 | "metadata": { 60 | "bytecodeHash": "ipfs" 61 | }, 62 | "optimizer": { 63 | "enabled": false, 64 | "runs": 200 65 | }, 66 | "remappings": [] 67 | }, 68 | "sources": { 69 | "contracts/ExampleMappingWithdraw.sol": { 70 | "keccak256": "0xe9c6e90c2a5759a7e40efc7432ba39927c249b1b9a5281371ef10a6017fb5136", 71 | "license": "MIT", 72 | "urls": [ 73 | "bzz-raw://c2e28d722fc64d12a896bbc9051a0aa0cd705661de69969bf75e41b53c1d7d8b", 74 | "dweb:/ipfs/QmSG9dDDNuBkjr6Ycs1f9vLo3t69b9Jo3Sez7ohdbsdZJY" 75 | ] 76 | } 77 | }, 78 | "version": 1 79 | } -------------------------------------------------------------------------------- /contracts/artifacts/SmartWallet_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.16+commit.07a7930e" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "stateMutability": "nonpayable", 11 | "type": "constructor" 12 | }, 13 | { 14 | "inputs": [ 15 | { 16 | "internalType": "address payable", 17 | "name": "_to", 18 | "type": "address" 19 | }, 20 | { 21 | "internalType": "uint256", 22 | "name": "_amount", 23 | "type": "uint256" 24 | }, 25 | { 26 | "internalType": "bytes", 27 | "name": "_payload", 28 | "type": "bytes" 29 | } 30 | ], 31 | "name": "transfer", 32 | "outputs": [ 33 | { 34 | "internalType": "bytes", 35 | "name": "", 36 | "type": "bytes" 37 | } 38 | ], 39 | "stateMutability": "nonpayable", 40 | "type": "function" 41 | }, 42 | { 43 | "stateMutability": "payable", 44 | "type": "receive" 45 | } 46 | ], 47 | "devdoc": { 48 | "kind": "dev", 49 | "methods": {}, 50 | "version": 1 51 | }, 52 | "userdoc": { 53 | "kind": "user", 54 | "methods": {}, 55 | "version": 1 56 | } 57 | }, 58 | "settings": { 59 | "compilationTarget": { 60 | "contracts/SmartWalletProject.sol": "SmartWallet" 61 | }, 62 | "evmVersion": "london", 63 | "libraries": {}, 64 | "metadata": { 65 | "bytecodeHash": "ipfs" 66 | }, 67 | "optimizer": { 68 | "enabled": false, 69 | "runs": 200 70 | }, 71 | "remappings": [] 72 | }, 73 | "sources": { 74 | "contracts/SmartWalletProject.sol": { 75 | "keccak256": "0xce109418361ba8db06c42ff57be7d159c64599f386a07561bdc90cd1fae44bc8", 76 | "license": "MIT", 77 | "urls": [ 78 | "bzz-raw://735bd01b9837dd2ea23c1b3fdd1104a6196cbed500cec3a782115069490c9c6d", 79 | "dweb:/ipfs/QmPoy6LvRrXYqyMejnd6F2kygQGriy1CkLVPRW69zUFX2d" 80 | ] 81 | } 82 | }, 83 | "version": 1 84 | } -------------------------------------------------------------------------------- /contracts/artifacts/ExampleAddress_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.14+commit.80d49f37" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "getAddressBalance", 11 | "outputs": [ 12 | { 13 | "internalType": "uint256", 14 | "name": "", 15 | "type": "uint256" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [ 23 | { 24 | "internalType": "address", 25 | "name": "_someAddress", 26 | "type": "address" 27 | } 28 | ], 29 | "name": "setSomeAddress", 30 | "outputs": [], 31 | "stateMutability": "nonpayable", 32 | "type": "function" 33 | }, 34 | { 35 | "inputs": [], 36 | "name": "someAddress", 37 | "outputs": [ 38 | { 39 | "internalType": "address", 40 | "name": "", 41 | "type": "address" 42 | } 43 | ], 44 | "stateMutability": "view", 45 | "type": "function" 46 | } 47 | ], 48 | "devdoc": { 49 | "kind": "dev", 50 | "methods": {}, 51 | "version": 1 52 | }, 53 | "userdoc": { 54 | "kind": "user", 55 | "methods": {}, 56 | "version": 1 57 | } 58 | }, 59 | "settings": { 60 | "compilationTarget": { 61 | "contracts/ExampleAddress.sol": "ExampleAddress" 62 | }, 63 | "evmVersion": "london", 64 | "libraries": {}, 65 | "metadata": { 66 | "bytecodeHash": "ipfs" 67 | }, 68 | "optimizer": { 69 | "enabled": false, 70 | "runs": 200 71 | }, 72 | "remappings": [] 73 | }, 74 | "sources": { 75 | "contracts/ExampleAddress.sol": { 76 | "keccak256": "0x738accb775015c2a94d6a2c22fc9a72d8d8363d8a741411e24ea3ba0f4ea9b06", 77 | "license": "MIT", 78 | "urls": [ 79 | "bzz-raw://dceabf4d68d5b6f1f103315954db9ce14a1a26bbd2709d23968e3ab36467b3a2", 80 | "dweb:/ipfs/QmNrhFcE8WnEPf5XF4WkozUuBvafWPzW4VffvaeL4EFWFL" 81 | ] 82 | } 83 | }, 84 | "version": 1 85 | } -------------------------------------------------------------------------------- /contracts/artifacts/SendMoney_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.19+commit.7dd6d404" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "getContractBalance", 11 | "outputs": [ 12 | { 13 | "internalType": "uint256", 14 | "name": "", 15 | "type": "uint256" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [], 23 | "name": "sendMoneyToContract", 24 | "outputs": [], 25 | "stateMutability": "payable", 26 | "type": "function" 27 | }, 28 | { 29 | "inputs": [ 30 | { 31 | "internalType": "address payable", 32 | "name": "_to", 33 | "type": "address" 34 | }, 35 | { 36 | "internalType": "uint256", 37 | "name": "_amount", 38 | "type": "uint256" 39 | } 40 | ], 41 | "name": "transferMoneyFromContract", 42 | "outputs": [], 43 | "stateMutability": "nonpayable", 44 | "type": "function" 45 | } 46 | ], 47 | "devdoc": { 48 | "kind": "dev", 49 | "methods": {}, 50 | "version": 1 51 | }, 52 | "userdoc": { 53 | "kind": "user", 54 | "methods": {}, 55 | "version": 1 56 | } 57 | }, 58 | "settings": { 59 | "compilationTarget": { 60 | "contracts/1_SendMoney.sol": "SendMoney" 61 | }, 62 | "evmVersion": "paris", 63 | "libraries": {}, 64 | "metadata": { 65 | "bytecodeHash": "ipfs" 66 | }, 67 | "optimizer": { 68 | "enabled": false, 69 | "runs": 200 70 | }, 71 | "remappings": [] 72 | }, 73 | "sources": { 74 | "contracts/1_SendMoney.sol": { 75 | "keccak256": "0xd8e89cfa4a9f0f21b710229fee1af9861b2ae4ca12974475173b94cd097bd2a7", 76 | "license": "MIT", 77 | "urls": [ 78 | "bzz-raw://abf59b871598c18fb1df329f62ac22c97b2067ef5491507c2028b104bf764227", 79 | "dweb:/ipfs/QmXavj2aFHQS3xC9CFs3NbkGBCr78JLoJcryxemfbe83Vz" 80 | ] 81 | } 82 | }, 83 | "version": 1 84 | } -------------------------------------------------------------------------------- /contracts/artifacts/ExceptionExample_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.6.12+commit.27d51765" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [ 10 | { 11 | "internalType": "address", 12 | "name": "", 13 | "type": "address" 14 | } 15 | ], 16 | "name": "balanceReceived", 17 | "outputs": [ 18 | { 19 | "internalType": "uint256", 20 | "name": "", 21 | "type": "uint256" 22 | } 23 | ], 24 | "stateMutability": "view", 25 | "type": "function" 26 | }, 27 | { 28 | "inputs": [], 29 | "name": "receiveMoney", 30 | "outputs": [], 31 | "stateMutability": "payable", 32 | "type": "function" 33 | }, 34 | { 35 | "inputs": [ 36 | { 37 | "internalType": "address payable", 38 | "name": "_to", 39 | "type": "address" 40 | }, 41 | { 42 | "internalType": "uint256", 43 | "name": "_amount", 44 | "type": "uint256" 45 | } 46 | ], 47 | "name": "withdrawMoney", 48 | "outputs": [], 49 | "stateMutability": "nonpayable", 50 | "type": "function" 51 | } 52 | ], 53 | "devdoc": { 54 | "kind": "dev", 55 | "methods": {}, 56 | "version": 1 57 | }, 58 | "userdoc": { 59 | "kind": "user", 60 | "methods": {}, 61 | "version": 1 62 | } 63 | }, 64 | "settings": { 65 | "compilationTarget": { 66 | "contracts/ExampleExceptionRequire.sol": "ExceptionExample" 67 | }, 68 | "evmVersion": "istanbul", 69 | "libraries": {}, 70 | "metadata": { 71 | "bytecodeHash": "ipfs" 72 | }, 73 | "optimizer": { 74 | "enabled": false, 75 | "runs": 200 76 | }, 77 | "remappings": [] 78 | }, 79 | "sources": { 80 | "contracts/ExampleExceptionRequire.sol": { 81 | "keccak256": "0x37afc23fec7fcd2703d536838acb05aefd0c3065aacbcbf4feb902ad15928061", 82 | "license": "MIT", 83 | "urls": [ 84 | "bzz-raw://f7312420f029395d41948ecfc38858916a297342d33d69bde3ad01a57e1bc111", 85 | "dweb:/ipfs/QmeZGETJctQ5QmP3XxuNDLqy6WMBMLDR5DmwoA1xRZSY56" 86 | ] 87 | } 88 | }, 89 | "version": 1 90 | } -------------------------------------------------------------------------------- /contracts/artifacts/ExampleConstructor_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.14+commit.80d49f37" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [ 10 | { 11 | "internalType": "address", 12 | "name": "_someAddress", 13 | "type": "address" 14 | } 15 | ], 16 | "stateMutability": "nonpayable", 17 | "type": "constructor" 18 | }, 19 | { 20 | "inputs": [], 21 | "name": "myAddress", 22 | "outputs": [ 23 | { 24 | "internalType": "address", 25 | "name": "", 26 | "type": "address" 27 | } 28 | ], 29 | "stateMutability": "view", 30 | "type": "function" 31 | }, 32 | { 33 | "inputs": [ 34 | { 35 | "internalType": "address", 36 | "name": "_myAddress", 37 | "type": "address" 38 | } 39 | ], 40 | "name": "setMyAddress", 41 | "outputs": [], 42 | "stateMutability": "nonpayable", 43 | "type": "function" 44 | }, 45 | { 46 | "inputs": [], 47 | "name": "setMyAddressToMsgSender", 48 | "outputs": [], 49 | "stateMutability": "nonpayable", 50 | "type": "function" 51 | } 52 | ], 53 | "devdoc": { 54 | "kind": "dev", 55 | "methods": {}, 56 | "version": 1 57 | }, 58 | "userdoc": { 59 | "kind": "user", 60 | "methods": {}, 61 | "version": 1 62 | } 63 | }, 64 | "settings": { 65 | "compilationTarget": { 66 | "contracts/ExampleConstructor.sol": "ExampleConstructor" 67 | }, 68 | "evmVersion": "london", 69 | "libraries": {}, 70 | "metadata": { 71 | "bytecodeHash": "ipfs" 72 | }, 73 | "optimizer": { 74 | "enabled": false, 75 | "runs": 200 76 | }, 77 | "remappings": [] 78 | }, 79 | "sources": { 80 | "contracts/ExampleConstructor.sol": { 81 | "keccak256": "0x52c9f91585eeb96d3d572d73a4a7218387399a326099a653ad88506ee0010541", 82 | "license": "MIT", 83 | "urls": [ 84 | "bzz-raw://a083cce3db95d8d43f77b58affde44196bcda1f4110240e2d7b0b334568cf449", 85 | "dweb:/ipfs/QmfL9bbEaRyLSxxFdfxoTeWb9yDvoxvVMcC8puc6LQhLq5" 86 | ] 87 | } 88 | }, 89 | "version": 1 90 | } -------------------------------------------------------------------------------- /contracts/artifacts/ExceptionRequireExample_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.6.12+commit.27d51765" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [ 10 | { 11 | "internalType": "address", 12 | "name": "", 13 | "type": "address" 14 | } 15 | ], 16 | "name": "balanceReceived", 17 | "outputs": [ 18 | { 19 | "internalType": "uint256", 20 | "name": "", 21 | "type": "uint256" 22 | } 23 | ], 24 | "stateMutability": "view", 25 | "type": "function" 26 | }, 27 | { 28 | "inputs": [], 29 | "name": "receiveMoney", 30 | "outputs": [], 31 | "stateMutability": "payable", 32 | "type": "function" 33 | }, 34 | { 35 | "inputs": [ 36 | { 37 | "internalType": "address payable", 38 | "name": "_to", 39 | "type": "address" 40 | }, 41 | { 42 | "internalType": "uint256", 43 | "name": "_amount", 44 | "type": "uint256" 45 | } 46 | ], 47 | "name": "withdrawMoney", 48 | "outputs": [], 49 | "stateMutability": "nonpayable", 50 | "type": "function" 51 | } 52 | ], 53 | "devdoc": { 54 | "kind": "dev", 55 | "methods": {}, 56 | "version": 1 57 | }, 58 | "userdoc": { 59 | "kind": "user", 60 | "methods": {}, 61 | "version": 1 62 | } 63 | }, 64 | "settings": { 65 | "compilationTarget": { 66 | "contracts/ExampleExceptionRequire.sol": "ExceptionRequireExample" 67 | }, 68 | "evmVersion": "istanbul", 69 | "libraries": {}, 70 | "metadata": { 71 | "bytecodeHash": "ipfs" 72 | }, 73 | "optimizer": { 74 | "enabled": false, 75 | "runs": 200 76 | }, 77 | "remappings": [] 78 | }, 79 | "sources": { 80 | "contracts/ExampleExceptionRequire.sol": { 81 | "keccak256": "0x96a951aa39a5aa0bdba12984b5eaab2ac381b96f7364ce279290fed750a35dd3", 82 | "license": "MIT", 83 | "urls": [ 84 | "bzz-raw://9c7553b102b21ff657a300c3a3ce3b7a7619fd85bc4d38c08a5c053bfda6f411", 85 | "dweb:/ipfs/QmPasig3Bt1FYzWXfn9axM5Z2KBUU6kGWbdyaCMS15g3c3" 86 | ] 87 | } 88 | }, 89 | "version": 1 90 | } -------------------------------------------------------------------------------- /contracts/artifacts/SmartMoney_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.14+commit.80d49f37" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "balanceReceived", 11 | "outputs": [ 12 | { 13 | "internalType": "uint256", 14 | "name": "", 15 | "type": "uint256" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [], 23 | "name": "deposit", 24 | "outputs": [], 25 | "stateMutability": "payable", 26 | "type": "function" 27 | }, 28 | { 29 | "inputs": [], 30 | "name": "getContractBalance", 31 | "outputs": [ 32 | { 33 | "internalType": "uint256", 34 | "name": "", 35 | "type": "uint256" 36 | } 37 | ], 38 | "stateMutability": "view", 39 | "type": "function" 40 | }, 41 | { 42 | "inputs": [], 43 | "name": "withdrawALL", 44 | "outputs": [], 45 | "stateMutability": "nonpayable", 46 | "type": "function" 47 | }, 48 | { 49 | "inputs": [ 50 | { 51 | "internalType": "address payable", 52 | "name": "to", 53 | "type": "address" 54 | } 55 | ], 56 | "name": "withdrawToAddress", 57 | "outputs": [], 58 | "stateMutability": "nonpayable", 59 | "type": "function" 60 | } 61 | ], 62 | "devdoc": { 63 | "kind": "dev", 64 | "methods": {}, 65 | "version": 1 66 | }, 67 | "userdoc": { 68 | "kind": "user", 69 | "methods": {}, 70 | "version": 1 71 | } 72 | }, 73 | "settings": { 74 | "compilationTarget": { 75 | "contracts/SmartMoney.sol": "SmartMoney" 76 | }, 77 | "evmVersion": "london", 78 | "libraries": {}, 79 | "metadata": { 80 | "bytecodeHash": "ipfs" 81 | }, 82 | "optimizer": { 83 | "enabled": false, 84 | "runs": 200 85 | }, 86 | "remappings": [] 87 | }, 88 | "sources": { 89 | "contracts/SmartMoney.sol": { 90 | "keccak256": "0x70e963c3aa1c5744001a35ca6334172da9498df6af6f2c82ab193a39c9244908", 91 | "license": "MIT", 92 | "urls": [ 93 | "bzz-raw://6d9dac21d5b1c2b16a7aa120643532509cc71137b19721ef680f92274851db5c", 94 | "dweb:/ipfs/QmYDWegMmeNh5JbAtjqDNWgikFNJSpSQSfv1Xgp5cF8HJS" 95 | ] 96 | } 97 | }, 98 | "version": 1 99 | } -------------------------------------------------------------------------------- /contracts/SmartWalletProject.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.8.15; 4 | 5 | contract SampleWallet { 6 | 7 | address payable owner; 8 | 9 | mapping(address => uint) public allowance; 10 | mapping(address => bool) public isAllowedToSend; 11 | 12 | mapping(address => bool) public guardian; 13 | address payable nextOwner; 14 | uint guardiansResetCount; 15 | uint public constant confirmationsFromGuardiansForReset = 3; 16 | 17 | constructor() { 18 | owner = payable(msg.sender); 19 | } 20 | 21 | function proposeNewOwner(address payable newOwner) public { 22 | require(guardian[msg.sender], "You are no guardian, aborting"); 23 | if(nextOwner != newOwner) { 24 | nextOwner = newOwner; 25 | guardiansResetCount = 0; 26 | } 27 | 28 | guardiansResetCount++; 29 | 30 | if(guardiansResetCount >= confirmationsFromGuardiansForReset) { 31 | owner = nextOwner; 32 | nextOwner = payable(address(0)); 33 | } 34 | } 35 | 36 | function setAllowance(address _from, uint _amount) public { 37 | require(msg.sender == owner, "You are not the owner, aborting!"); 38 | allowance[_from] = _amount; 39 | isAllowedToSend[_from] = true; 40 | } 41 | 42 | function denySending(address _from) public { 43 | require(msg.sender == owner, "You are not the owner, aborting!"); 44 | isAllowedToSend[_from] = false; 45 | } 46 | 47 | function transfer(address payable _to, uint _amount, bytes memory payload) public returns (bytes memory) { 48 | require(_amount <= address(this).balance, "Can't send more than the contract owns, aborting."); 49 | if(msg.sender != owner) { 50 | require(isAllowedToSend[msg.sender], "You are not allowed to send any transactions, aborting"); 51 | require(allowance[msg.sender] >= _amount, "You are trying to send more than you are allowed to, aborting"); 52 | allowance[msg.sender] -= _amount; 53 | 54 | } 55 | 56 | (bool success, bytes memory returnData) = _to.call{value: _amount}(payload); 57 | require(success, "Transaction failed, aborting"); 58 | return returnData; 59 | } 60 | 61 | receive() external payable {} 62 | } 63 | -------------------------------------------------------------------------------- /contracts/artifacts/ExampleMsgSender_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.14+commit.80d49f37" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "myAddress", 11 | "outputs": [ 12 | { 13 | "internalType": "address", 14 | "name": "", 15 | "type": "address" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [], 23 | "name": "setMyAddress", 24 | "outputs": [], 25 | "stateMutability": "nonpayable", 26 | "type": "function" 27 | } 28 | ], 29 | "devdoc": { 30 | "kind": "dev", 31 | "methods": {}, 32 | "version": 1 33 | }, 34 | "userdoc": { 35 | "kind": "user", 36 | "methods": {}, 37 | "version": 1 38 | } 39 | }, 40 | "settings": { 41 | "compilationTarget": { 42 | "contracts/ExampleMsgSender.sol": "ExampleMsgSender" 43 | }, 44 | "evmVersion": "london", 45 | "libraries": {}, 46 | "metadata": { 47 | "bytecodeHash": "ipfs" 48 | }, 49 | "optimizer": { 50 | "enabled": false, 51 | "runs": 200 52 | }, 53 | "remappings": [] 54 | }, 55 | "sources": { 56 | "contracts/ExampleMsgSender.sol": { 57 | "keccak256": "0x5549020cb0eb24738ae21cb8e1a18655773516edda67c154872400bfab8f7213", 58 | "license": "MIT", 59 | "urls": [ 60 | "bzz-raw://65120d68a62add39ca2379a1558f9227b59972fd3630360924bf5773b985bb11", 61 | "dweb:/ipfs/QmSukkVc5eNzqpebw6XN1HfHo8FhL7J3Ad7Jb18GznAPAy" 62 | ] 63 | }, 64 | "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol": { 65 | "keccak256": "0x923b9774b81c1abfb992262ae7763b6e6de77b077a7180d53c6ebb7b1c8bd648", 66 | "license": "MIT", 67 | "urls": [ 68 | "bzz-raw://53445dc0431f9b45c06f567c6091da961d4087bec0010cca5bd62100fa624a38", 69 | "dweb:/ipfs/QmNvBYpBv183czrAqNXr76E8M3LF93ouAJFeAcHfb59Rcx" 70 | ] 71 | }, 72 | "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol": { 73 | "keccak256": "0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7", 74 | "license": "MIT", 75 | "urls": [ 76 | "bzz-raw://6df0ddf21ce9f58271bdfaa85cde98b200ef242a05a3f85c2bc10a8294800a92", 77 | "dweb:/ipfs/QmRK2Y5Yc6BK7tGKkgsgn3aJEQGi5aakeSPZvS65PV8Xp3" 78 | ] 79 | } 80 | }, 81 | "version": 1 82 | } -------------------------------------------------------------------------------- /contracts/artifacts/SimpleMappingExample_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.14+commit.80d49f37" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [ 10 | { 11 | "internalType": "address", 12 | "name": "", 13 | "type": "address" 14 | } 15 | ], 16 | "name": "myAddressMapping", 17 | "outputs": [ 18 | { 19 | "internalType": "bool", 20 | "name": "", 21 | "type": "bool" 22 | } 23 | ], 24 | "stateMutability": "view", 25 | "type": "function" 26 | }, 27 | { 28 | "inputs": [ 29 | { 30 | "internalType": "uint256", 31 | "name": "", 32 | "type": "uint256" 33 | } 34 | ], 35 | "name": "myMapping", 36 | "outputs": [ 37 | { 38 | "internalType": "bool", 39 | "name": "", 40 | "type": "bool" 41 | } 42 | ], 43 | "stateMutability": "view", 44 | "type": "function" 45 | }, 46 | { 47 | "inputs": [], 48 | "name": "setMyAddressToTrue", 49 | "outputs": [], 50 | "stateMutability": "nonpayable", 51 | "type": "function" 52 | }, 53 | { 54 | "inputs": [ 55 | { 56 | "internalType": "uint256", 57 | "name": "_index", 58 | "type": "uint256" 59 | } 60 | ], 61 | "name": "setValue", 62 | "outputs": [], 63 | "stateMutability": "nonpayable", 64 | "type": "function" 65 | } 66 | ], 67 | "devdoc": { 68 | "kind": "dev", 69 | "methods": {}, 70 | "version": 1 71 | }, 72 | "userdoc": { 73 | "kind": "user", 74 | "methods": {}, 75 | "version": 1 76 | } 77 | }, 78 | "settings": { 79 | "compilationTarget": { 80 | "contracts/ExampleMapping.sol": "SimpleMappingExample" 81 | }, 82 | "evmVersion": "london", 83 | "libraries": {}, 84 | "metadata": { 85 | "bytecodeHash": "ipfs" 86 | }, 87 | "optimizer": { 88 | "enabled": false, 89 | "runs": 200 90 | }, 91 | "remappings": [] 92 | }, 93 | "sources": { 94 | "contracts/ExampleMapping.sol": { 95 | "keccak256": "0x9471b81fc7349d3ced445081f7903d041c229b7f52a2815ddf9ddc635caa0f51", 96 | "license": "MIT", 97 | "urls": [ 98 | "bzz-raw://65abf8066ea43c0f7b58612d91c713ecc17a1c7e86ff458f254cf6d3b1a6459c", 99 | "dweb:/ipfs/QmQnWbBYsFsNgz95Amk4joCkZGxdATo6bZ8wFbonYVKNfu" 100 | ] 101 | } 102 | }, 103 | "version": 1 104 | } -------------------------------------------------------------------------------- /contracts/artifacts/TheBlockchainMessenger_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.14+commit.80d49f37" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "stateMutability": "nonpayable", 11 | "type": "constructor" 12 | }, 13 | { 14 | "inputs": [], 15 | "name": "changeCounter", 16 | "outputs": [ 17 | { 18 | "internalType": "uint256", 19 | "name": "", 20 | "type": "uint256" 21 | } 22 | ], 23 | "stateMutability": "view", 24 | "type": "function" 25 | }, 26 | { 27 | "inputs": [], 28 | "name": "owner", 29 | "outputs": [ 30 | { 31 | "internalType": "address", 32 | "name": "", 33 | "type": "address" 34 | } 35 | ], 36 | "stateMutability": "view", 37 | "type": "function" 38 | }, 39 | { 40 | "inputs": [], 41 | "name": "theMessage", 42 | "outputs": [ 43 | { 44 | "internalType": "string", 45 | "name": "", 46 | "type": "string" 47 | } 48 | ], 49 | "stateMutability": "view", 50 | "type": "function" 51 | }, 52 | { 53 | "inputs": [ 54 | { 55 | "internalType": "string", 56 | "name": "_newMessage", 57 | "type": "string" 58 | } 59 | ], 60 | "name": "updateTheMessage", 61 | "outputs": [], 62 | "stateMutability": "nonpayable", 63 | "type": "function" 64 | } 65 | ], 66 | "devdoc": { 67 | "kind": "dev", 68 | "methods": {}, 69 | "version": 1 70 | }, 71 | "userdoc": { 72 | "kind": "user", 73 | "methods": {}, 74 | "version": 1 75 | } 76 | }, 77 | "settings": { 78 | "compilationTarget": { 79 | "contracts/TheBlockChianMessenger.sol": "TheBlockchainMessenger" 80 | }, 81 | "evmVersion": "london", 82 | "libraries": {}, 83 | "metadata": { 84 | "bytecodeHash": "ipfs" 85 | }, 86 | "optimizer": { 87 | "enabled": false, 88 | "runs": 200 89 | }, 90 | "remappings": [] 91 | }, 92 | "sources": { 93 | "contracts/TheBlockChianMessenger.sol": { 94 | "keccak256": "0xfa4c1cdb36685e525cf6debee2f479716977a7b988b43faf7d4efdc615fa1dbf", 95 | "license": "MIT", 96 | "urls": [ 97 | "bzz-raw://367bd7ba6e7f60f1c08ee68a5623081e20a610fd558278c2dc8568d327a14215", 98 | "dweb:/ipfs/QmeRPfrZbYxkXuQ1NApBg5GTbULfq12isuvm84EipesxGz" 99 | ] 100 | } 101 | }, 102 | "version": 1 103 | } -------------------------------------------------------------------------------- /contracts/artifacts/ExampleViewPure_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.14+commit.80d49f37" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "getMyStoreageVariable", 11 | "outputs": [ 12 | { 13 | "internalType": "uint256", 14 | "name": "", 15 | "type": "uint256" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [], 23 | "name": "myStoreageVariable", 24 | "outputs": [ 25 | { 26 | "internalType": "uint256", 27 | "name": "", 28 | "type": "uint256" 29 | } 30 | ], 31 | "stateMutability": "view", 32 | "type": "function" 33 | }, 34 | { 35 | "inputs": [ 36 | { 37 | "internalType": "uint256", 38 | "name": "_newVariable", 39 | "type": "uint256" 40 | } 41 | ], 42 | "name": "setMyStoreVariable", 43 | "outputs": [], 44 | "stateMutability": "nonpayable", 45 | "type": "function" 46 | }, 47 | { 48 | "inputs": [ 49 | { 50 | "internalType": "uint256", 51 | "name": "a", 52 | "type": "uint256" 53 | }, 54 | { 55 | "internalType": "uint256", 56 | "name": "b", 57 | "type": "uint256" 58 | } 59 | ], 60 | "name": "viewFunction", 61 | "outputs": [ 62 | { 63 | "internalType": "uint256", 64 | "name": "", 65 | "type": "uint256" 66 | } 67 | ], 68 | "stateMutability": "pure", 69 | "type": "function" 70 | } 71 | ], 72 | "devdoc": { 73 | "kind": "dev", 74 | "methods": {}, 75 | "version": 1 76 | }, 77 | "userdoc": { 78 | "kind": "user", 79 | "methods": {}, 80 | "version": 1 81 | } 82 | }, 83 | "settings": { 84 | "compilationTarget": { 85 | "contracts/ExampleViewPure.sol": "ExampleViewPure" 86 | }, 87 | "evmVersion": "london", 88 | "libraries": {}, 89 | "metadata": { 90 | "bytecodeHash": "ipfs" 91 | }, 92 | "optimizer": { 93 | "enabled": false, 94 | "runs": 200 95 | }, 96 | "remappings": [] 97 | }, 98 | "sources": { 99 | "contracts/ExampleViewPure.sol": { 100 | "keccak256": "0xe1bb92c7e2bd664b77989380676c5b005fc1541e0a7dd958f6c293dcade6ec9b", 101 | "license": "MIT", 102 | "urls": [ 103 | "bzz-raw://8f8c2f3abfe58bdf4529565dd320027d7ad54ccd03f830f442d14b46e22e415d", 104 | "dweb:/ipfs/QmXx4q1TVAyucBtXRJ1Xus5NNMWKHqB5jHakKnydnx9bdU" 105 | ] 106 | } 107 | }, 108 | "version": 1 109 | } -------------------------------------------------------------------------------- /contracts/artifacts/ExampleUnit_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.14+commit.80d49f37" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "increamentInt", 11 | "outputs": [], 12 | "stateMutability": "nonpayable", 13 | "type": "function" 14 | }, 15 | { 16 | "inputs": [], 17 | "name": "increamentMyUint", 18 | "outputs": [], 19 | "stateMutability": "nonpayable", 20 | "type": "function" 21 | }, 22 | { 23 | "inputs": [], 24 | "name": "myInt", 25 | "outputs": [ 26 | { 27 | "internalType": "int256", 28 | "name": "", 29 | "type": "int256" 30 | } 31 | ], 32 | "stateMutability": "view", 33 | "type": "function" 34 | }, 35 | { 36 | "inputs": [], 37 | "name": "myUint", 38 | "outputs": [ 39 | { 40 | "internalType": "uint256", 41 | "name": "", 42 | "type": "uint256" 43 | } 44 | ], 45 | "stateMutability": "view", 46 | "type": "function" 47 | }, 48 | { 49 | "inputs": [ 50 | { 51 | "internalType": "uint256", 52 | "name": "_myUint", 53 | "type": "uint256" 54 | } 55 | ], 56 | "name": "setUnit", 57 | "outputs": [], 58 | "stateMutability": "nonpayable", 59 | "type": "function" 60 | }, 61 | { 62 | "inputs": [], 63 | "name": "unit8", 64 | "outputs": [ 65 | { 66 | "internalType": "uint8", 67 | "name": "", 68 | "type": "uint8" 69 | } 70 | ], 71 | "stateMutability": "view", 72 | "type": "function" 73 | } 74 | ], 75 | "devdoc": { 76 | "kind": "dev", 77 | "methods": {}, 78 | "version": 1 79 | }, 80 | "userdoc": { 81 | "kind": "user", 82 | "methods": {}, 83 | "version": 1 84 | } 85 | }, 86 | "settings": { 87 | "compilationTarget": { 88 | "contracts/ExampleUnit.sol": "ExampleUnit" 89 | }, 90 | "evmVersion": "london", 91 | "libraries": {}, 92 | "metadata": { 93 | "bytecodeHash": "ipfs" 94 | }, 95 | "optimizer": { 96 | "enabled": false, 97 | "runs": 200 98 | }, 99 | "remappings": [] 100 | }, 101 | "sources": { 102 | "contracts/ExampleUnit.sol": { 103 | "keccak256": "0xb2e1f60f6dc8c690c5459b3ec68bc4aee6eeb102c573c1eb37914a5884c5d4e1", 104 | "license": "MIT", 105 | "urls": [ 106 | "bzz-raw://ea46c595969347995602a505fc3e54e30ce6c4b64b6b7cd9f28fd620c125a9b2", 107 | "dweb:/ipfs/QmZa14MUdAZmpsHskjgNfYr6Sa1L2gMCRmXzT6byMamRYr" 108 | ] 109 | } 110 | }, 111 | "version": 1 112 | } -------------------------------------------------------------------------------- /contracts/artifacts/InheritanceModifierExample_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.19+commit.7dd6d404" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "stateMutability": "nonpayable", 11 | "type": "constructor" 12 | }, 13 | { 14 | "inputs": [], 15 | "name": "burnToken", 16 | "outputs": [], 17 | "stateMutability": "nonpayable", 18 | "type": "function" 19 | }, 20 | { 21 | "inputs": [], 22 | "name": "createNewToken", 23 | "outputs": [], 24 | "stateMutability": "nonpayable", 25 | "type": "function" 26 | }, 27 | { 28 | "inputs": [], 29 | "name": "purchaseToken", 30 | "outputs": [], 31 | "stateMutability": "payable", 32 | "type": "function" 33 | }, 34 | { 35 | "inputs": [ 36 | { 37 | "internalType": "address", 38 | "name": "_to", 39 | "type": "address" 40 | }, 41 | { 42 | "internalType": "uint256", 43 | "name": "_amount", 44 | "type": "uint256" 45 | } 46 | ], 47 | "name": "sendToken", 48 | "outputs": [], 49 | "stateMutability": "nonpayable", 50 | "type": "function" 51 | }, 52 | { 53 | "inputs": [ 54 | { 55 | "internalType": "address", 56 | "name": "", 57 | "type": "address" 58 | } 59 | ], 60 | "name": "tokenBalance", 61 | "outputs": [ 62 | { 63 | "internalType": "uint256", 64 | "name": "", 65 | "type": "uint256" 66 | } 67 | ], 68 | "stateMutability": "view", 69 | "type": "function" 70 | } 71 | ], 72 | "devdoc": { 73 | "kind": "dev", 74 | "methods": {}, 75 | "version": 1 76 | }, 77 | "userdoc": { 78 | "kind": "user", 79 | "methods": {}, 80 | "version": 1 81 | } 82 | }, 83 | "settings": { 84 | "compilationTarget": { 85 | "contracts/InheritanceModifiers.sol": "InheritanceModifierExample" 86 | }, 87 | "evmVersion": "paris", 88 | "libraries": {}, 89 | "metadata": { 90 | "bytecodeHash": "ipfs" 91 | }, 92 | "optimizer": { 93 | "enabled": false, 94 | "runs": 200 95 | }, 96 | "remappings": [] 97 | }, 98 | "sources": { 99 | "contracts/InheritanceModifiers.sol": { 100 | "keccak256": "0x9a0a09562e2e02c6dd516dd3088965bd77db44f5e2538e05078e3324ce943353", 101 | "license": "MIT", 102 | "urls": [ 103 | "bzz-raw://8572bada340c43e6c44ea9c8edd907a8380f9e9bee568949a1ea1df9ac717fb8", 104 | "dweb:/ipfs/QmX9SFBvvpNc5yMjHoY329Hb1mh4yERJhccrwBH6CrLejW" 105 | ] 106 | } 107 | }, 108 | "version": 1 109 | } -------------------------------------------------------------------------------- /tests/artifacts/BallotTest_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.15+commit.e14f2714" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "beforeAll", 11 | "outputs": [], 12 | "stateMutability": "nonpayable", 13 | "type": "function" 14 | }, 15 | { 16 | "inputs": [], 17 | "name": "checkWinninProposalWithReturnValue", 18 | "outputs": [ 19 | { 20 | "internalType": "bool", 21 | "name": "", 22 | "type": "bool" 23 | } 24 | ], 25 | "stateMutability": "view", 26 | "type": "function" 27 | }, 28 | { 29 | "inputs": [], 30 | "name": "checkWinningProposal", 31 | "outputs": [], 32 | "stateMutability": "nonpayable", 33 | "type": "function" 34 | } 35 | ], 36 | "devdoc": { 37 | "kind": "dev", 38 | "methods": {}, 39 | "version": 1 40 | }, 41 | "userdoc": { 42 | "kind": "user", 43 | "methods": {}, 44 | "version": 1 45 | } 46 | }, 47 | "settings": { 48 | "compilationTarget": { 49 | "tests/Ballot_test.sol": "BallotTest" 50 | }, 51 | "evmVersion": "london", 52 | "libraries": {}, 53 | "metadata": { 54 | "bytecodeHash": "ipfs" 55 | }, 56 | "optimizer": { 57 | "enabled": false, 58 | "runs": 200 59 | }, 60 | "remappings": [] 61 | }, 62 | "sources": { 63 | "contracts/3_Ballot.sol": { 64 | "keccak256": "0x83fe6b367c140a5c7678c420da454c8c3866ccae12da149c5da3ce6568d29b6c", 65 | "license": "GPL-3.0", 66 | "urls": [ 67 | "bzz-raw://5902f2f468a1f776b8f2cb9d584371af88e181954298af92402fca01d0dba3e7", 68 | "dweb:/ipfs/QmSUodhSvoorFL5m5CNqve8YvmuBpjCq17NbTf4GUX8ydw" 69 | ] 70 | }, 71 | "hardhat/console.sol": { 72 | "keccak256": "0x60b0215121bf25612a6739fb2f1ec35f31ee82e4a8216c032c8243d904ab3aa9", 73 | "license": "MIT", 74 | "urls": [ 75 | "bzz-raw://6e29880d33dd479bb046ba306993d26ccb779a4b1d94a046cb3567f22948bb4d", 76 | "dweb:/ipfs/QmfTY1qzPt5C63Wc7y6JqfZr5899NRvXYdCpyLzR5FXQic" 77 | ] 78 | }, 79 | "remix_tests.sol": { 80 | "keccak256": "0xe2783cdc204cba8c72494119339f1d90f9022b15d6c718c668b7f097d8e29787", 81 | "license": "GPL-3.0", 82 | "urls": [ 83 | "bzz-raw://bb6a22e64c7f16bcaab63b1c1a1b269d5be8a6d37bdd9dec1718477ab916b18e", 84 | "dweb:/ipfs/QmdkW1tT5iadBvaHMCoskhDGZKnfdg8o1D9CcoQYtdJet7" 85 | ] 86 | }, 87 | "tests/Ballot_test.sol": { 88 | "keccak256": "0xd10d2d511611f8a5f6f04151e8b534c4ac159ec184b89ef0db0f2205f8ab1600", 89 | "license": "GPL-3.0", 90 | "urls": [ 91 | "bzz-raw://aa821f5ac1766e88c159d35afce8ce0e96fef9d34af2916d92828e26ae2c4d35", 92 | "dweb:/ipfs/QmZmhrkUtMSJtbiNEqFXPsm1xWBhkqcjFh5ZWYgNxfcEzQ" 93 | ] 94 | } 95 | }, 96 | "version": 1 97 | } -------------------------------------------------------------------------------- /contracts/artifacts/build-info/21961d2c84f53cc2686625aacc986561.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "21961d2c84f53cc2686625aacc986561", 3 | "_format": "hh-sol-build-info-1", 4 | "solcVersion": "0.8.14", 5 | "solcLongVersion": "0.8.14+commit.80d49f37", 6 | "input": { 7 | "language": "Solidity", 8 | "sources": { 9 | "contracts/SampleFallBack.sol": { 10 | "content": "" 11 | } 12 | }, 13 | "settings": { 14 | "optimizer": { 15 | "enabled": false, 16 | "runs": 200 17 | }, 18 | "outputSelection": { 19 | "*": { 20 | "": [ 21 | "ast" 22 | ], 23 | "*": [ 24 | "abi", 25 | "metadata", 26 | "devdoc", 27 | "userdoc", 28 | "storageLayout", 29 | "evm.legacyAssembly", 30 | "evm.bytecode", 31 | "evm.deployedBytecode", 32 | "evm.methodIdentifiers", 33 | "evm.gasEstimates", 34 | "evm.assembly" 35 | ] 36 | } 37 | } 38 | } 39 | }, 40 | "output": { 41 | "errors": [ 42 | { 43 | "component": "general", 44 | "errorCode": "1878", 45 | "formattedMessage": "Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing \"SPDX-License-Identifier: \" to each source file. Use \"SPDX-License-Identifier: UNLICENSED\" for non-open-source code. Please see https://spdx.org for more information.\n--> contracts/SampleFallBack.sol\n\n", 46 | "message": "SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing \"SPDX-License-Identifier: \" to each source file. Use \"SPDX-License-Identifier: UNLICENSED\" for non-open-source code. Please see https://spdx.org for more information.", 47 | "severity": "warning", 48 | "sourceLocation": { 49 | "end": -1, 50 | "file": "contracts/SampleFallBack.sol", 51 | "start": -1 52 | }, 53 | "type": "Warning" 54 | }, 55 | { 56 | "component": "general", 57 | "errorCode": "3420", 58 | "formattedMessage": "Warning: Source file does not specify required compiler version! Consider adding \"pragma solidity ^0.8.14;\"\n--> contracts/SampleFallBack.sol\n\n", 59 | "message": "Source file does not specify required compiler version! Consider adding \"pragma solidity ^0.8.14;\"", 60 | "severity": "warning", 61 | "sourceLocation": { 62 | "end": -1, 63 | "file": "contracts/SampleFallBack.sol", 64 | "start": -1 65 | }, 66 | "type": "Warning" 67 | } 68 | ], 69 | "sources": { 70 | "contracts/SampleFallBack.sol": { 71 | "ast": { 72 | "absolutePath": "contracts/SampleFallBack.sol", 73 | "exportedSymbols": {}, 74 | "id": 1, 75 | "nodeType": "SourceUnit", 76 | "nodes": [], 77 | "src": "0:0:0" 78 | }, 79 | "id": 0 80 | } 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /contracts/artifacts/EventExample_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.16+commit.07a7930e" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "stateMutability": "nonpayable", 11 | "type": "constructor" 12 | }, 13 | { 14 | "anonymous": false, 15 | "inputs": [ 16 | { 17 | "indexed": false, 18 | "internalType": "address", 19 | "name": "_from", 20 | "type": "address" 21 | }, 22 | { 23 | "indexed": false, 24 | "internalType": "address", 25 | "name": "_to", 26 | "type": "address" 27 | }, 28 | { 29 | "indexed": false, 30 | "internalType": "uint256", 31 | "name": "_amount", 32 | "type": "uint256" 33 | } 34 | ], 35 | "name": "TokensSent", 36 | "type": "event" 37 | }, 38 | { 39 | "inputs": [ 40 | { 41 | "internalType": "address", 42 | "name": "_to", 43 | "type": "address" 44 | }, 45 | { 46 | "internalType": "uint256", 47 | "name": "_amount", 48 | "type": "uint256" 49 | } 50 | ], 51 | "name": "sendToken", 52 | "outputs": [ 53 | { 54 | "internalType": "bool", 55 | "name": "", 56 | "type": "bool" 57 | } 58 | ], 59 | "stateMutability": "nonpayable", 60 | "type": "function" 61 | }, 62 | { 63 | "inputs": [ 64 | { 65 | "internalType": "address", 66 | "name": "", 67 | "type": "address" 68 | } 69 | ], 70 | "name": "tokenBalance", 71 | "outputs": [ 72 | { 73 | "internalType": "uint256", 74 | "name": "", 75 | "type": "uint256" 76 | } 77 | ], 78 | "stateMutability": "view", 79 | "type": "function" 80 | } 81 | ], 82 | "devdoc": { 83 | "kind": "dev", 84 | "methods": {}, 85 | "version": 1 86 | }, 87 | "userdoc": { 88 | "kind": "user", 89 | "methods": {}, 90 | "version": 1 91 | } 92 | }, 93 | "settings": { 94 | "compilationTarget": { 95 | "contracts/EventExample.sol": "EventExample" 96 | }, 97 | "evmVersion": "london", 98 | "libraries": {}, 99 | "metadata": { 100 | "bytecodeHash": "ipfs" 101 | }, 102 | "optimizer": { 103 | "enabled": false, 104 | "runs": 200 105 | }, 106 | "remappings": [] 107 | }, 108 | "sources": { 109 | "contracts/EventExample.sol": { 110 | "keccak256": "0x0cd4458dfb45b668d5d2d7f67c408d82b35efd6809e4adddd03dda3e7da2e4f5", 111 | "license": "MIT", 112 | "urls": [ 113 | "bzz-raw://bb68af8e5be05c8a5368686d8228c9d53ed2c9c18604c91cc32b5a46a3aef557", 114 | "dweb:/ipfs/Qmc1H8gjLw6o5vt8EuZsMKUE1fbrbcPmk43GPk7NbCqE5h" 115 | ] 116 | } 117 | }, 118 | "version": 1 119 | } -------------------------------------------------------------------------------- /contracts/artifacts/Owned.json: -------------------------------------------------------------------------------- 1 | { 2 | "deploy": { 3 | "VM:-": { 4 | "linkReferences": {}, 5 | "autoDeployLib": true 6 | }, 7 | "main:1": { 8 | "linkReferences": {}, 9 | "autoDeployLib": true 10 | }, 11 | "ropsten:3": { 12 | "linkReferences": {}, 13 | "autoDeployLib": true 14 | }, 15 | "rinkeby:4": { 16 | "linkReferences": {}, 17 | "autoDeployLib": true 18 | }, 19 | "kovan:42": { 20 | "linkReferences": {}, 21 | "autoDeployLib": true 22 | }, 23 | "goerli:5": { 24 | "linkReferences": {}, 25 | "autoDeployLib": true 26 | }, 27 | "Custom": { 28 | "linkReferences": {}, 29 | "autoDeployLib": true 30 | } 31 | }, 32 | "data": { 33 | "bytecode": { 34 | "functionDebugData": { 35 | "@_12": { 36 | "entryPoint": null, 37 | "id": 12, 38 | "parameterSlots": 0, 39 | "returnSlots": 0 40 | } 41 | }, 42 | "generatedSources": [], 43 | "linkReferences": {}, 44 | "object": "6080604052348015600f57600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550603f80605d6000396000f3fe6080604052600080fdfea26469706673582212201bdb8bfb777eb652fd8a3d1cb938c4392f8b874237466199a9061a02acf6b65f64736f6c63430008130033", 45 | "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLER PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH1 0x3F DUP1 PUSH1 0x5D PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SHL 0xDB DUP12 0xFB PUSH24 0x7EB652FD8A3D1CB938C4392F8B874237466199A9061A02AC 0xF6 0xB6 0x5F PUSH5 0x736F6C6343 STOP ADDMOD SGT STOP CALLER ", 46 | "sourceMap": "58:198:0:-:0;;;99:49;;;;;;;;;;131:10;123:5;;:18;;;;;;;;;;;;;;;;;;58:198;;;;;;" 47 | }, 48 | "deployedBytecode": { 49 | "functionDebugData": {}, 50 | "generatedSources": [], 51 | "immutableReferences": {}, 52 | "linkReferences": {}, 53 | "object": "6080604052600080fdfea26469706673582212201bdb8bfb777eb652fd8a3d1cb938c4392f8b874237466199a9061a02acf6b65f64736f6c63430008130033", 54 | "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SHL 0xDB DUP12 0xFB PUSH24 0x7EB652FD8A3D1CB938C4392F8B874237466199A9061A02AC 0xF6 0xB6 0x5F PUSH5 0x736F6C6343 STOP ADDMOD SGT STOP CALLER ", 55 | "sourceMap": "58:198:0:-:0;;;;;" 56 | }, 57 | "gasEstimates": { 58 | "creation": { 59 | "codeDepositCost": "12600", 60 | "executionCost": "24332", 61 | "totalCost": "36932" 62 | } 63 | }, 64 | "methodIdentifiers": {} 65 | }, 66 | "abi": [ 67 | { 68 | "inputs": [], 69 | "stateMutability": "nonpayable", 70 | "type": "constructor" 71 | } 72 | ] 73 | } -------------------------------------------------------------------------------- /.deps/github/OpenZeppelin/openzeppelin-contracts/contracts/access/Ownable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../utils/Context.sol"; 7 | 8 | /** 9 | * @dev Contract module which provides a basic access control mechanism, where 10 | * there is an account (an owner) that can be granted exclusive access to 11 | * specific functions. 12 | * 13 | * By default, the owner account will be the one that deploys the contract. This 14 | * can later be changed with {transferOwnership}. 15 | * 16 | * This module is used through inheritance. It will make available the modifier 17 | * `onlyOwner`, which can be applied to your functions to restrict their use to 18 | * the owner. 19 | */ 20 | abstract contract Ownable is Context { 21 | address private _owner; 22 | 23 | event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); 24 | 25 | /** 26 | * @dev Initializes the contract setting the deployer as the initial owner. 27 | */ 28 | constructor() { 29 | _transferOwnership(_msgSender()); 30 | } 31 | 32 | /** 33 | * @dev Throws if called by any account other than the owner. 34 | */ 35 | modifier onlyOwner() { 36 | _checkOwner(); 37 | _; 38 | } 39 | 40 | /** 41 | * @dev Returns the address of the current owner. 42 | */ 43 | function owner() public view virtual returns (address) { 44 | return _owner; 45 | } 46 | 47 | /** 48 | * @dev Throws if the sender is not the owner. 49 | */ 50 | function _checkOwner() internal view virtual { 51 | require(owner() == _msgSender(), "Ownable: caller is not the owner"); 52 | } 53 | 54 | /** 55 | * @dev Leaves the contract without owner. It will not be possible to call 56 | * `onlyOwner` functions. Can only be called by the current owner. 57 | * 58 | * NOTE: Renouncing ownership will leave the contract without an owner, 59 | * thereby disabling any functionality that is only available to the owner. 60 | */ 61 | function renounceOwnership() public virtual onlyOwner { 62 | _transferOwnership(address(0)); 63 | } 64 | 65 | /** 66 | * @dev Transfers ownership of the contract to a new account (`newOwner`). 67 | * Can only be called by the current owner. 68 | */ 69 | function transferOwnership(address newOwner) public virtual onlyOwner { 70 | require(newOwner != address(0), "Ownable: new owner is the zero address"); 71 | _transferOwnership(newOwner); 72 | } 73 | 74 | /** 75 | * @dev Transfers ownership of the contract to a new account (`newOwner`). 76 | * Internal function without access restriction. 77 | */ 78 | function _transferOwnership(address newOwner) internal virtual { 79 | address oldOwner = _owner; 80 | _owner = newOwner; 81 | emit OwnershipTransferred(oldOwner, newOwner); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /contracts/artifacts/SimpleStorage_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.17+commit.8df45f5f" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "name": "getAllResponses", 11 | "outputs": [ 12 | { 13 | "components": [ 14 | { 15 | "internalType": "address", 16 | "name": "to", 17 | "type": "address" 18 | }, 19 | { 20 | "internalType": "string", 21 | "name": "first_name", 22 | "type": "string" 23 | }, 24 | { 25 | "internalType": "string", 26 | "name": "last_name", 27 | "type": "string" 28 | } 29 | ], 30 | "internalType": "struct SimpleStorage.Test[]", 31 | "name": "", 32 | "type": "tuple[]" 33 | } 34 | ], 35 | "stateMutability": "view", 36 | "type": "function" 37 | }, 38 | { 39 | "inputs": [], 40 | "name": "getResponseByAddress", 41 | "outputs": [ 42 | { 43 | "components": [ 44 | { 45 | "internalType": "string", 46 | "name": "first_name", 47 | "type": "string" 48 | }, 49 | { 50 | "internalType": "string", 51 | "name": "last_name", 52 | "type": "string" 53 | } 54 | ], 55 | "internalType": "struct SimpleStorage.Pass[]", 56 | "name": "", 57 | "type": "tuple[]" 58 | } 59 | ], 60 | "stateMutability": "view", 61 | "type": "function" 62 | }, 63 | { 64 | "inputs": [ 65 | { 66 | "internalType": "address", 67 | "name": "to", 68 | "type": "address" 69 | }, 70 | { 71 | "internalType": "string", 72 | "name": "firstName", 73 | "type": "string" 74 | }, 75 | { 76 | "internalType": "string", 77 | "name": "lastName", 78 | "type": "string" 79 | } 80 | ], 81 | "name": "submitPass", 82 | "outputs": [], 83 | "stateMutability": "nonpayable", 84 | "type": "function" 85 | } 86 | ], 87 | "devdoc": { 88 | "kind": "dev", 89 | "methods": {}, 90 | "version": 1 91 | }, 92 | "userdoc": { 93 | "kind": "user", 94 | "methods": {}, 95 | "version": 1 96 | } 97 | }, 98 | "settings": { 99 | "compilationTarget": { 100 | "contracts/4_mappingStructArray.sol": "SimpleStorage" 101 | }, 102 | "evmVersion": "london", 103 | "libraries": {}, 104 | "metadata": { 105 | "bytecodeHash": "ipfs" 106 | }, 107 | "optimizer": { 108 | "enabled": false, 109 | "runs": 200 110 | }, 111 | "remappings": [] 112 | }, 113 | "sources": { 114 | "contracts/4_mappingStructArray.sol": { 115 | "keccak256": "0xd39651947f88f5554bc51e55ba5001c22fc97ba0dfdba5e70a711fe403a0adc5", 116 | "license": "MIT", 117 | "urls": [ 118 | "bzz-raw://f0064ba9265e1893473aad7eda18812e493249a0154e1db18ef44e181fc5296e", 119 | "dweb:/ipfs/QmRcoG3UZWVpdFbbv3HFYYBqnLYzenGY8qQpHWpL6q4AdM" 120 | ] 121 | } 122 | }, 123 | "version": 1 124 | } -------------------------------------------------------------------------------- /.deps/github/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Interface of the ERC20 standard as defined in the EIP. 8 | */ 9 | interface IERC20 { 10 | /** 11 | * @dev Emitted when `value` tokens are moved from one account (`from`) to 12 | * another (`to`). 13 | * 14 | * Note that `value` may be zero. 15 | */ 16 | event Transfer(address indexed from, address indexed to, uint256 value); 17 | 18 | /** 19 | * @dev Emitted when the allowance of a `spender` for an `owner` is set by 20 | * a call to {approve}. `value` is the new allowance. 21 | */ 22 | event Approval(address indexed owner, address indexed spender, uint256 value); 23 | 24 | /** 25 | * @dev Returns the amount of tokens in existence. 26 | */ 27 | function totalSupply() external view returns (uint256); 28 | 29 | /** 30 | * @dev Returns the amount of tokens owned by `account`. 31 | */ 32 | function balanceOf(address account) external view returns (uint256); 33 | 34 | /** 35 | * @dev Moves `amount` tokens from the caller's account to `to`. 36 | * 37 | * Returns a boolean value indicating whether the operation succeeded. 38 | * 39 | * Emits a {Transfer} event. 40 | */ 41 | function transfer(address to, uint256 amount) external returns (bool); 42 | 43 | /** 44 | * @dev Returns the remaining number of tokens that `spender` will be 45 | * allowed to spend on behalf of `owner` through {transferFrom}. This is 46 | * zero by default. 47 | * 48 | * This value changes when {approve} or {transferFrom} are called. 49 | */ 50 | function allowance(address owner, address spender) external view returns (uint256); 51 | 52 | /** 53 | * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. 54 | * 55 | * Returns a boolean value indicating whether the operation succeeded. 56 | * 57 | * IMPORTANT: Beware that changing an allowance with this method brings the risk 58 | * that someone may use both the old and the new allowance by unfortunate 59 | * transaction ordering. One possible solution to mitigate this race 60 | * condition is to first reduce the spender's allowance to 0 and set the 61 | * desired value afterwards: 62 | * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 63 | * 64 | * Emits an {Approval} event. 65 | */ 66 | function approve(address spender, uint256 amount) external returns (bool); 67 | 68 | /** 69 | * @dev Moves `amount` tokens from `from` to `to` using the 70 | * allowance mechanism. `amount` is then deducted from the caller's 71 | * allowance. 72 | * 73 | * Returns a boolean value indicating whether the operation succeeded. 74 | * 75 | * Emits a {Transfer} event. 76 | */ 77 | function transferFrom(address from, address to, uint256 amount) external returns (bool); 78 | } 79 | -------------------------------------------------------------------------------- /contracts/artifacts/build-info/7f510c21d83fef8826c9d75898f70ee2.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "7f510c21d83fef8826c9d75898f70ee2", 3 | "_format": "hh-sol-build-info-1", 4 | "solcVersion": "0.8.14", 5 | "solcLongVersion": "0.8.14+commit.80d49f37", 6 | "input": { 7 | "language": "Solidity", 8 | "sources": { 9 | "contracts/ExampleMappingStruct.sol": { 10 | "content": "// //SPDX-License-Identifier: MIT\n\n// pragma solidity ^0.8.14;\n\n// contract MappingsStructExample {\n\n// struct Transaction {\n// uint amount;\n// uint timestamp;\n// }\n\n// struct Balance {\n// uint totalBalance;\n// uint numDeposits;\n// mapping(uint => Transaction) deposits;\n// uint numWithdrawals;\n// mapping(uint => Transaction) withdrawals;\n// }\n\n// mapping(address => Balance) public balanceReceived;\n\n\n// function getBalance(address _addr) public view returns(uint) {\n// return balanceReceived[_addr].totalBalance;\n// }\n\n// function depositMoney() public payable {\n// balanceReceived[msg.sender].totalBalance += msg.value;\n\n// Transaction memory deposit = Transaction(msg.value, block.timestamp);\n// balanceReceived[msg.sender].deposits[balanceReceived[msg.sender].numDeposits] = deposit;\n// balanceReceived[msg.sender].numDeposits++;\n// }\n\n// function withdrawMoney(address payable _to, uint _amount) public {\n// balanceReceived[msg.sender].totalBalance -= _amount; //reduce the balance by the amount ot withdraw\n\n// //record a new withdrawal\n// Transaction memory withdrawal = Transaction(msg.value, block.timestamp);\n// balanceReceived[msg.sender].withdrawals[balanceReceived[msg.sender].numWithdrawals] = withdrawals;\n// balanceReceived[msg.sender].numWithdrawals++;\n\n// //send the amount out.\n// _to.transfer(_amount);\n// }\n// }\n" 11 | } 12 | }, 13 | "settings": { 14 | "optimizer": { 15 | "enabled": false, 16 | "runs": 200 17 | }, 18 | "outputSelection": { 19 | "*": { 20 | "": [ 21 | "ast" 22 | ], 23 | "*": [ 24 | "abi", 25 | "metadata", 26 | "devdoc", 27 | "userdoc", 28 | "storageLayout", 29 | "evm.legacyAssembly", 30 | "evm.bytecode", 31 | "evm.deployedBytecode", 32 | "evm.methodIdentifiers", 33 | "evm.gasEstimates", 34 | "evm.assembly" 35 | ] 36 | } 37 | } 38 | } 39 | }, 40 | "output": { 41 | "errors": [ 42 | { 43 | "component": "general", 44 | "errorCode": "3420", 45 | "formattedMessage": "Warning: Source file does not specify required compiler version! Consider adding \"pragma solidity ^0.8.14;\"\n--> contracts/ExampleMappingStruct.sol\n\n", 46 | "message": "Source file does not specify required compiler version! Consider adding \"pragma solidity ^0.8.14;\"", 47 | "severity": "warning", 48 | "sourceLocation": { 49 | "end": -1, 50 | "file": "contracts/ExampleMappingStruct.sol", 51 | "start": -1 52 | }, 53 | "type": "Warning" 54 | } 55 | ], 56 | "sources": { 57 | "contracts/ExampleMappingStruct.sol": { 58 | "ast": { 59 | "absolutePath": "contracts/ExampleMappingStruct.sol", 60 | "exportedSymbols": {}, 61 | "id": 1, 62 | "license": "MIT", 63 | "nodeType": "SourceUnit", 64 | "nodes": [], 65 | "src": "1531:0:0" 66 | }, 67 | "id": 0 68 | } 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /contracts/artifacts/SampleWallet_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.15+commit.e14f2714" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "stateMutability": "nonpayable", 11 | "type": "constructor" 12 | }, 13 | { 14 | "inputs": [ 15 | { 16 | "internalType": "address", 17 | "name": "", 18 | "type": "address" 19 | } 20 | ], 21 | "name": "allowance", 22 | "outputs": [ 23 | { 24 | "internalType": "uint256", 25 | "name": "", 26 | "type": "uint256" 27 | } 28 | ], 29 | "stateMutability": "view", 30 | "type": "function" 31 | }, 32 | { 33 | "inputs": [], 34 | "name": "confirmationsFromGuardiansForReset", 35 | "outputs": [ 36 | { 37 | "internalType": "uint256", 38 | "name": "", 39 | "type": "uint256" 40 | } 41 | ], 42 | "stateMutability": "view", 43 | "type": "function" 44 | }, 45 | { 46 | "inputs": [ 47 | { 48 | "internalType": "address", 49 | "name": "_from", 50 | "type": "address" 51 | } 52 | ], 53 | "name": "denySending", 54 | "outputs": [], 55 | "stateMutability": "nonpayable", 56 | "type": "function" 57 | }, 58 | { 59 | "inputs": [ 60 | { 61 | "internalType": "address", 62 | "name": "", 63 | "type": "address" 64 | } 65 | ], 66 | "name": "guardian", 67 | "outputs": [ 68 | { 69 | "internalType": "bool", 70 | "name": "", 71 | "type": "bool" 72 | } 73 | ], 74 | "stateMutability": "view", 75 | "type": "function" 76 | }, 77 | { 78 | "inputs": [ 79 | { 80 | "internalType": "address", 81 | "name": "", 82 | "type": "address" 83 | } 84 | ], 85 | "name": "isAllowedToSend", 86 | "outputs": [ 87 | { 88 | "internalType": "bool", 89 | "name": "", 90 | "type": "bool" 91 | } 92 | ], 93 | "stateMutability": "view", 94 | "type": "function" 95 | }, 96 | { 97 | "inputs": [ 98 | { 99 | "internalType": "address payable", 100 | "name": "newOwner", 101 | "type": "address" 102 | } 103 | ], 104 | "name": "proposeNewOwner", 105 | "outputs": [], 106 | "stateMutability": "nonpayable", 107 | "type": "function" 108 | }, 109 | { 110 | "inputs": [ 111 | { 112 | "internalType": "address", 113 | "name": "_from", 114 | "type": "address" 115 | }, 116 | { 117 | "internalType": "uint256", 118 | "name": "_amount", 119 | "type": "uint256" 120 | } 121 | ], 122 | "name": "setAllowance", 123 | "outputs": [], 124 | "stateMutability": "nonpayable", 125 | "type": "function" 126 | }, 127 | { 128 | "inputs": [ 129 | { 130 | "internalType": "address payable", 131 | "name": "_to", 132 | "type": "address" 133 | }, 134 | { 135 | "internalType": "uint256", 136 | "name": "_amount", 137 | "type": "uint256" 138 | }, 139 | { 140 | "internalType": "bytes", 141 | "name": "payload", 142 | "type": "bytes" 143 | } 144 | ], 145 | "name": "transfer", 146 | "outputs": [ 147 | { 148 | "internalType": "bytes", 149 | "name": "", 150 | "type": "bytes" 151 | } 152 | ], 153 | "stateMutability": "nonpayable", 154 | "type": "function" 155 | }, 156 | { 157 | "stateMutability": "payable", 158 | "type": "receive" 159 | } 160 | ], 161 | "devdoc": { 162 | "kind": "dev", 163 | "methods": {}, 164 | "version": 1 165 | }, 166 | "userdoc": { 167 | "kind": "user", 168 | "methods": {}, 169 | "version": 1 170 | } 171 | }, 172 | "settings": { 173 | "compilationTarget": { 174 | "contracts/SmartWalletProject.sol": "SampleWallet" 175 | }, 176 | "evmVersion": "london", 177 | "libraries": {}, 178 | "metadata": { 179 | "bytecodeHash": "ipfs" 180 | }, 181 | "optimizer": { 182 | "enabled": false, 183 | "runs": 200 184 | }, 185 | "remappings": [] 186 | }, 187 | "sources": { 188 | "contracts/SmartWalletProject.sol": { 189 | "keccak256": "0x81941af3059638c0079ff459f9aac557bbd9be317a6a2ede087051b324550eb0", 190 | "license": "MIT", 191 | "urls": [ 192 | "bzz-raw://fe01c61fe0c9ecd1fc5b42b7e30b134c1131bd7f1c77274f7c76a1f50757144f", 193 | "dweb:/ipfs/QmNxrPR5dgWsoohxjuPHc49xXjzstemoNMa2cV7hX3ghLc" 194 | ] 195 | } 196 | }, 197 | "version": 1 198 | } -------------------------------------------------------------------------------- /contracts/3_Ballot.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | /** 6 | * @title Ballot 7 | * @dev Implements voting process along with vote delegation 8 | */ 9 | contract Ballot { 10 | 11 | struct Voter { 12 | uint weight; // weight is accumulated by delegation 13 | bool voted; // if true, that person already voted 14 | address delegate; // person delegated to 15 | uint vote; // index of the voted proposal 16 | } 17 | 18 | struct Proposal { 19 | // If you can limit the length to a certain number of bytes, 20 | // always use one of bytes1 to bytes32 because they are much cheaper 21 | bytes32 name; // short name (up to 32 bytes) 22 | uint voteCount; // number of accumulated votes 23 | } 24 | 25 | address public chairperson; 26 | 27 | mapping(address => Voter) public voters; 28 | 29 | Proposal[] public proposals; 30 | 31 | /** 32 | * @dev Create a new ballot to choose one of 'proposalNames'. 33 | * @param proposalNames names of proposals 34 | */ 35 | constructor(bytes32[] memory proposalNames) { 36 | chairperson = msg.sender; 37 | voters[chairperson].weight = 1; 38 | 39 | for (uint i = 0; i < proposalNames.length; i++) { 40 | // 'Proposal({...})' creates a temporary 41 | // Proposal object and 'proposals.push(...)' 42 | // appends it to the end of 'proposals'. 43 | proposals.push(Proposal({ 44 | name: proposalNames[i], 45 | voteCount: 0 46 | })); 47 | } 48 | } 49 | 50 | /** 51 | * @dev Give 'voter' the right to vote on this ballot. May only be called by 'chairperson'. 52 | * @param voter address of voter 53 | */ 54 | function giveRightToVote(address voter) public { 55 | require( 56 | msg.sender == chairperson, 57 | "Only chairperson can give right to vote." 58 | ); 59 | require( 60 | !voters[voter].voted, 61 | "The voter already voted." 62 | ); 63 | require(voters[voter].weight == 0); 64 | voters[voter].weight = 1; 65 | } 66 | 67 | /** 68 | * @dev Delegate your vote to the voter 'to'. 69 | * @param to address to which vote is delegated 70 | */ 71 | function delegate(address to) public { 72 | Voter storage sender = voters[msg.sender]; 73 | require(!sender.voted, "You already voted."); 74 | require(to != msg.sender, "Self-delegation is disallowed."); 75 | 76 | while (voters[to].delegate != address(0)) { 77 | to = voters[to].delegate; 78 | 79 | // We found a loop in the delegation, not allowed. 80 | require(to != msg.sender, "Found loop in delegation."); 81 | } 82 | sender.voted = true; 83 | sender.delegate = to; 84 | Voter storage delegate_ = voters[to]; 85 | if (delegate_.voted) { 86 | // If the delegate already voted, 87 | // directly add to the number of votes 88 | proposals[delegate_.vote].voteCount += sender.weight; 89 | } else { 90 | // If the delegate did not vote yet, 91 | // add to her weight. 92 | delegate_.weight += sender.weight; 93 | } 94 | } 95 | 96 | /** 97 | * @dev Give your vote (including votes delegated to you) to proposal 'proposals[proposal].name'. 98 | * @param proposal index of proposal in the proposals array 99 | */ 100 | function vote(uint proposal) public { 101 | Voter storage sender = voters[msg.sender]; 102 | require(sender.weight != 0, "Has no right to vote"); 103 | require(!sender.voted, "Already voted."); 104 | sender.voted = true; 105 | sender.vote = proposal; 106 | 107 | // If 'proposal' is out of the range of the array, 108 | // this will throw automatically and revert all 109 | // changes. 110 | proposals[proposal].voteCount += sender.weight; 111 | } 112 | 113 | /** 114 | * @dev Computes the winning proposal taking all previous votes into account. 115 | * @return winningProposal_ index of winning proposal in the proposals array 116 | */ 117 | function winningProposal() public view 118 | returns (uint winningProposal_) 119 | { 120 | uint winningVoteCount = 0; 121 | for (uint p = 0; p < proposals.length; p++) { 122 | if (proposals[p].voteCount > winningVoteCount) { 123 | winningVoteCount = proposals[p].voteCount; 124 | winningProposal_ = p; 125 | } 126 | } 127 | } 128 | 129 | /** 130 | * @dev Calls winningProposal() function to get the index of the winner contained in the proposals array and then 131 | * @return winnerName_ the name of the winner 132 | */ 133 | function winnerName() public view 134 | returns (bytes32 winnerName_) 135 | { 136 | winnerName_ = proposals[winningProposal()].name; 137 | } 138 | } -------------------------------------------------------------------------------- /.deps/remix-tests/remix_tests.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.4.22 <0.9.0; 4 | 5 | library Assert { 6 | 7 | event AssertionEvent( 8 | bool passed, 9 | string message, 10 | string methodName 11 | ); 12 | 13 | event AssertionEventUint( 14 | bool passed, 15 | string message, 16 | string methodName, 17 | uint256 returned, 18 | uint256 expected 19 | ); 20 | 21 | event AssertionEventInt( 22 | bool passed, 23 | string message, 24 | string methodName, 25 | int256 returned, 26 | int256 expected 27 | ); 28 | 29 | event AssertionEventBool( 30 | bool passed, 31 | string message, 32 | string methodName, 33 | bool returned, 34 | bool expected 35 | ); 36 | 37 | event AssertionEventAddress( 38 | bool passed, 39 | string message, 40 | string methodName, 41 | address returned, 42 | address expected 43 | ); 44 | 45 | event AssertionEventBytes32( 46 | bool passed, 47 | string message, 48 | string methodName, 49 | bytes32 returned, 50 | bytes32 expected 51 | ); 52 | 53 | event AssertionEventString( 54 | bool passed, 55 | string message, 56 | string methodName, 57 | string returned, 58 | string expected 59 | ); 60 | 61 | event AssertionEventUintInt( 62 | bool passed, 63 | string message, 64 | string methodName, 65 | uint256 returned, 66 | int256 expected 67 | ); 68 | 69 | event AssertionEventIntUint( 70 | bool passed, 71 | string message, 72 | string methodName, 73 | int256 returned, 74 | uint256 expected 75 | ); 76 | 77 | function ok(bool a, string memory message) public returns (bool result) { 78 | result = a; 79 | emit AssertionEvent(result, message, "ok"); 80 | } 81 | 82 | function equal(uint256 a, uint256 b, string memory message) public returns (bool result) { 83 | result = (a == b); 84 | emit AssertionEventUint(result, message, "equal", a, b); 85 | } 86 | 87 | function equal(int256 a, int256 b, string memory message) public returns (bool result) { 88 | result = (a == b); 89 | emit AssertionEventInt(result, message, "equal", a, b); 90 | } 91 | 92 | function equal(bool a, bool b, string memory message) public returns (bool result) { 93 | result = (a == b); 94 | emit AssertionEventBool(result, message, "equal", a, b); 95 | } 96 | 97 | // TODO: only for certain versions of solc 98 | //function equal(fixed a, fixed b, string message) public returns (bool result) { 99 | // result = (a == b); 100 | // emit AssertionEvent(result, message); 101 | //} 102 | 103 | // TODO: only for certain versions of solc 104 | //function equal(ufixed a, ufixed b, string message) public returns (bool result) { 105 | // result = (a == b); 106 | // emit AssertionEvent(result, message); 107 | //} 108 | 109 | function equal(address a, address b, string memory message) public returns (bool result) { 110 | result = (a == b); 111 | emit AssertionEventAddress(result, message, "equal", a, b); 112 | } 113 | 114 | function equal(bytes32 a, bytes32 b, string memory message) public returns (bool result) { 115 | result = (a == b); 116 | emit AssertionEventBytes32(result, message, "equal", a, b); 117 | } 118 | 119 | function equal(string memory a, string memory b, string memory message) public returns (bool result) { 120 | result = (keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b))); 121 | emit AssertionEventString(result, message, "equal", a, b); 122 | } 123 | 124 | function notEqual(uint256 a, uint256 b, string memory message) public returns (bool result) { 125 | result = (a != b); 126 | emit AssertionEventUint(result, message, "notEqual", a, b); 127 | } 128 | 129 | function notEqual(int256 a, int256 b, string memory message) public returns (bool result) { 130 | result = (a != b); 131 | emit AssertionEventInt(result, message, "notEqual", a, b); 132 | } 133 | 134 | function notEqual(bool a, bool b, string memory message) public returns (bool result) { 135 | result = (a != b); 136 | emit AssertionEventBool(result, message, "notEqual", a, b); 137 | } 138 | 139 | // TODO: only for certain versions of solc 140 | //function notEqual(fixed a, fixed b, string message) public returns (bool result) { 141 | // result = (a != b); 142 | // emit AssertionEvent(result, message); 143 | //} 144 | 145 | // TODO: only for certain versions of solc 146 | //function notEqual(ufixed a, ufixed b, string message) public returns (bool result) { 147 | // result = (a != b); 148 | // emit AssertionEvent(result, message); 149 | //} 150 | 151 | function notEqual(address a, address b, string memory message) public returns (bool result) { 152 | result = (a != b); 153 | emit AssertionEventAddress(result, message, "notEqual", a, b); 154 | } 155 | 156 | function notEqual(bytes32 a, bytes32 b, string memory message) public returns (bool result) { 157 | result = (a != b); 158 | emit AssertionEventBytes32(result, message, "notEqual", a, b); 159 | } 160 | 161 | function notEqual(string memory a, string memory b, string memory message) public returns (bool result) { 162 | result = (keccak256(abi.encodePacked(a)) != keccak256(abi.encodePacked(b))); 163 | emit AssertionEventString(result, message, "notEqual", a, b); 164 | } 165 | 166 | /*----------------- Greater than --------------------*/ 167 | function greaterThan(uint256 a, uint256 b, string memory message) public returns (bool result) { 168 | result = (a > b); 169 | emit AssertionEventUint(result, message, "greaterThan", a, b); 170 | } 171 | 172 | function greaterThan(int256 a, int256 b, string memory message) public returns (bool result) { 173 | result = (a > b); 174 | emit AssertionEventInt(result, message, "greaterThan", a, b); 175 | } 176 | // TODO: safely compare between uint and int 177 | function greaterThan(uint256 a, int256 b, string memory message) public returns (bool result) { 178 | if(b < int(0)) { 179 | // int is negative uint "a" always greater 180 | result = true; 181 | } else { 182 | result = (a > uint(b)); 183 | } 184 | emit AssertionEventUintInt(result, message, "greaterThan", a, b); 185 | } 186 | function greaterThan(int256 a, uint256 b, string memory message) public returns (bool result) { 187 | if(a < int(0)) { 188 | // int is negative uint "b" always greater 189 | result = false; 190 | } else { 191 | result = (uint(a) > b); 192 | } 193 | emit AssertionEventIntUint(result, message, "greaterThan", a, b); 194 | } 195 | /*----------------- Lesser than --------------------*/ 196 | function lesserThan(uint256 a, uint256 b, string memory message) public returns (bool result) { 197 | result = (a < b); 198 | emit AssertionEventUint(result, message, "lesserThan", a, b); 199 | } 200 | 201 | function lesserThan(int256 a, int256 b, string memory message) public returns (bool result) { 202 | result = (a < b); 203 | emit AssertionEventInt(result, message, "lesserThan", a, b); 204 | } 205 | // TODO: safely compare between uint and int 206 | function lesserThan(uint256 a, int256 b, string memory message) public returns (bool result) { 207 | if(b < int(0)) { 208 | // int is negative int "b" always lesser 209 | result = false; 210 | } else { 211 | result = (a < uint(b)); 212 | } 213 | emit AssertionEventUintInt(result, message, "lesserThan", a, b); 214 | } 215 | 216 | function lesserThan(int256 a, uint256 b, string memory message) public returns (bool result) { 217 | if(a < int(0)) { 218 | // int is negative int "a" always lesser 219 | result = true; 220 | } else { 221 | result = (uint(a) < b); 222 | } 223 | emit AssertionEventIntUint(result, message, "lesserThan", a, b); 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /contracts/artifacts/ExceptionRequireExample.json: -------------------------------------------------------------------------------- 1 | { 2 | "deploy": { 3 | "VM:-": { 4 | "linkReferences": {}, 5 | "autoDeployLib": true 6 | }, 7 | "main:1": { 8 | "linkReferences": {}, 9 | "autoDeployLib": true 10 | }, 11 | "ropsten:3": { 12 | "linkReferences": {}, 13 | "autoDeployLib": true 14 | }, 15 | "rinkeby:4": { 16 | "linkReferences": {}, 17 | "autoDeployLib": true 18 | }, 19 | "kovan:42": { 20 | "linkReferences": {}, 21 | "autoDeployLib": true 22 | }, 23 | "goerli:5": { 24 | "linkReferences": {}, 25 | "autoDeployLib": true 26 | }, 27 | "Custom": { 28 | "linkReferences": {}, 29 | "autoDeployLib": true 30 | } 31 | }, 32 | "data": { 33 | "bytecode": { 34 | "linkReferences": {}, 35 | "object": "608060405234801561001057600080fd5b5061027c806100206000396000f3fe6080604052600436106100345760003560e01c80636d26ec1814610039578063d18a42e114610043578063f274c897146100a8575b600080fd5b610041610103565b005b34801561004f57600080fd5b506100926004803603602081101561006657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610151565b6040518082815260200191505060405180910390f35b3480156100b457600080fd5b50610101600480360360408110156100cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610169565b005b346000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550565b60006020528060005260406000206000915090505481565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811161024257806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610240573d6000803e3d6000fd5b505b505056fea264697066735822122079b8279f413a2183460a7939a0a1b9c7f90b79ec795188dcf298ad16041e929264736f6c634300060c0033", 36 | "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x27C DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x34 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x6D26EC18 EQ PUSH2 0x39 JUMPI DUP1 PUSH4 0xD18A42E1 EQ PUSH2 0x43 JUMPI DUP1 PUSH4 0xF274C897 EQ PUSH2 0xA8 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x41 PUSH2 0x103 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x92 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x66 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH2 0x151 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xB4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x101 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x40 DUP2 LT ISZERO PUSH2 0xCB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH2 0x169 JUMP JUMPDEST STOP JUMPDEST CALLVALUE PUSH1 0x0 DUP1 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD ADD SWAP3 POP POP DUP2 SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SWAP1 POP SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD DUP2 GT PUSH2 0x242 JUMPI DUP1 PUSH1 0x0 DUP1 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD SUB SWAP3 POP POP DUP2 SWAP1 SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x8FC DUP3 SWAP1 DUP2 ISZERO MUL SWAP1 PUSH1 0x40 MLOAD PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0x240 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP JUMPDEST POP POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH26 0xB8279F413A2183460A7939A0A1B9C7F90B79EC795188DCF298AD AND DIV 0x1E SWAP3 SWAP3 PUSH5 0x736F6C6343 STOP MOD 0xC STOP CALLER ", 37 | "sourceMap": "57:420:0:-:0;;;;;;;;;;;;;;;;;;;" 38 | }, 39 | "deployedBytecode": { 40 | "immutableReferences": {}, 41 | "linkReferences": {}, 42 | "object": "6080604052600436106100345760003560e01c80636d26ec1814610039578063d18a42e114610043578063f274c897146100a8575b600080fd5b610041610103565b005b34801561004f57600080fd5b506100926004803603602081101561006657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610151565b6040518082815260200191505060405180910390f35b3480156100b457600080fd5b50610101600480360360408110156100cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610169565b005b346000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550565b60006020528060005260406000206000915090505481565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811161024257806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610240573d6000803e3d6000fd5b505b505056fea264697066735822122079b8279f413a2183460a7939a0a1b9c7f90b79ec795188dcf298ad16041e929264736f6c634300060c0033", 43 | "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x34 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x6D26EC18 EQ PUSH2 0x39 JUMPI DUP1 PUSH4 0xD18A42E1 EQ PUSH2 0x43 JUMPI DUP1 PUSH4 0xF274C897 EQ PUSH2 0xA8 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x41 PUSH2 0x103 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x92 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x66 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH2 0x151 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xB4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x101 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x40 DUP2 LT ISZERO PUSH2 0xCB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH2 0x169 JUMP JUMPDEST STOP JUMPDEST CALLVALUE PUSH1 0x0 DUP1 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD ADD SWAP3 POP POP DUP2 SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SWAP1 POP SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD DUP2 GT PUSH2 0x242 JUMPI DUP1 PUSH1 0x0 DUP1 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD SUB SWAP3 POP POP DUP2 SWAP1 SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x8FC DUP3 SWAP1 DUP2 ISZERO MUL SWAP1 PUSH1 0x40 MLOAD PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0x240 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP JUMPDEST POP POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH26 0xB8279F413A2183460A7939A0A1B9C7F90B79EC795188DCF298AD AND DIV 0x1E SWAP3 SWAP3 PUSH5 0x736F6C6343 STOP MOD 0xC STOP CALLER ", 44 | "sourceMap": "57:420:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;151:96;;;:::i;:::-;;97:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;253:222;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;151:96;231:9;200:15;:27;216:10;200:27;;;;;;;;;;;;;;;;:40;;;;;;;;;;;151:96::o;97:47::-;;;;;;;;;;;;;;;;;:::o;253:222::-;342:15;:27;358:10;342:27;;;;;;;;;;;;;;;;331:7;:38;328:141;;416:7;385:15;:27;401:10;385:27;;;;;;;;;;;;;;;;:38;;;;;;;;;;;437:3;:12;;:21;450:7;437:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;328:141;253:222;;:::o" 45 | }, 46 | "gasEstimates": { 47 | "creation": { 48 | "codeDepositCost": "127200", 49 | "executionCost": "171", 50 | "totalCost": "127371" 51 | }, 52 | "external": { 53 | "balanceReceived(address)": "1169", 54 | "receiveMoney()": "21019", 55 | "withdrawMoney(address,uint256)": "infinite" 56 | } 57 | }, 58 | "methodIdentifiers": { 59 | "balanceReceived(address)": "d18a42e1", 60 | "receiveMoney()": "6d26ec18", 61 | "withdrawMoney(address,uint256)": "f274c897" 62 | } 63 | }, 64 | "abi": [ 65 | { 66 | "inputs": [ 67 | { 68 | "internalType": "address", 69 | "name": "", 70 | "type": "address" 71 | } 72 | ], 73 | "name": "balanceReceived", 74 | "outputs": [ 75 | { 76 | "internalType": "uint256", 77 | "name": "", 78 | "type": "uint256" 79 | } 80 | ], 81 | "stateMutability": "view", 82 | "type": "function" 83 | }, 84 | { 85 | "inputs": [], 86 | "name": "receiveMoney", 87 | "outputs": [], 88 | "stateMutability": "payable", 89 | "type": "function" 90 | }, 91 | { 92 | "inputs": [ 93 | { 94 | "internalType": "address payable", 95 | "name": "_to", 96 | "type": "address" 97 | }, 98 | { 99 | "internalType": "uint256", 100 | "name": "_amount", 101 | "type": "uint256" 102 | } 103 | ], 104 | "name": "withdrawMoney", 105 | "outputs": [], 106 | "stateMutability": "nonpayable", 107 | "type": "function" 108 | } 109 | ] 110 | } -------------------------------------------------------------------------------- /contracts/artifacts/DevCoin_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.19+commit.7dd6d404" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "stateMutability": "nonpayable", 11 | "type": "constructor" 12 | }, 13 | { 14 | "anonymous": false, 15 | "inputs": [ 16 | { 17 | "indexed": true, 18 | "internalType": "address", 19 | "name": "owner", 20 | "type": "address" 21 | }, 22 | { 23 | "indexed": true, 24 | "internalType": "address", 25 | "name": "spender", 26 | "type": "address" 27 | }, 28 | { 29 | "indexed": false, 30 | "internalType": "uint256", 31 | "name": "value", 32 | "type": "uint256" 33 | } 34 | ], 35 | "name": "Approval", 36 | "type": "event" 37 | }, 38 | { 39 | "anonymous": false, 40 | "inputs": [ 41 | { 42 | "indexed": true, 43 | "internalType": "address", 44 | "name": "from", 45 | "type": "address" 46 | }, 47 | { 48 | "indexed": true, 49 | "internalType": "address", 50 | "name": "to", 51 | "type": "address" 52 | }, 53 | { 54 | "indexed": false, 55 | "internalType": "uint256", 56 | "name": "value", 57 | "type": "uint256" 58 | } 59 | ], 60 | "name": "Transfer", 61 | "type": "event" 62 | }, 63 | { 64 | "inputs": [ 65 | { 66 | "internalType": "address", 67 | "name": "owner", 68 | "type": "address" 69 | }, 70 | { 71 | "internalType": "address", 72 | "name": "spender", 73 | "type": "address" 74 | } 75 | ], 76 | "name": "allowance", 77 | "outputs": [ 78 | { 79 | "internalType": "uint256", 80 | "name": "", 81 | "type": "uint256" 82 | } 83 | ], 84 | "stateMutability": "view", 85 | "type": "function" 86 | }, 87 | { 88 | "inputs": [ 89 | { 90 | "internalType": "address", 91 | "name": "spender", 92 | "type": "address" 93 | }, 94 | { 95 | "internalType": "uint256", 96 | "name": "amount", 97 | "type": "uint256" 98 | } 99 | ], 100 | "name": "approve", 101 | "outputs": [ 102 | { 103 | "internalType": "bool", 104 | "name": "", 105 | "type": "bool" 106 | } 107 | ], 108 | "stateMutability": "nonpayable", 109 | "type": "function" 110 | }, 111 | { 112 | "inputs": [ 113 | { 114 | "internalType": "address", 115 | "name": "account", 116 | "type": "address" 117 | } 118 | ], 119 | "name": "balanceOf", 120 | "outputs": [ 121 | { 122 | "internalType": "uint256", 123 | "name": "", 124 | "type": "uint256" 125 | } 126 | ], 127 | "stateMutability": "view", 128 | "type": "function" 129 | }, 130 | { 131 | "inputs": [], 132 | "name": "decimals", 133 | "outputs": [ 134 | { 135 | "internalType": "uint8", 136 | "name": "", 137 | "type": "uint8" 138 | } 139 | ], 140 | "stateMutability": "view", 141 | "type": "function" 142 | }, 143 | { 144 | "inputs": [ 145 | { 146 | "internalType": "address", 147 | "name": "spender", 148 | "type": "address" 149 | }, 150 | { 151 | "internalType": "uint256", 152 | "name": "subtractedValue", 153 | "type": "uint256" 154 | } 155 | ], 156 | "name": "decreaseAllowance", 157 | "outputs": [ 158 | { 159 | "internalType": "bool", 160 | "name": "", 161 | "type": "bool" 162 | } 163 | ], 164 | "stateMutability": "nonpayable", 165 | "type": "function" 166 | }, 167 | { 168 | "inputs": [ 169 | { 170 | "internalType": "address", 171 | "name": "spender", 172 | "type": "address" 173 | }, 174 | { 175 | "internalType": "uint256", 176 | "name": "addedValue", 177 | "type": "uint256" 178 | } 179 | ], 180 | "name": "increaseAllowance", 181 | "outputs": [ 182 | { 183 | "internalType": "bool", 184 | "name": "", 185 | "type": "bool" 186 | } 187 | ], 188 | "stateMutability": "nonpayable", 189 | "type": "function" 190 | }, 191 | { 192 | "inputs": [], 193 | "name": "name", 194 | "outputs": [ 195 | { 196 | "internalType": "string", 197 | "name": "", 198 | "type": "string" 199 | } 200 | ], 201 | "stateMutability": "view", 202 | "type": "function" 203 | }, 204 | { 205 | "inputs": [], 206 | "name": "symbol", 207 | "outputs": [ 208 | { 209 | "internalType": "string", 210 | "name": "", 211 | "type": "string" 212 | } 213 | ], 214 | "stateMutability": "view", 215 | "type": "function" 216 | }, 217 | { 218 | "inputs": [], 219 | "name": "totalSupply", 220 | "outputs": [ 221 | { 222 | "internalType": "uint256", 223 | "name": "", 224 | "type": "uint256" 225 | } 226 | ], 227 | "stateMutability": "view", 228 | "type": "function" 229 | }, 230 | { 231 | "inputs": [ 232 | { 233 | "internalType": "address", 234 | "name": "to", 235 | "type": "address" 236 | }, 237 | { 238 | "internalType": "uint256", 239 | "name": "amount", 240 | "type": "uint256" 241 | } 242 | ], 243 | "name": "transfer", 244 | "outputs": [ 245 | { 246 | "internalType": "bool", 247 | "name": "", 248 | "type": "bool" 249 | } 250 | ], 251 | "stateMutability": "nonpayable", 252 | "type": "function" 253 | }, 254 | { 255 | "inputs": [ 256 | { 257 | "internalType": "address", 258 | "name": "from", 259 | "type": "address" 260 | }, 261 | { 262 | "internalType": "address", 263 | "name": "to", 264 | "type": "address" 265 | }, 266 | { 267 | "internalType": "uint256", 268 | "name": "amount", 269 | "type": "uint256" 270 | } 271 | ], 272 | "name": "transferFrom", 273 | "outputs": [ 274 | { 275 | "internalType": "bool", 276 | "name": "", 277 | "type": "bool" 278 | } 279 | ], 280 | "stateMutability": "nonpayable", 281 | "type": "function" 282 | } 283 | ], 284 | "devdoc": { 285 | "events": { 286 | "Approval(address,address,uint256)": { 287 | "details": "Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance." 288 | }, 289 | "Transfer(address,address,uint256)": { 290 | "details": "Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero." 291 | } 292 | }, 293 | "kind": "dev", 294 | "methods": { 295 | "allowance(address,address)": { 296 | "details": "See {IERC20-allowance}." 297 | }, 298 | "approve(address,uint256)": { 299 | "details": "See {IERC20-approve}. NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address." 300 | }, 301 | "balanceOf(address)": { 302 | "details": "See {IERC20-balanceOf}." 303 | }, 304 | "decimals()": { 305 | "details": "Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}." 306 | }, 307 | "decreaseAllowance(address,uint256)": { 308 | "details": "Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`." 309 | }, 310 | "increaseAllowance(address,uint256)": { 311 | "details": "Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address." 312 | }, 313 | "name()": { 314 | "details": "Returns the name of the token." 315 | }, 316 | "symbol()": { 317 | "details": "Returns the symbol of the token, usually a shorter version of the name." 318 | }, 319 | "totalSupply()": { 320 | "details": "See {IERC20-totalSupply}." 321 | }, 322 | "transfer(address,uint256)": { 323 | "details": "See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`." 324 | }, 325 | "transferFrom(address,address,uint256)": { 326 | "details": "See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `amount`. - the caller must have allowance for ``from``'s tokens of at least `amount`." 327 | } 328 | }, 329 | "version": 1 330 | }, 331 | "userdoc": { 332 | "kind": "user", 333 | "methods": {}, 334 | "version": 1 335 | } 336 | }, 337 | "settings": { 338 | "compilationTarget": { 339 | "contracts/3_practice.sol": "DevCoin" 340 | }, 341 | "evmVersion": "paris", 342 | "libraries": {}, 343 | "metadata": { 344 | "bytecodeHash": "ipfs" 345 | }, 346 | "optimizer": { 347 | "enabled": false, 348 | "runs": 200 349 | }, 350 | "remappings": [] 351 | }, 352 | "sources": { 353 | "contracts/3_practice.sol": { 354 | "keccak256": "0xf4653b7be597e76ed711df844ef11fae17fcddbb6924ebb32afdedc822b85785", 355 | "license": "MIT", 356 | "urls": [ 357 | "bzz-raw://16aec3ac73cf8fe842594cb2a0ee52e1fc19fa1f67d645453570bec17ebd0227", 358 | "dweb:/ipfs/QmVWouzfBwmzRmVmkdN6Afe1jBL2rqj53K9HH3QJhU9XKS" 359 | ] 360 | }, 361 | "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol": { 362 | "keccak256": "0xb62681ccbf84aef125665cfdfc0bf13b532925b1a520d6c935913560f539a31b", 363 | "license": "MIT", 364 | "urls": [ 365 | "bzz-raw://21dbc5b8aede7dee8f0e3bf296a58270f376f8e40d6f8becccde5b3cf34bc8df", 366 | "dweb:/ipfs/QmfHPWrtGiMNhTtLDYtqSd1eVd35Zqgd4PW9bR3i23oJgg" 367 | ] 368 | }, 369 | "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol": { 370 | "keccak256": "0x00c839ff53d07d19db2e7cfa1e5133f9ee90a8d64b0e2e57f50446a2d1a3a0e0", 371 | "license": "MIT", 372 | "urls": [ 373 | "bzz-raw://3dac621d015a68a5251b1e5d41dda0faf252699bf6e8bcf46a958b29964d9dd1", 374 | "dweb:/ipfs/QmP9axjgZv4cezAhALoTemM62sdLtMDJ9MGTxECnNwHgSJ" 375 | ] 376 | }, 377 | "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/IERC20Metadata.sol": { 378 | "keccak256": "0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca", 379 | "license": "MIT", 380 | "urls": [ 381 | "bzz-raw://5a376d3dda2cb70536c0a45c208b29b34ac560c4cb4f513a42079f96ba47d2dd", 382 | "dweb:/ipfs/QmZQg6gn1sUpM8wHzwNvSnihumUCAhxD119MpXeKp8B9s8" 383 | ] 384 | }, 385 | "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol": { 386 | "keccak256": "0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7", 387 | "license": "MIT", 388 | "urls": [ 389 | "bzz-raw://6df0ddf21ce9f58271bdfaa85cde98b200ef242a05a3f85c2bc10a8294800a92", 390 | "dweb:/ipfs/QmRK2Y5Yc6BK7tGKkgsgn3aJEQGi5aakeSPZvS65PV8Xp3" 391 | ] 392 | } 393 | }, 394 | "version": 1 395 | } -------------------------------------------------------------------------------- /contracts/artifacts/ExceptionExample.json: -------------------------------------------------------------------------------- 1 | { 2 | "deploy": { 3 | "VM:-": { 4 | "linkReferences": {}, 5 | "autoDeployLib": true 6 | }, 7 | "main:1": { 8 | "linkReferences": {}, 9 | "autoDeployLib": true 10 | }, 11 | "ropsten:3": { 12 | "linkReferences": {}, 13 | "autoDeployLib": true 14 | }, 15 | "rinkeby:4": { 16 | "linkReferences": {}, 17 | "autoDeployLib": true 18 | }, 19 | "kovan:42": { 20 | "linkReferences": {}, 21 | "autoDeployLib": true 22 | }, 23 | "goerli:5": { 24 | "linkReferences": {}, 25 | "autoDeployLib": true 26 | }, 27 | "Custom": { 28 | "linkReferences": {}, 29 | "autoDeployLib": true 30 | } 31 | }, 32 | "data": { 33 | "bytecode": { 34 | "linkReferences": {}, 35 | "object": "608060405234801561001057600080fd5b506102ea806100206000396000f3fe6080604052600436106100345760003560e01c80636d26ec1814610039578063d18a42e114610043578063f274c897146100a8575b600080fd5b610041610103565b005b34801561004f57600080fd5b506100926004803603602081101561006657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610151565b6040518082815260200191505060405180910390f35b3480156100b457600080fd5b50610101600480360360408110156100cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610169565b005b346000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550565b60006020528060005260406000206000915090505481565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111561021d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4e6f7420456e6f7567682046756e64732c2061626f7274696e6700000000000081525060200191505060405180910390fd5b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156102af573d6000803e3d6000fd5b50505056fea2646970667358221220bad1d629379efad2a1ebfc080877516cd84f39876bbdee23e1db79f8f65ea48f64736f6c634300060c0033", 36 | "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2EA DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x34 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x6D26EC18 EQ PUSH2 0x39 JUMPI DUP1 PUSH4 0xD18A42E1 EQ PUSH2 0x43 JUMPI DUP1 PUSH4 0xF274C897 EQ PUSH2 0xA8 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x41 PUSH2 0x103 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x92 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x66 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH2 0x151 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xB4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x101 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x40 DUP2 LT ISZERO PUSH2 0xCB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH2 0x169 JUMP JUMPDEST STOP JUMPDEST CALLVALUE PUSH1 0x0 DUP1 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD ADD SWAP3 POP POP DUP2 SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SWAP1 POP SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD DUP2 GT ISZERO PUSH2 0x21D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD DUP1 DUP1 PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE PUSH1 0x1A DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH32 0x4E6F7420456E6F7567682046756E64732C2061626F7274696E67000000000000 DUP2 MSTORE POP PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0x0 DUP1 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD SUB SWAP3 POP POP DUP2 SWAP1 SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x8FC DUP3 SWAP1 DUP2 ISZERO MUL SWAP1 PUSH1 0x40 MLOAD PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0x2AF JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xBA 0xD1 0xD6 0x29 CALLDATACOPY SWAP15 STATICCALL 0xD2 LOG1 0xEB 0xFC ADDMOD ADDMOD PUSH24 0x516CD84F39876BBDEE23E1DB79F8F65EA48F64736F6C6343 STOP MOD 0xC STOP CALLER ", 37 | "sourceMap": "57:857:0:-:0;;;;;;;;;;;;;;;;;;;" 38 | }, 39 | "deployedBytecode": { 40 | "immutableReferences": {}, 41 | "linkReferences": {}, 42 | "object": "6080604052600436106100345760003560e01c80636d26ec1814610039578063d18a42e114610043578063f274c897146100a8575b600080fd5b610041610103565b005b34801561004f57600080fd5b506100926004803603602081101561006657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610151565b6040518082815260200191505060405180910390f35b3480156100b457600080fd5b50610101600480360360408110156100cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610169565b005b346000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550565b60006020528060005260406000206000915090505481565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111561021d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4e6f7420456e6f7567682046756e64732c2061626f7274696e6700000000000081525060200191505060405180910390fd5b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156102af573d6000803e3d6000fd5b50505056fea2646970667358221220bad1d629379efad2a1ebfc080877516cd84f39876bbdee23e1db79f8f65ea48f64736f6c634300060c0033", 43 | "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x34 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x6D26EC18 EQ PUSH2 0x39 JUMPI DUP1 PUSH4 0xD18A42E1 EQ PUSH2 0x43 JUMPI DUP1 PUSH4 0xF274C897 EQ PUSH2 0xA8 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x41 PUSH2 0x103 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x92 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x66 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH2 0x151 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xB4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x101 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x40 DUP2 LT ISZERO PUSH2 0xCB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH2 0x169 JUMP JUMPDEST STOP JUMPDEST CALLVALUE PUSH1 0x0 DUP1 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD ADD SWAP3 POP POP DUP2 SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SWAP1 POP SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD DUP2 GT ISZERO PUSH2 0x21D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD DUP1 DUP1 PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE PUSH1 0x1A DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH32 0x4E6F7420456E6F7567682046756E64732C2061626F7274696E67000000000000 DUP2 MSTORE POP PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0x0 DUP1 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD SUB SWAP3 POP POP DUP2 SWAP1 SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x8FC DUP3 SWAP1 DUP2 ISZERO MUL SWAP1 PUSH1 0x40 MLOAD PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0x2AF JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xBA 0xD1 0xD6 0x29 CALLDATACOPY SWAP15 STATICCALL 0xD2 LOG1 0xEB 0xFC ADDMOD ADDMOD PUSH24 0x516CD84F39876BBDEE23E1DB79F8F65EA48F64736F6C6343 STOP MOD 0xC STOP CALLER ", 44 | "sourceMap": "57:857:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;144:96;;;:::i;:::-;;90:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;246:666;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;144:96;224:9;193:15;:27;209:10;193:27;;;;;;;;;;;;;;;;:40;;;;;;;;;;;144:96::o;90:47::-;;;;;;;;;;;;;;;;;:::o;246:666::-;767:15;:27;783:10;767:27;;;;;;;;;;;;;;;;756:7;:38;;748:77;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;867:7;836:15;:27;852:10;836:27;;;;;;;;;;;;;;;;:38;;;;;;;;;;;884:3;:12;;:21;897:7;884:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;246:666;;:::o" 45 | }, 46 | "gasEstimates": { 47 | "creation": { 48 | "codeDepositCost": "149200", 49 | "executionCost": "196", 50 | "totalCost": "149396" 51 | }, 52 | "external": { 53 | "balanceReceived(address)": "1169", 54 | "receiveMoney()": "21019", 55 | "withdrawMoney(address,uint256)": "infinite" 56 | } 57 | }, 58 | "methodIdentifiers": { 59 | "balanceReceived(address)": "d18a42e1", 60 | "receiveMoney()": "6d26ec18", 61 | "withdrawMoney(address,uint256)": "f274c897" 62 | } 63 | }, 64 | "abi": [ 65 | { 66 | "inputs": [ 67 | { 68 | "internalType": "address", 69 | "name": "", 70 | "type": "address" 71 | } 72 | ], 73 | "name": "balanceReceived", 74 | "outputs": [ 75 | { 76 | "internalType": "uint256", 77 | "name": "", 78 | "type": "uint256" 79 | } 80 | ], 81 | "stateMutability": "view", 82 | "type": "function" 83 | }, 84 | { 85 | "inputs": [], 86 | "name": "receiveMoney", 87 | "outputs": [], 88 | "stateMutability": "payable", 89 | "type": "function" 90 | }, 91 | { 92 | "inputs": [ 93 | { 94 | "internalType": "address payable", 95 | "name": "_to", 96 | "type": "address" 97 | }, 98 | { 99 | "internalType": "uint256", 100 | "name": "_amount", 101 | "type": "uint256" 102 | } 103 | ], 104 | "name": "withdrawMoney", 105 | "outputs": [], 106 | "stateMutability": "nonpayable", 107 | "type": "function" 108 | } 109 | ] 110 | } -------------------------------------------------------------------------------- /.deps/github/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./IERC20.sol"; 7 | import "./extensions/IERC20Metadata.sol"; 8 | import "../../utils/Context.sol"; 9 | 10 | /** 11 | * @dev Implementation of the {IERC20} interface. 12 | * 13 | * This implementation is agnostic to the way tokens are created. This means 14 | * that a supply mechanism has to be added in a derived contract using {_mint}. 15 | * For a generic mechanism see {ERC20PresetMinterPauser}. 16 | * 17 | * TIP: For a detailed writeup see our guide 18 | * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How 19 | * to implement supply mechanisms]. 20 | * 21 | * The default value of {decimals} is 18. To change this, you should override 22 | * this function so it returns a different value. 23 | * 24 | * We have followed general OpenZeppelin Contracts guidelines: functions revert 25 | * instead returning `false` on failure. This behavior is nonetheless 26 | * conventional and does not conflict with the expectations of ERC20 27 | * applications. 28 | * 29 | * Additionally, an {Approval} event is emitted on calls to {transferFrom}. 30 | * This allows applications to reconstruct the allowance for all accounts just 31 | * by listening to said events. Other implementations of the EIP may not emit 32 | * these events, as it isn't required by the specification. 33 | * 34 | * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} 35 | * functions have been added to mitigate the well-known issues around setting 36 | * allowances. See {IERC20-approve}. 37 | */ 38 | contract ERC20 is Context, IERC20, IERC20Metadata { 39 | mapping(address => uint256) private _balances; 40 | 41 | mapping(address => mapping(address => uint256)) private _allowances; 42 | 43 | uint256 private _totalSupply; 44 | 45 | string private _name; 46 | string private _symbol; 47 | 48 | /** 49 | * @dev Sets the values for {name} and {symbol}. 50 | * 51 | * All two of these values are immutable: they can only be set once during 52 | * construction. 53 | */ 54 | constructor(string memory name_, string memory symbol_) { 55 | _name = name_; 56 | _symbol = symbol_; 57 | } 58 | 59 | /** 60 | * @dev Returns the name of the token. 61 | */ 62 | function name() public view virtual override returns (string memory) { 63 | return _name; 64 | } 65 | 66 | /** 67 | * @dev Returns the symbol of the token, usually a shorter version of the 68 | * name. 69 | */ 70 | function symbol() public view virtual override returns (string memory) { 71 | return _symbol; 72 | } 73 | 74 | /** 75 | * @dev Returns the number of decimals used to get its user representation. 76 | * For example, if `decimals` equals `2`, a balance of `505` tokens should 77 | * be displayed to a user as `5.05` (`505 / 10 ** 2`). 78 | * 79 | * Tokens usually opt for a value of 18, imitating the relationship between 80 | * Ether and Wei. This is the default value returned by this function, unless 81 | * it's overridden. 82 | * 83 | * NOTE: This information is only used for _display_ purposes: it in 84 | * no way affects any of the arithmetic of the contract, including 85 | * {IERC20-balanceOf} and {IERC20-transfer}. 86 | */ 87 | function decimals() public view virtual override returns (uint8) { 88 | return 18; 89 | } 90 | 91 | /** 92 | * @dev See {IERC20-totalSupply}. 93 | */ 94 | function totalSupply() public view virtual override returns (uint256) { 95 | return _totalSupply; 96 | } 97 | 98 | /** 99 | * @dev See {IERC20-balanceOf}. 100 | */ 101 | function balanceOf(address account) public view virtual override returns (uint256) { 102 | return _balances[account]; 103 | } 104 | 105 | /** 106 | * @dev See {IERC20-transfer}. 107 | * 108 | * Requirements: 109 | * 110 | * - `to` cannot be the zero address. 111 | * - the caller must have a balance of at least `amount`. 112 | */ 113 | function transfer(address to, uint256 amount) public virtual override returns (bool) { 114 | address owner = _msgSender(); 115 | _transfer(owner, to, amount); 116 | return true; 117 | } 118 | 119 | /** 120 | * @dev See {IERC20-allowance}. 121 | */ 122 | function allowance(address owner, address spender) public view virtual override returns (uint256) { 123 | return _allowances[owner][spender]; 124 | } 125 | 126 | /** 127 | * @dev See {IERC20-approve}. 128 | * 129 | * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on 130 | * `transferFrom`. This is semantically equivalent to an infinite approval. 131 | * 132 | * Requirements: 133 | * 134 | * - `spender` cannot be the zero address. 135 | */ 136 | function approve(address spender, uint256 amount) public virtual override returns (bool) { 137 | address owner = _msgSender(); 138 | _approve(owner, spender, amount); 139 | return true; 140 | } 141 | 142 | /** 143 | * @dev See {IERC20-transferFrom}. 144 | * 145 | * Emits an {Approval} event indicating the updated allowance. This is not 146 | * required by the EIP. See the note at the beginning of {ERC20}. 147 | * 148 | * NOTE: Does not update the allowance if the current allowance 149 | * is the maximum `uint256`. 150 | * 151 | * Requirements: 152 | * 153 | * - `from` and `to` cannot be the zero address. 154 | * - `from` must have a balance of at least `amount`. 155 | * - the caller must have allowance for ``from``'s tokens of at least 156 | * `amount`. 157 | */ 158 | function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { 159 | address spender = _msgSender(); 160 | _spendAllowance(from, spender, amount); 161 | _transfer(from, to, amount); 162 | return true; 163 | } 164 | 165 | /** 166 | * @dev Atomically increases the allowance granted to `spender` by the caller. 167 | * 168 | * This is an alternative to {approve} that can be used as a mitigation for 169 | * problems described in {IERC20-approve}. 170 | * 171 | * Emits an {Approval} event indicating the updated allowance. 172 | * 173 | * Requirements: 174 | * 175 | * - `spender` cannot be the zero address. 176 | */ 177 | function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { 178 | address owner = _msgSender(); 179 | _approve(owner, spender, allowance(owner, spender) + addedValue); 180 | return true; 181 | } 182 | 183 | /** 184 | * @dev Atomically decreases the allowance granted to `spender` by the caller. 185 | * 186 | * This is an alternative to {approve} that can be used as a mitigation for 187 | * problems described in {IERC20-approve}. 188 | * 189 | * Emits an {Approval} event indicating the updated allowance. 190 | * 191 | * Requirements: 192 | * 193 | * - `spender` cannot be the zero address. 194 | * - `spender` must have allowance for the caller of at least 195 | * `subtractedValue`. 196 | */ 197 | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { 198 | address owner = _msgSender(); 199 | uint256 currentAllowance = allowance(owner, spender); 200 | require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); 201 | unchecked { 202 | _approve(owner, spender, currentAllowance - subtractedValue); 203 | } 204 | 205 | return true; 206 | } 207 | 208 | /** 209 | * @dev Moves `amount` of tokens from `from` to `to`. 210 | * 211 | * This internal function is equivalent to {transfer}, and can be used to 212 | * e.g. implement automatic token fees, slashing mechanisms, etc. 213 | * 214 | * Emits a {Transfer} event. 215 | * 216 | * Requirements: 217 | * 218 | * - `from` cannot be the zero address. 219 | * - `to` cannot be the zero address. 220 | * - `from` must have a balance of at least `amount`. 221 | */ 222 | function _transfer(address from, address to, uint256 amount) internal virtual { 223 | require(from != address(0), "ERC20: transfer from the zero address"); 224 | require(to != address(0), "ERC20: transfer to the zero address"); 225 | 226 | _beforeTokenTransfer(from, to, amount); 227 | 228 | uint256 fromBalance = _balances[from]; 229 | require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); 230 | unchecked { 231 | _balances[from] = fromBalance - amount; 232 | // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by 233 | // decrementing then incrementing. 234 | _balances[to] += amount; 235 | } 236 | 237 | emit Transfer(from, to, amount); 238 | 239 | _afterTokenTransfer(from, to, amount); 240 | } 241 | 242 | /** @dev Creates `amount` tokens and assigns them to `account`, increasing 243 | * the total supply. 244 | * 245 | * Emits a {Transfer} event with `from` set to the zero address. 246 | * 247 | * Requirements: 248 | * 249 | * - `account` cannot be the zero address. 250 | */ 251 | function _mint(address account, uint256 amount) internal virtual { 252 | require(account != address(0), "ERC20: mint to the zero address"); 253 | 254 | _beforeTokenTransfer(address(0), account, amount); 255 | 256 | _totalSupply += amount; 257 | unchecked { 258 | // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. 259 | _balances[account] += amount; 260 | } 261 | emit Transfer(address(0), account, amount); 262 | 263 | _afterTokenTransfer(address(0), account, amount); 264 | } 265 | 266 | /** 267 | * @dev Destroys `amount` tokens from `account`, reducing the 268 | * total supply. 269 | * 270 | * Emits a {Transfer} event with `to` set to the zero address. 271 | * 272 | * Requirements: 273 | * 274 | * - `account` cannot be the zero address. 275 | * - `account` must have at least `amount` tokens. 276 | */ 277 | function _burn(address account, uint256 amount) internal virtual { 278 | require(account != address(0), "ERC20: burn from the zero address"); 279 | 280 | _beforeTokenTransfer(account, address(0), amount); 281 | 282 | uint256 accountBalance = _balances[account]; 283 | require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); 284 | unchecked { 285 | _balances[account] = accountBalance - amount; 286 | // Overflow not possible: amount <= accountBalance <= totalSupply. 287 | _totalSupply -= amount; 288 | } 289 | 290 | emit Transfer(account, address(0), amount); 291 | 292 | _afterTokenTransfer(account, address(0), amount); 293 | } 294 | 295 | /** 296 | * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. 297 | * 298 | * This internal function is equivalent to `approve`, and can be used to 299 | * e.g. set automatic allowances for certain subsystems, etc. 300 | * 301 | * Emits an {Approval} event. 302 | * 303 | * Requirements: 304 | * 305 | * - `owner` cannot be the zero address. 306 | * - `spender` cannot be the zero address. 307 | */ 308 | function _approve(address owner, address spender, uint256 amount) internal virtual { 309 | require(owner != address(0), "ERC20: approve from the zero address"); 310 | require(spender != address(0), "ERC20: approve to the zero address"); 311 | 312 | _allowances[owner][spender] = amount; 313 | emit Approval(owner, spender, amount); 314 | } 315 | 316 | /** 317 | * @dev Updates `owner` s allowance for `spender` based on spent `amount`. 318 | * 319 | * Does not update the allowance amount in case of infinite allowance. 320 | * Revert if not enough allowance is available. 321 | * 322 | * Might emit an {Approval} event. 323 | */ 324 | function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { 325 | uint256 currentAllowance = allowance(owner, spender); 326 | if (currentAllowance != type(uint256).max) { 327 | require(currentAllowance >= amount, "ERC20: insufficient allowance"); 328 | unchecked { 329 | _approve(owner, spender, currentAllowance - amount); 330 | } 331 | } 332 | } 333 | 334 | /** 335 | * @dev Hook that is called before any transfer of tokens. This includes 336 | * minting and burning. 337 | * 338 | * Calling conditions: 339 | * 340 | * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens 341 | * will be transferred to `to`. 342 | * - when `from` is zero, `amount` tokens will be minted for `to`. 343 | * - when `to` is zero, `amount` of ``from``'s tokens will be burned. 344 | * - `from` and `to` are never both zero. 345 | * 346 | * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. 347 | */ 348 | function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} 349 | 350 | /** 351 | * @dev Hook that is called after any transfer of tokens. This includes 352 | * minting and burning. 353 | * 354 | * Calling conditions: 355 | * 356 | * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens 357 | * has been transferred to `to`. 358 | * - when `from` is zero, `amount` tokens have been minted for `to`. 359 | * - when `to` is zero, `amount` of ``from``'s tokens have been burned. 360 | * - `from` and `to` are never both zero. 361 | * 362 | * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. 363 | */ 364 | function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} 365 | } 366 | -------------------------------------------------------------------------------- /contracts/artifacts/ExampleMsgSender.json: -------------------------------------------------------------------------------- 1 | { 2 | "deploy": { 3 | "VM:-": { 4 | "linkReferences": {}, 5 | "autoDeployLib": true 6 | }, 7 | "main:1": { 8 | "linkReferences": {}, 9 | "autoDeployLib": true 10 | }, 11 | "ropsten:3": { 12 | "linkReferences": {}, 13 | "autoDeployLib": true 14 | }, 15 | "rinkeby:4": { 16 | "linkReferences": {}, 17 | "autoDeployLib": true 18 | }, 19 | "kovan:42": { 20 | "linkReferences": {}, 21 | "autoDeployLib": true 22 | }, 23 | "goerli:5": { 24 | "linkReferences": {}, 25 | "autoDeployLib": true 26 | }, 27 | "Custom": { 28 | "linkReferences": {}, 29 | "autoDeployLib": true 30 | } 31 | }, 32 | "data": { 33 | "bytecode": { 34 | "functionDebugData": {}, 35 | "generatedSources": [], 36 | "linkReferences": {}, 37 | "object": "608060405234801561001057600080fd5b5061015b806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806326b85ee11461003b5780636e1d3c0914610059575b600080fd5b610043610063565b604051610050919061010a565b60405180910390f35b610061610087565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100f4826100c9565b9050919050565b610104816100e9565b82525050565b600060208201905061011f60008301846100fb565b9291505056fea2646970667358221220fa811ca83653bf4a04b5323ff4129bf39ea2e54d50f75466c6131c837893eaf764736f6c634300080e0033", 38 | "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15B 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 0x36 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x26B85EE1 EQ PUSH2 0x3B JUMPI DUP1 PUSH4 0x6E1D3C09 EQ PUSH2 0x59 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x43 PUSH2 0x63 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x50 SWAP2 SWAP1 PUSH2 0x10A JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x61 PUSH2 0x87 JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST CALLER PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xF4 DUP3 PUSH2 0xC9 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x104 DUP2 PUSH2 0xE9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x11F PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0xFB JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 STATICCALL DUP2 SHR 0xA8 CALLDATASIZE MSTORE8 0xBF 0x4A DIV 0xB5 ORIGIN EXTCODEHASH DELEGATECALL SLT SWAP12 RETURN SWAP15 LOG2 0xE5 0x4D POP 0xF7 SLOAD PUSH7 0xC6131C837893EA 0xF7 PUSH5 0x736F6C6343 STOP ADDMOD 0xE STOP CALLER ", 39 | "sourceMap": "162:226:0:-:0;;;;;;;;;;;;;;;;;;;" 40 | }, 41 | "deployedBytecode": { 42 | "functionDebugData": { 43 | "@myAddress_4": { 44 | "entryPoint": 99, 45 | "id": 4, 46 | "parameterSlots": 0, 47 | "returnSlots": 0 48 | }, 49 | "@setMyAddress_13": { 50 | "entryPoint": 135, 51 | "id": 13, 52 | "parameterSlots": 0, 53 | "returnSlots": 0 54 | }, 55 | "abi_encode_t_address_to_t_address_fromStack": { 56 | "entryPoint": 251, 57 | "id": null, 58 | "parameterSlots": 2, 59 | "returnSlots": 0 60 | }, 61 | "abi_encode_tuple_t_address__to_t_address__fromStack_reversed": { 62 | "entryPoint": 266, 63 | "id": null, 64 | "parameterSlots": 2, 65 | "returnSlots": 1 66 | }, 67 | "cleanup_t_address": { 68 | "entryPoint": 233, 69 | "id": null, 70 | "parameterSlots": 1, 71 | "returnSlots": 1 72 | }, 73 | "cleanup_t_uint160": { 74 | "entryPoint": 201, 75 | "id": null, 76 | "parameterSlots": 1, 77 | "returnSlots": 1 78 | } 79 | }, 80 | "generatedSources": [ 81 | { 82 | "ast": { 83 | "nodeType": "YulBlock", 84 | "src": "0:590:3", 85 | "statements": [ 86 | { 87 | "body": { 88 | "nodeType": "YulBlock", 89 | "src": "52:81:3", 90 | "statements": [ 91 | { 92 | "nodeType": "YulAssignment", 93 | "src": "62:65:3", 94 | "value": { 95 | "arguments": [ 96 | { 97 | "name": "value", 98 | "nodeType": "YulIdentifier", 99 | "src": "77:5:3" 100 | }, 101 | { 102 | "kind": "number", 103 | "nodeType": "YulLiteral", 104 | "src": "84:42:3", 105 | "type": "", 106 | "value": "0xffffffffffffffffffffffffffffffffffffffff" 107 | } 108 | ], 109 | "functionName": { 110 | "name": "and", 111 | "nodeType": "YulIdentifier", 112 | "src": "73:3:3" 113 | }, 114 | "nodeType": "YulFunctionCall", 115 | "src": "73:54:3" 116 | }, 117 | "variableNames": [ 118 | { 119 | "name": "cleaned", 120 | "nodeType": "YulIdentifier", 121 | "src": "62:7:3" 122 | } 123 | ] 124 | } 125 | ] 126 | }, 127 | "name": "cleanup_t_uint160", 128 | "nodeType": "YulFunctionDefinition", 129 | "parameters": [ 130 | { 131 | "name": "value", 132 | "nodeType": "YulTypedName", 133 | "src": "34:5:3", 134 | "type": "" 135 | } 136 | ], 137 | "returnVariables": [ 138 | { 139 | "name": "cleaned", 140 | "nodeType": "YulTypedName", 141 | "src": "44:7:3", 142 | "type": "" 143 | } 144 | ], 145 | "src": "7:126:3" 146 | }, 147 | { 148 | "body": { 149 | "nodeType": "YulBlock", 150 | "src": "184:51:3", 151 | "statements": [ 152 | { 153 | "nodeType": "YulAssignment", 154 | "src": "194:35:3", 155 | "value": { 156 | "arguments": [ 157 | { 158 | "name": "value", 159 | "nodeType": "YulIdentifier", 160 | "src": "223:5:3" 161 | } 162 | ], 163 | "functionName": { 164 | "name": "cleanup_t_uint160", 165 | "nodeType": "YulIdentifier", 166 | "src": "205:17:3" 167 | }, 168 | "nodeType": "YulFunctionCall", 169 | "src": "205:24:3" 170 | }, 171 | "variableNames": [ 172 | { 173 | "name": "cleaned", 174 | "nodeType": "YulIdentifier", 175 | "src": "194:7:3" 176 | } 177 | ] 178 | } 179 | ] 180 | }, 181 | "name": "cleanup_t_address", 182 | "nodeType": "YulFunctionDefinition", 183 | "parameters": [ 184 | { 185 | "name": "value", 186 | "nodeType": "YulTypedName", 187 | "src": "166:5:3", 188 | "type": "" 189 | } 190 | ], 191 | "returnVariables": [ 192 | { 193 | "name": "cleaned", 194 | "nodeType": "YulTypedName", 195 | "src": "176:7:3", 196 | "type": "" 197 | } 198 | ], 199 | "src": "139:96:3" 200 | }, 201 | { 202 | "body": { 203 | "nodeType": "YulBlock", 204 | "src": "306:53:3", 205 | "statements": [ 206 | { 207 | "expression": { 208 | "arguments": [ 209 | { 210 | "name": "pos", 211 | "nodeType": "YulIdentifier", 212 | "src": "323:3:3" 213 | }, 214 | { 215 | "arguments": [ 216 | { 217 | "name": "value", 218 | "nodeType": "YulIdentifier", 219 | "src": "346:5:3" 220 | } 221 | ], 222 | "functionName": { 223 | "name": "cleanup_t_address", 224 | "nodeType": "YulIdentifier", 225 | "src": "328:17:3" 226 | }, 227 | "nodeType": "YulFunctionCall", 228 | "src": "328:24:3" 229 | } 230 | ], 231 | "functionName": { 232 | "name": "mstore", 233 | "nodeType": "YulIdentifier", 234 | "src": "316:6:3" 235 | }, 236 | "nodeType": "YulFunctionCall", 237 | "src": "316:37:3" 238 | }, 239 | "nodeType": "YulExpressionStatement", 240 | "src": "316:37:3" 241 | } 242 | ] 243 | }, 244 | "name": "abi_encode_t_address_to_t_address_fromStack", 245 | "nodeType": "YulFunctionDefinition", 246 | "parameters": [ 247 | { 248 | "name": "value", 249 | "nodeType": "YulTypedName", 250 | "src": "294:5:3", 251 | "type": "" 252 | }, 253 | { 254 | "name": "pos", 255 | "nodeType": "YulTypedName", 256 | "src": "301:3:3", 257 | "type": "" 258 | } 259 | ], 260 | "src": "241:118:3" 261 | }, 262 | { 263 | "body": { 264 | "nodeType": "YulBlock", 265 | "src": "463:124:3", 266 | "statements": [ 267 | { 268 | "nodeType": "YulAssignment", 269 | "src": "473:26:3", 270 | "value": { 271 | "arguments": [ 272 | { 273 | "name": "headStart", 274 | "nodeType": "YulIdentifier", 275 | "src": "485:9:3" 276 | }, 277 | { 278 | "kind": "number", 279 | "nodeType": "YulLiteral", 280 | "src": "496:2:3", 281 | "type": "", 282 | "value": "32" 283 | } 284 | ], 285 | "functionName": { 286 | "name": "add", 287 | "nodeType": "YulIdentifier", 288 | "src": "481:3:3" 289 | }, 290 | "nodeType": "YulFunctionCall", 291 | "src": "481:18:3" 292 | }, 293 | "variableNames": [ 294 | { 295 | "name": "tail", 296 | "nodeType": "YulIdentifier", 297 | "src": "473:4:3" 298 | } 299 | ] 300 | }, 301 | { 302 | "expression": { 303 | "arguments": [ 304 | { 305 | "name": "value0", 306 | "nodeType": "YulIdentifier", 307 | "src": "553:6:3" 308 | }, 309 | { 310 | "arguments": [ 311 | { 312 | "name": "headStart", 313 | "nodeType": "YulIdentifier", 314 | "src": "566:9:3" 315 | }, 316 | { 317 | "kind": "number", 318 | "nodeType": "YulLiteral", 319 | "src": "577:1:3", 320 | "type": "", 321 | "value": "0" 322 | } 323 | ], 324 | "functionName": { 325 | "name": "add", 326 | "nodeType": "YulIdentifier", 327 | "src": "562:3:3" 328 | }, 329 | "nodeType": "YulFunctionCall", 330 | "src": "562:17:3" 331 | } 332 | ], 333 | "functionName": { 334 | "name": "abi_encode_t_address_to_t_address_fromStack", 335 | "nodeType": "YulIdentifier", 336 | "src": "509:43:3" 337 | }, 338 | "nodeType": "YulFunctionCall", 339 | "src": "509:71:3" 340 | }, 341 | "nodeType": "YulExpressionStatement", 342 | "src": "509:71:3" 343 | } 344 | ] 345 | }, 346 | "name": "abi_encode_tuple_t_address__to_t_address__fromStack_reversed", 347 | "nodeType": "YulFunctionDefinition", 348 | "parameters": [ 349 | { 350 | "name": "headStart", 351 | "nodeType": "YulTypedName", 352 | "src": "435:9:3", 353 | "type": "" 354 | }, 355 | { 356 | "name": "value0", 357 | "nodeType": "YulTypedName", 358 | "src": "447:6:3", 359 | "type": "" 360 | } 361 | ], 362 | "returnVariables": [ 363 | { 364 | "name": "tail", 365 | "nodeType": "YulTypedName", 366 | "src": "458:4:3", 367 | "type": "" 368 | } 369 | ], 370 | "src": "365:222:3" 371 | } 372 | ] 373 | }, 374 | "contents": "{\n\n function cleanup_t_uint160(value) -> cleaned {\n cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff)\n }\n\n function cleanup_t_address(value) -> cleaned {\n cleaned := cleanup_t_uint160(value)\n }\n\n function abi_encode_t_address_to_t_address_fromStack(value, pos) {\n mstore(pos, cleanup_t_address(value))\n }\n\n function abi_encode_tuple_t_address__to_t_address__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_address_to_t_address_fromStack(value0, add(headStart, 0))\n\n }\n\n}\n", 375 | "id": 3, 376 | "language": "Yul", 377 | "name": "#utility.yul" 378 | } 379 | ], 380 | "immutableReferences": {}, 381 | "linkReferences": {}, 382 | "object": "608060405234801561001057600080fd5b50600436106100365760003560e01c806326b85ee11461003b5780636e1d3c0914610059575b600080fd5b610043610063565b604051610050919061010a565b60405180910390f35b610061610087565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100f4826100c9565b9050919050565b610104816100e9565b82525050565b600060208201905061011f60008301846100fb565b9291505056fea2646970667358221220fa811ca83653bf4a04b5323ff4129bf39ea2e54d50f75466c6131c837893eaf764736f6c634300080e0033", 383 | "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x36 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x26B85EE1 EQ PUSH2 0x3B JUMPI DUP1 PUSH4 0x6E1D3C09 EQ PUSH2 0x59 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x43 PUSH2 0x63 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x50 SWAP2 SWAP1 PUSH2 0x10A JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x61 PUSH2 0x87 JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST CALLER PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xF4 DUP3 PUSH2 0xC9 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x104 DUP2 PUSH2 0xE9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x11F PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0xFB JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 STATICCALL DUP2 SHR 0xA8 CALLDATASIZE MSTORE8 0xBF 0x4A DIV 0xB5 ORIGIN EXTCODEHASH DELEGATECALL SLT SWAP12 RETURN SWAP15 LOG2 0xE5 0x4D POP 0xF7 SLOAD PUSH7 0xC6131C837893EA 0xF7 PUSH5 0x736F6C6343 STOP ADDMOD 0xE STOP CALLER ", 384 | "sourceMap": "162:226:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;195:24;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;226:160;;;:::i;:::-;;195:24;;;;;;;;;;;;:::o;226:160::-;279:10;267:9;;:22;;;;;;;;;;;;;;;;;;226:160::o;7:126:3:-;44:7;84:42;77:5;73:54;62:65;;7:126;;;:::o;139:96::-;176:7;205:24;223:5;205:24;:::i;:::-;194:35;;139:96;;;:::o;241:118::-;328:24;346:5;328:24;:::i;:::-;323:3;316:37;241:118;;:::o;365:222::-;458:4;496:2;485:9;481:18;473:26;;509:71;577:1;566:9;562:17;553:6;509:71;:::i;:::-;365:222;;;;:::o" 385 | }, 386 | "gasEstimates": { 387 | "creation": { 388 | "codeDepositCost": "69400", 389 | "executionCost": "117", 390 | "totalCost": "69517" 391 | }, 392 | "external": { 393 | "myAddress()": "2489", 394 | "setMyAddress()": "24410" 395 | } 396 | }, 397 | "methodIdentifiers": { 398 | "myAddress()": "26b85ee1", 399 | "setMyAddress()": "6e1d3c09" 400 | } 401 | }, 402 | "abi": [ 403 | { 404 | "inputs": [], 405 | "name": "myAddress", 406 | "outputs": [ 407 | { 408 | "internalType": "address", 409 | "name": "", 410 | "type": "address" 411 | } 412 | ], 413 | "stateMutability": "view", 414 | "type": "function" 415 | }, 416 | { 417 | "inputs": [], 418 | "name": "setMyAddress", 419 | "outputs": [], 420 | "stateMutability": "nonpayable", 421 | "type": "function" 422 | } 423 | ] 424 | } -------------------------------------------------------------------------------- /contracts/artifacts/Wallet.json: -------------------------------------------------------------------------------- 1 | { 2 | "deploy": { 3 | "VM:-": { 4 | "linkReferences": {}, 5 | "autoDeployLib": true 6 | }, 7 | "main:1": { 8 | "linkReferences": {}, 9 | "autoDeployLib": true 10 | }, 11 | "ropsten:3": { 12 | "linkReferences": {}, 13 | "autoDeployLib": true 14 | }, 15 | "rinkeby:4": { 16 | "linkReferences": {}, 17 | "autoDeployLib": true 18 | }, 19 | "kovan:42": { 20 | "linkReferences": {}, 21 | "autoDeployLib": true 22 | }, 23 | "goerli:5": { 24 | "linkReferences": {}, 25 | "autoDeployLib": true 26 | }, 27 | "Custom": { 28 | "linkReferences": {}, 29 | "autoDeployLib": true 30 | } 31 | }, 32 | "data": { 33 | "bytecode": { 34 | "functionDebugData": {}, 35 | "generatedSources": [], 36 | "linkReferences": {}, 37 | "object": "608060405234801561001057600080fd5b506101d1806100206000396000f3fe6080604052600436106100295760003560e01c806342f6487a1461002e578063ecb0b8621461005a575b600080fd5b34801561003a57600080fd5b50610043610064565b604051610051929190610172565b60405180910390f35b610062610096565b005b60008060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154905082565b60405180604001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001348152506000808201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155905050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061014382610118565b9050919050565b61015381610138565b82525050565b6000819050919050565b61016c81610159565b82525050565b6000604082019050610187600083018561014a565b6101946020830184610163565b939250505056fea2646970667358221220ba7098f63c6d7c74655aeec83c3688d084043d5ab0cdc0145f12bcf22c58687164736f6c634300080f0033", 38 | "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1D1 DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x29 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x42F6487A EQ PUSH2 0x2E JUMPI DUP1 PUSH4 0xECB0B862 EQ PUSH2 0x5A JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x43 PUSH2 0x64 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x51 SWAP3 SWAP2 SWAP1 PUSH2 0x172 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x62 PUSH2 0x96 JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 DUP1 PUSH1 0x1 ADD SLOAD SWAP1 POP DUP3 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD CALLVALUE DUP2 MSTORE POP PUSH1 0x0 DUP1 DUP3 ADD MLOAD DUP2 PUSH1 0x0 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH1 0x20 DUP3 ADD MLOAD DUP2 PUSH1 0x1 ADD SSTORE SWAP1 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x143 DUP3 PUSH2 0x118 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x153 DUP2 PUSH2 0x138 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x16C DUP2 PUSH2 0x159 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 DUP3 ADD SWAP1 POP PUSH2 0x187 PUSH1 0x0 DUP4 ADD DUP6 PUSH2 0x14A JUMP JUMPDEST PUSH2 0x194 PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x163 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xBA PUSH17 0x98F63C6D7C74655AEEC83C3688D084043D GAS 0xB0 0xCD 0xC0 EQ 0x5F SLT 0xBC CALLCODE 0x2C PC PUSH9 0x7164736F6C63430008 0xF STOP CALLER ", 39 | "sourceMap": "57:413:0:-:0;;;;;;;;;;;;;;;;;;;" 40 | }, 41 | "deployedBytecode": { 42 | "functionDebugData": { 43 | "@payContract_22": { 44 | "entryPoint": 150, 45 | "id": 22, 46 | "parameterSlots": 0, 47 | "returnSlots": 0 48 | }, 49 | "@payment_9": { 50 | "entryPoint": 100, 51 | "id": 9, 52 | "parameterSlots": 0, 53 | "returnSlots": 0 54 | }, 55 | "abi_encode_t_address_to_t_address_fromStack": { 56 | "entryPoint": 330, 57 | "id": null, 58 | "parameterSlots": 2, 59 | "returnSlots": 0 60 | }, 61 | "abi_encode_t_uint256_to_t_uint256_fromStack": { 62 | "entryPoint": 355, 63 | "id": null, 64 | "parameterSlots": 2, 65 | "returnSlots": 0 66 | }, 67 | "abi_encode_tuple_t_address_t_uint256__to_t_address_t_uint256__fromStack_reversed": { 68 | "entryPoint": 370, 69 | "id": null, 70 | "parameterSlots": 3, 71 | "returnSlots": 1 72 | }, 73 | "cleanup_t_address": { 74 | "entryPoint": 312, 75 | "id": null, 76 | "parameterSlots": 1, 77 | "returnSlots": 1 78 | }, 79 | "cleanup_t_uint160": { 80 | "entryPoint": 280, 81 | "id": null, 82 | "parameterSlots": 1, 83 | "returnSlots": 1 84 | }, 85 | "cleanup_t_uint256": { 86 | "entryPoint": 345, 87 | "id": null, 88 | "parameterSlots": 1, 89 | "returnSlots": 1 90 | } 91 | }, 92 | "generatedSources": [ 93 | { 94 | "ast": { 95 | "nodeType": "YulBlock", 96 | "src": "0:907:1", 97 | "statements": [ 98 | { 99 | "body": { 100 | "nodeType": "YulBlock", 101 | "src": "52:81:1", 102 | "statements": [ 103 | { 104 | "nodeType": "YulAssignment", 105 | "src": "62:65:1", 106 | "value": { 107 | "arguments": [ 108 | { 109 | "name": "value", 110 | "nodeType": "YulIdentifier", 111 | "src": "77:5:1" 112 | }, 113 | { 114 | "kind": "number", 115 | "nodeType": "YulLiteral", 116 | "src": "84:42:1", 117 | "type": "", 118 | "value": "0xffffffffffffffffffffffffffffffffffffffff" 119 | } 120 | ], 121 | "functionName": { 122 | "name": "and", 123 | "nodeType": "YulIdentifier", 124 | "src": "73:3:1" 125 | }, 126 | "nodeType": "YulFunctionCall", 127 | "src": "73:54:1" 128 | }, 129 | "variableNames": [ 130 | { 131 | "name": "cleaned", 132 | "nodeType": "YulIdentifier", 133 | "src": "62:7:1" 134 | } 135 | ] 136 | } 137 | ] 138 | }, 139 | "name": "cleanup_t_uint160", 140 | "nodeType": "YulFunctionDefinition", 141 | "parameters": [ 142 | { 143 | "name": "value", 144 | "nodeType": "YulTypedName", 145 | "src": "34:5:1", 146 | "type": "" 147 | } 148 | ], 149 | "returnVariables": [ 150 | { 151 | "name": "cleaned", 152 | "nodeType": "YulTypedName", 153 | "src": "44:7:1", 154 | "type": "" 155 | } 156 | ], 157 | "src": "7:126:1" 158 | }, 159 | { 160 | "body": { 161 | "nodeType": "YulBlock", 162 | "src": "184:51:1", 163 | "statements": [ 164 | { 165 | "nodeType": "YulAssignment", 166 | "src": "194:35:1", 167 | "value": { 168 | "arguments": [ 169 | { 170 | "name": "value", 171 | "nodeType": "YulIdentifier", 172 | "src": "223:5:1" 173 | } 174 | ], 175 | "functionName": { 176 | "name": "cleanup_t_uint160", 177 | "nodeType": "YulIdentifier", 178 | "src": "205:17:1" 179 | }, 180 | "nodeType": "YulFunctionCall", 181 | "src": "205:24:1" 182 | }, 183 | "variableNames": [ 184 | { 185 | "name": "cleaned", 186 | "nodeType": "YulIdentifier", 187 | "src": "194:7:1" 188 | } 189 | ] 190 | } 191 | ] 192 | }, 193 | "name": "cleanup_t_address", 194 | "nodeType": "YulFunctionDefinition", 195 | "parameters": [ 196 | { 197 | "name": "value", 198 | "nodeType": "YulTypedName", 199 | "src": "166:5:1", 200 | "type": "" 201 | } 202 | ], 203 | "returnVariables": [ 204 | { 205 | "name": "cleaned", 206 | "nodeType": "YulTypedName", 207 | "src": "176:7:1", 208 | "type": "" 209 | } 210 | ], 211 | "src": "139:96:1" 212 | }, 213 | { 214 | "body": { 215 | "nodeType": "YulBlock", 216 | "src": "306:53:1", 217 | "statements": [ 218 | { 219 | "expression": { 220 | "arguments": [ 221 | { 222 | "name": "pos", 223 | "nodeType": "YulIdentifier", 224 | "src": "323:3:1" 225 | }, 226 | { 227 | "arguments": [ 228 | { 229 | "name": "value", 230 | "nodeType": "YulIdentifier", 231 | "src": "346:5:1" 232 | } 233 | ], 234 | "functionName": { 235 | "name": "cleanup_t_address", 236 | "nodeType": "YulIdentifier", 237 | "src": "328:17:1" 238 | }, 239 | "nodeType": "YulFunctionCall", 240 | "src": "328:24:1" 241 | } 242 | ], 243 | "functionName": { 244 | "name": "mstore", 245 | "nodeType": "YulIdentifier", 246 | "src": "316:6:1" 247 | }, 248 | "nodeType": "YulFunctionCall", 249 | "src": "316:37:1" 250 | }, 251 | "nodeType": "YulExpressionStatement", 252 | "src": "316:37:1" 253 | } 254 | ] 255 | }, 256 | "name": "abi_encode_t_address_to_t_address_fromStack", 257 | "nodeType": "YulFunctionDefinition", 258 | "parameters": [ 259 | { 260 | "name": "value", 261 | "nodeType": "YulTypedName", 262 | "src": "294:5:1", 263 | "type": "" 264 | }, 265 | { 266 | "name": "pos", 267 | "nodeType": "YulTypedName", 268 | "src": "301:3:1", 269 | "type": "" 270 | } 271 | ], 272 | "src": "241:118:1" 273 | }, 274 | { 275 | "body": { 276 | "nodeType": "YulBlock", 277 | "src": "410:32:1", 278 | "statements": [ 279 | { 280 | "nodeType": "YulAssignment", 281 | "src": "420:16:1", 282 | "value": { 283 | "name": "value", 284 | "nodeType": "YulIdentifier", 285 | "src": "431:5:1" 286 | }, 287 | "variableNames": [ 288 | { 289 | "name": "cleaned", 290 | "nodeType": "YulIdentifier", 291 | "src": "420:7:1" 292 | } 293 | ] 294 | } 295 | ] 296 | }, 297 | "name": "cleanup_t_uint256", 298 | "nodeType": "YulFunctionDefinition", 299 | "parameters": [ 300 | { 301 | "name": "value", 302 | "nodeType": "YulTypedName", 303 | "src": "392:5:1", 304 | "type": "" 305 | } 306 | ], 307 | "returnVariables": [ 308 | { 309 | "name": "cleaned", 310 | "nodeType": "YulTypedName", 311 | "src": "402:7:1", 312 | "type": "" 313 | } 314 | ], 315 | "src": "365:77:1" 316 | }, 317 | { 318 | "body": { 319 | "nodeType": "YulBlock", 320 | "src": "513:53:1", 321 | "statements": [ 322 | { 323 | "expression": { 324 | "arguments": [ 325 | { 326 | "name": "pos", 327 | "nodeType": "YulIdentifier", 328 | "src": "530:3:1" 329 | }, 330 | { 331 | "arguments": [ 332 | { 333 | "name": "value", 334 | "nodeType": "YulIdentifier", 335 | "src": "553:5:1" 336 | } 337 | ], 338 | "functionName": { 339 | "name": "cleanup_t_uint256", 340 | "nodeType": "YulIdentifier", 341 | "src": "535:17:1" 342 | }, 343 | "nodeType": "YulFunctionCall", 344 | "src": "535:24:1" 345 | } 346 | ], 347 | "functionName": { 348 | "name": "mstore", 349 | "nodeType": "YulIdentifier", 350 | "src": "523:6:1" 351 | }, 352 | "nodeType": "YulFunctionCall", 353 | "src": "523:37:1" 354 | }, 355 | "nodeType": "YulExpressionStatement", 356 | "src": "523:37:1" 357 | } 358 | ] 359 | }, 360 | "name": "abi_encode_t_uint256_to_t_uint256_fromStack", 361 | "nodeType": "YulFunctionDefinition", 362 | "parameters": [ 363 | { 364 | "name": "value", 365 | "nodeType": "YulTypedName", 366 | "src": "501:5:1", 367 | "type": "" 368 | }, 369 | { 370 | "name": "pos", 371 | "nodeType": "YulTypedName", 372 | "src": "508:3:1", 373 | "type": "" 374 | } 375 | ], 376 | "src": "448:118:1" 377 | }, 378 | { 379 | "body": { 380 | "nodeType": "YulBlock", 381 | "src": "698:206:1", 382 | "statements": [ 383 | { 384 | "nodeType": "YulAssignment", 385 | "src": "708:26:1", 386 | "value": { 387 | "arguments": [ 388 | { 389 | "name": "headStart", 390 | "nodeType": "YulIdentifier", 391 | "src": "720:9:1" 392 | }, 393 | { 394 | "kind": "number", 395 | "nodeType": "YulLiteral", 396 | "src": "731:2:1", 397 | "type": "", 398 | "value": "64" 399 | } 400 | ], 401 | "functionName": { 402 | "name": "add", 403 | "nodeType": "YulIdentifier", 404 | "src": "716:3:1" 405 | }, 406 | "nodeType": "YulFunctionCall", 407 | "src": "716:18:1" 408 | }, 409 | "variableNames": [ 410 | { 411 | "name": "tail", 412 | "nodeType": "YulIdentifier", 413 | "src": "708:4:1" 414 | } 415 | ] 416 | }, 417 | { 418 | "expression": { 419 | "arguments": [ 420 | { 421 | "name": "value0", 422 | "nodeType": "YulIdentifier", 423 | "src": "788:6:1" 424 | }, 425 | { 426 | "arguments": [ 427 | { 428 | "name": "headStart", 429 | "nodeType": "YulIdentifier", 430 | "src": "801:9:1" 431 | }, 432 | { 433 | "kind": "number", 434 | "nodeType": "YulLiteral", 435 | "src": "812:1:1", 436 | "type": "", 437 | "value": "0" 438 | } 439 | ], 440 | "functionName": { 441 | "name": "add", 442 | "nodeType": "YulIdentifier", 443 | "src": "797:3:1" 444 | }, 445 | "nodeType": "YulFunctionCall", 446 | "src": "797:17:1" 447 | } 448 | ], 449 | "functionName": { 450 | "name": "abi_encode_t_address_to_t_address_fromStack", 451 | "nodeType": "YulIdentifier", 452 | "src": "744:43:1" 453 | }, 454 | "nodeType": "YulFunctionCall", 455 | "src": "744:71:1" 456 | }, 457 | "nodeType": "YulExpressionStatement", 458 | "src": "744:71:1" 459 | }, 460 | { 461 | "expression": { 462 | "arguments": [ 463 | { 464 | "name": "value1", 465 | "nodeType": "YulIdentifier", 466 | "src": "869:6:1" 467 | }, 468 | { 469 | "arguments": [ 470 | { 471 | "name": "headStart", 472 | "nodeType": "YulIdentifier", 473 | "src": "882:9:1" 474 | }, 475 | { 476 | "kind": "number", 477 | "nodeType": "YulLiteral", 478 | "src": "893:2:1", 479 | "type": "", 480 | "value": "32" 481 | } 482 | ], 483 | "functionName": { 484 | "name": "add", 485 | "nodeType": "YulIdentifier", 486 | "src": "878:3:1" 487 | }, 488 | "nodeType": "YulFunctionCall", 489 | "src": "878:18:1" 490 | } 491 | ], 492 | "functionName": { 493 | "name": "abi_encode_t_uint256_to_t_uint256_fromStack", 494 | "nodeType": "YulIdentifier", 495 | "src": "825:43:1" 496 | }, 497 | "nodeType": "YulFunctionCall", 498 | "src": "825:72:1" 499 | }, 500 | "nodeType": "YulExpressionStatement", 501 | "src": "825:72:1" 502 | } 503 | ] 504 | }, 505 | "name": "abi_encode_tuple_t_address_t_uint256__to_t_address_t_uint256__fromStack_reversed", 506 | "nodeType": "YulFunctionDefinition", 507 | "parameters": [ 508 | { 509 | "name": "headStart", 510 | "nodeType": "YulTypedName", 511 | "src": "662:9:1", 512 | "type": "" 513 | }, 514 | { 515 | "name": "value1", 516 | "nodeType": "YulTypedName", 517 | "src": "674:6:1", 518 | "type": "" 519 | }, 520 | { 521 | "name": "value0", 522 | "nodeType": "YulTypedName", 523 | "src": "682:6:1", 524 | "type": "" 525 | } 526 | ], 527 | "returnVariables": [ 528 | { 529 | "name": "tail", 530 | "nodeType": "YulTypedName", 531 | "src": "693:4:1", 532 | "type": "" 533 | } 534 | ], 535 | "src": "572:332:1" 536 | } 537 | ] 538 | }, 539 | "contents": "{\n\n function cleanup_t_uint160(value) -> cleaned {\n cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff)\n }\n\n function cleanup_t_address(value) -> cleaned {\n cleaned := cleanup_t_uint160(value)\n }\n\n function abi_encode_t_address_to_t_address_fromStack(value, pos) {\n mstore(pos, cleanup_t_address(value))\n }\n\n function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\n }\n\n function abi_encode_t_uint256_to_t_uint256_fromStack(value, pos) {\n mstore(pos, cleanup_t_uint256(value))\n }\n\n function abi_encode_tuple_t_address_t_uint256__to_t_address_t_uint256__fromStack_reversed(headStart , value1, value0) -> tail {\n tail := add(headStart, 64)\n\n abi_encode_t_address_to_t_address_fromStack(value0, add(headStart, 0))\n\n abi_encode_t_uint256_to_t_uint256_fromStack(value1, add(headStart, 32))\n\n }\n\n}\n", 540 | "id": 1, 541 | "language": "Yul", 542 | "name": "#utility.yul" 543 | } 544 | ], 545 | "immutableReferences": {}, 546 | "linkReferences": {}, 547 | "object": "6080604052600436106100295760003560e01c806342f6487a1461002e578063ecb0b8621461005a575b600080fd5b34801561003a57600080fd5b50610043610064565b604051610051929190610172565b60405180910390f35b610062610096565b005b60008060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154905082565b60405180604001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001348152506000808201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155905050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061014382610118565b9050919050565b61015381610138565b82525050565b6000819050919050565b61016c81610159565b82525050565b6000604082019050610187600083018561014a565b6101946020830184610163565b939250505056fea2646970667358221220ba7098f63c6d7c74655aeec83c3688d084043d5ab0cdc0145f12bcf22c58687164736f6c634300080f0033", 548 | "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x29 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x42F6487A EQ PUSH2 0x2E JUMPI DUP1 PUSH4 0xECB0B862 EQ PUSH2 0x5A JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x43 PUSH2 0x64 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x51 SWAP3 SWAP2 SWAP1 PUSH2 0x172 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x62 PUSH2 0x96 JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 DUP1 PUSH1 0x1 ADD SLOAD SWAP1 POP DUP3 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD CALLVALUE DUP2 MSTORE POP PUSH1 0x0 DUP1 DUP3 ADD MLOAD DUP2 PUSH1 0x0 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH1 0x20 DUP3 ADD MLOAD DUP2 PUSH1 0x1 ADD SSTORE SWAP1 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x143 DUP3 PUSH2 0x118 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x153 DUP2 PUSH2 0x138 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x16C DUP2 PUSH2 0x159 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 DUP3 ADD SWAP1 POP PUSH2 0x187 PUSH1 0x0 DUP4 ADD DUP6 PUSH2 0x14A JUMP JUMPDEST PUSH2 0x194 PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x163 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xBA PUSH17 0x98F63C6D7C74655AEEC83C3688D084043D GAS 0xB0 0xCD 0xC0 EQ 0x5F SLT 0xBC CALLCODE 0x2C PC PUSH9 0x7164736F6C63430008 0xF STOP CALLER ", 549 | "sourceMap": "57:413:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;164:36;;;;;;;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;207:261;;;:::i;:::-;;164:36;;;;;;;;;;;;;;;;;;;;;;;:::o;207:261::-;265:44;;;;;;;;287:10;265:44;;;;;;299:9;265:44;;;255:7;:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;207:261::o;7:126:1:-;44:7;84:42;77:5;73:54;62:65;;7:126;;;:::o;139:96::-;176:7;205:24;223:5;205:24;:::i;:::-;194:35;;139:96;;;:::o;241:118::-;328:24;346:5;328:24;:::i;:::-;323:3;316:37;241:118;;:::o;365:77::-;402:7;431:5;420:16;;365:77;;;:::o;448:118::-;535:24;553:5;535:24;:::i;:::-;530:3;523:37;448:118;;:::o;572:332::-;693:4;731:2;720:9;716:18;708:26;;744:71;812:1;801:9;797:17;788:6;744:71;:::i;:::-;825:72;893:2;882:9;878:18;869:6;825:72;:::i;:::-;572:332;;;;;:::o" 550 | }, 551 | "gasEstimates": { 552 | "creation": { 553 | "codeDepositCost": "93000", 554 | "executionCost": "141", 555 | "totalCost": "93141" 556 | }, 557 | "external": { 558 | "payContract()": "46596", 559 | "payment()": "4718" 560 | } 561 | }, 562 | "methodIdentifiers": { 563 | "payContract()": "ecb0b862", 564 | "payment()": "42f6487a" 565 | } 566 | }, 567 | "abi": [ 568 | { 569 | "inputs": [], 570 | "name": "payContract", 571 | "outputs": [], 572 | "stateMutability": "payable", 573 | "type": "function" 574 | }, 575 | { 576 | "inputs": [], 577 | "name": "payment", 578 | "outputs": [ 579 | { 580 | "internalType": "address", 581 | "name": "from", 582 | "type": "address" 583 | }, 584 | { 585 | "internalType": "uint256", 586 | "name": "amount", 587 | "type": "uint256" 588 | } 589 | ], 590 | "stateMutability": "view", 591 | "type": "function" 592 | } 593 | ] 594 | } --------------------------------------------------------------------------------