Skip to content

Instantly share code, notes, and snippets.

View artiomi's full-sized avatar

Artiom Iurcovschi artiomi

View GitHub Profile
@artiomi
artiomi / contracts...NestedCaller.sol
Created December 4, 2021 18:59
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.26+commit.4563c3fc.js&optimize=true&runs=200&gist=
pragma solidity ^0.4.22;
contract calledContract {
event callEvent(address sender, address origin, address from);
function calledFunction() public {
emit callEvent(msg.sender, tx.origin, this);
}
}
library calledLibrary {
@artiomi
artiomi / contracts...FaucetWithEvents.sol
Created December 3, 2021 06:04
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.26+commit.4563c3fc.js&optimize=true&runs=200&gist=
// Version of Solidity compiler this program was written for
pragma solidity ^0.4.22;
contract owned {
address owner;
// Contract constructor: set owner
constructor() public{
owner = msg.sender;
}
// Access control modifier
@artiomi
artiomi / contracts...Faucet2.sol
Created December 3, 2021 05:47
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.26+commit.4563c3fc.js&optimize=true&runs=200&gist=
pragma solidity ^0.4.22;
contract Faucet2{
address owner;
// Initialize Faucet contract: set owner
constructor() public {
owner = msg.sender;
}
@artiomi
artiomi / contracts...Faucet.sol
Created December 3, 2021 05:47
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.26+commit.4563c3fc.js&optimize=true&runs=200&gist=
pragma solidity 0.6.4;
// Our first contract is a faucet!
contract Faucet {
// Accept any incoming amount
receive() external payable {}
// Give out ether to anyone who asks
function withdraw(uint withdraw_amount) public {
// Limit withdrawal amount
@artiomi
artiomi / contracts...Faucet5.sol
Created December 3, 2021 05:46
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.26+commit.4563c3fc.js&optimize=true&runs=200&gist=
// SPDX-License-Identifier: CC-BY-SA-4.0
pragma solidity ^0.8.9;
contract Faucet5{
address payable owner;
// Initialize Faucet contract: set owner
constructor() {
owner = payable(msg.sender);
}
@artiomi
artiomi / contracts...Faucet4.sol
Created December 3, 2021 05:46
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.26+commit.4563c3fc.js&optimize=true&runs=200&gist=
// SPDX-License-Identifier: CC-BY-SA-4.0
pragma solidity ^0.8.9;
contract Faucet4{
address payable owner;
// Initialize Faucet contract: set owner
constructor() {
owner = payable(msg.sender);
}
@artiomi
artiomi / contracts...Faucet6.sol
Created December 3, 2021 05:46
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.26+commit.4563c3fc.js&optimize=true&runs=200&gist=
// SPDX-License-Identifier: CC-BY-SA-4.0
pragma solidity ^0.4.19;
contract Faucet6{
// Give out ether to anyone who asks
function withdraw(uint withdraw_amount) public {
// Limit withdrawal amount
@artiomi
artiomi / contracts...Faucet7.sol
Created December 3, 2021 05:45
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.26+commit.4563c3fc.js&optimize=true&runs=200&gist=
// SPDX-License-Identifier: CC-BY-SA-4.0
pragma solidity ^0.8.9;
contract Faucet7{
address payable owner;
// Initialize Faucet contract: set owner
constructor() {
owner = payable(msg.sender);
}
@artiomi
artiomi / lark_text_parser.py
Created July 12, 2019 08:57
Python text parser based on Lark library
from lark import Lark
tree_grammar = r"""
IDENTIFIER: ( LETTER | DIGIT | ".") +
string : ( WORD | expr | logic ) *
expr : "${" TARGETS ":" IDENTIFIER "}"
simple : expr OPERATIONS SIGNED_NUMBER
composed : "(" (expr | OPERATIONS | simple | composed)+ ")" //logical operations which can be composed from 'expr', 'OPERATIONS' ,'simple' ,'composed' expressions, which should occure at least once
logic : "$(" (expr | OPERATIONS | simple | composed)+ ")" //logical operations which can be composed from 'expr', 'OPERATIONS' ,'simple' ,'composed' expressions, which should occure at least once