commit
e0cd663967
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,4 @@ |
|||||||
|
{ |
||||||
|
"_format": "hh-sol-dbg-1", |
||||||
|
"buildInfo": "../../build-info/7839ba878952cc00ff316061405f273a.json" |
||||||
|
} |
@ -0,0 +1,74 @@ |
|||||||
|
{ |
||||||
|
"_format": "hh-sol-artifact-1", |
||||||
|
"contractName": "Lock", |
||||||
|
"sourceName": "contracts/Lock.sol", |
||||||
|
"abi": [ |
||||||
|
{ |
||||||
|
"inputs": [ |
||||||
|
{ |
||||||
|
"internalType": "uint256", |
||||||
|
"name": "_unlockTime", |
||||||
|
"type": "uint256" |
||||||
|
} |
||||||
|
], |
||||||
|
"stateMutability": "payable", |
||||||
|
"type": "constructor" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"anonymous": false, |
||||||
|
"inputs": [ |
||||||
|
{ |
||||||
|
"indexed": false, |
||||||
|
"internalType": "uint256", |
||||||
|
"name": "amount", |
||||||
|
"type": "uint256" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"indexed": false, |
||||||
|
"internalType": "uint256", |
||||||
|
"name": "when", |
||||||
|
"type": "uint256" |
||||||
|
} |
||||||
|
], |
||||||
|
"name": "Withdrawal", |
||||||
|
"type": "event" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"inputs": [], |
||||||
|
"name": "owner", |
||||||
|
"outputs": [ |
||||||
|
{ |
||||||
|
"internalType": "address payable", |
||||||
|
"name": "", |
||||||
|
"type": "address" |
||||||
|
} |
||||||
|
], |
||||||
|
"stateMutability": "view", |
||||||
|
"type": "function" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"inputs": [], |
||||||
|
"name": "unlockTime", |
||||||
|
"outputs": [ |
||||||
|
{ |
||||||
|
"internalType": "uint256", |
||||||
|
"name": "", |
||||||
|
"type": "uint256" |
||||||
|
} |
||||||
|
], |
||||||
|
"stateMutability": "view", |
||||||
|
"type": "function" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"inputs": [], |
||||||
|
"name": "withdraw", |
||||||
|
"outputs": [], |
||||||
|
"stateMutability": "nonpayable", |
||||||
|
"type": "function" |
||||||
|
} |
||||||
|
], |
||||||
|
"bytecode": "0x60806040526040516105e13803806105e1833981810160405281019061002591906100f9565b804210610067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161005e906101a9565b60405180910390fd5b60006206ef9190508160008190555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050506101c9565b600080fd5b6000819050919050565b6100d6816100c3565b81146100e157600080fd5b50565b6000815190506100f3816100cd565b92915050565b60006020828403121561010f5761010e6100be565b5b600061011d848285016100e4565b91505092915050565b600082825260208201905092915050565b7f556e6c6f636b2074696d652073686f756c6420626520696e207468652066757460008201527f7572650000000000000000000000000000000000000000000000000000000000602082015250565b6000610193602383610126565b915061019e82610137565b604082019050919050565b600060208201905081810360008301526101c281610186565b9050919050565b610409806101d86000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063251c1aa3146100465780633ccfd60b146100645780638da5cb5b1461006e575b600080fd5b61004e61008c565b60405161005b919061024a565b60405180910390f35b61006c610092565b005b61007661020b565b60405161008391906102a6565b60405180910390f35b60005481565b6000544210156100d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100ce9061031e565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161015e9061038a565b60405180910390fd5b7fbf2ed60bd5b5965d685680c01195c9514e4382e28e3a5a2d2d5244bf59411b9347426040516101989291906103aa565b60405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610208573d6000803e3d6000fd5b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000819050919050565b61024481610231565b82525050565b600060208201905061025f600083018461023b565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061029082610265565b9050919050565b6102a081610285565b82525050565b60006020820190506102bb6000830184610297565b92915050565b600082825260208201905092915050565b7f596f752063616e27742077697468647261772079657400000000000000000000600082015250565b60006103086016836102c1565b9150610313826102d2565b602082019050919050565b60006020820190508181036000830152610337816102fb565b9050919050565b7f596f75206172656e277420746865206f776e6572000000000000000000000000600082015250565b60006103746014836102c1565b915061037f8261033e565b602082019050919050565b600060208201905081810360008301526103a381610367565b9050919050565b60006040820190506103bf600083018561023b565b6103cc602083018461023b565b939250505056fea264697066735822122036a0d1608af22fc2fc867e67c4fede260661a25d94e8d38a0f76a2324a7cebe564736f6c63430008110033", |
||||||
|
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063251c1aa3146100465780633ccfd60b146100645780638da5cb5b1461006e575b600080fd5b61004e61008c565b60405161005b919061024a565b60405180910390f35b61006c610092565b005b61007661020b565b60405161008391906102a6565b60405180910390f35b60005481565b6000544210156100d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100ce9061031e565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161015e9061038a565b60405180910390fd5b7fbf2ed60bd5b5965d685680c01195c9514e4382e28e3a5a2d2d5244bf59411b9347426040516101989291906103aa565b60405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610208573d6000803e3d6000fd5b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000819050919050565b61024481610231565b82525050565b600060208201905061025f600083018461023b565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061029082610265565b9050919050565b6102a081610285565b82525050565b60006020820190506102bb6000830184610297565b92915050565b600082825260208201905092915050565b7f596f752063616e27742077697468647261772079657400000000000000000000600082015250565b60006103086016836102c1565b9150610313826102d2565b602082019050919050565b60006020820190508181036000830152610337816102fb565b9050919050565b7f596f75206172656e277420746865206f776e6572000000000000000000000000600082015250565b60006103746014836102c1565b915061037f8261033e565b602082019050919050565b600060208201905081810360008301526103a381610367565b9050919050565b60006040820190506103bf600083018561023b565b6103cc602083018461023b565b939250505056fea264697066735822122036a0d1608af22fc2fc867e67c4fede260661a25d94e8d38a0f76a2324a7cebe564736f6c63430008110033", |
||||||
|
"linkReferences": {}, |
||||||
|
"deployedLinkReferences": {} |
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
// SPDX-License-Identifier: UNLICENSED |
||||||
|
pragma solidity ^0.8.13; |
||||||
|
|
||||||
|
contract Counter { |
||||||
|
uint256 public number; |
||||||
|
|
||||||
|
function setNumber(uint256 newNumber) public { |
||||||
|
number = newNumber; |
||||||
|
} |
||||||
|
|
||||||
|
function increment() public { |
||||||
|
number++; |
||||||
|
} |
||||||
|
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
|||||||
|
{"_format":"hh-sol-dbg-1","buildInfo":"../../build-info/7839ba878952cc00ff316061405f273a.json","default":{"_format":"hh-sol-dbg-1","buildInfo":"../../build-info/7839ba878952cc00ff316061405f273a.json"}} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,17 @@ |
|||||||
|
|
||||||
|
{ |
||||||
|
"language": "Solidity", |
||||||
|
"settings": { |
||||||
|
"optimizer": { |
||||||
|
"enabled": true, |
||||||
|
"runs": 200 |
||||||
|
}, |
||||||
|
"outputSelection": { |
||||||
|
"*": { |
||||||
|
"": ["ast"], |
||||||
|
"*": ["abi", "metadata", "devdoc", "userdoc", "storageLayout", "evm.legacyAssembly", "evm.bytecode", "evm.deployedBytecode", "evm.methodIdentifiers", "evm.gasEstimates", "evm.assembly"] |
||||||
|
} |
||||||
|
}, |
||||||
|
"evmVersion": "byzantium" |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
// SPDX-License-Identifier: UNLICENSED |
||||||
|
pragma solidity ^0.8.9; |
||||||
|
|
||||||
|
// Uncomment this line to use console.log |
||||||
|
// import "hardhat/console.sol"; |
||||||
|
|
||||||
|
contract Lock { |
||||||
|
uint public unlockTime; |
||||||
|
address payable public owner; |
||||||
|
|
||||||
|
event Withdrawal(uint amount, uint when); |
||||||
|
|
||||||
|
constructor(uint _unlockTime) payable { |
||||||
|
require( |
||||||
|
block.timestamp < _unlockTime, |
||||||
|
"Unlock time should be in the future" |
||||||
|
); |
||||||
|
uint p = 454545; |
||||||
|
unlockTime = _unlockTime; |
||||||
|
owner = payable(msg.sender); |
||||||
|
} |
||||||
|
|
||||||
|
function withdraw() public { |
||||||
|
// Uncomment this line, and the import of "hardhat/console.sol", to print a log in your terminal |
||||||
|
// console.log("Unlock time is %o and block timestamp is %o", unlockTime, block.timestamp); |
||||||
|
|
||||||
|
require(block.timestamp >= unlockTime, "You can't withdraw yet"); |
||||||
|
require(msg.sender == owner, "You aren't the owner"); |
||||||
|
|
||||||
|
emit Withdrawal(address(this).balance, block.timestamp); |
||||||
|
|
||||||
|
owner.transfer(address(this).balance); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
// SPDX-License-Identifier: MIT |
||||||
|
// pragma solidity >=0.4.22 <0.8.0; |
||||||
|
|
||||||
|
contract Migrations { |
||||||
|
address public owner = msg.sender; |
||||||
|
uint public last_completed_migration; |
||||||
|
modifier restricted() { |
||||||
|
require( |
||||||
|
msg.sender == owner, |
||||||
|
"This function is restricted to the contract's owner" |
||||||
|
); |
||||||
|
_; |
||||||
|
} |
||||||
|
|
||||||
|
function setCompleted(uint completed) public restricted { |
||||||
|
last_completed_migration = completed; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue