Skip to content

Instantly share code, notes, and snippets.

@jamadei
jamadei / contracts...IDCard.sol
Created October 24, 2025 13:56
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.30+commit.73712a01.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: CC-BY-1.0
// Creative Commons Attribution 1.0 Generic
// Contract will be compiled on version 0.7.0 or greater
pragma solidity ^0.8.0;
// A smart contract to model an Id Card
contract IdCard {
string public constant CONTRACT_AUTHOR = 'Marco Amadei';
@jamadei
jamadei / contracts...artifacts...Oracle.sol
Created October 9, 2024 05:13
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.26+commit.8a97fa7a.js&optimize=false&runs=200&gist=
pragma solidity >=0.4.22 <0.9.0;
contract Oracle {
struct Request {
bytes data;
function(uint) external callback;
}
Request[] requests;
event NewRequest(uint index);
function query(bytes memory data, function(uint) external callback) public {
requests.push(Request(data, callback));
@jamadei
jamadei / contracts...ReceiveExample.sol
Created September 25, 2024 13:10
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.26+commit.8a97fa7a.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.7;
import "hardhat/console.sol";
contract ReceiveEther {
/*ppp */
event Called(string fun);
/*
Which function is called, fallback() or receive()?
@jamadei
jamadei / contracts...ReceiveExample.sol
Created September 25, 2024 13:08
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.26+commit.8a97fa7a.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.7;
import "hardhat/console.sol";
contract ReceiveEther {
/*ppp */
event Called(string fun);
/*
Which function is called, fallback() or receive()?
@jamadei
jamadei / contracts...2_Owner.sol
Created September 25, 2024 13:05
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.26+commit.8a97fa7a.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "hardhat/console.sol";
/**
* @title Owner
* @dev Set & change owner
*/
@jamadei
jamadei / contracts...IDCard.sol
Created September 25, 2024 13:00
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.26+commit.8a97fa7a.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: CC-BY-1.0
// Creative Commons Attribution 1.0 Generic
// Contract will be compiled on version 0.7.0 or greater
pragma solidity ^0.8.0;
// A smart contract to model an Id Card
contract IdCard {
string public constant CONTRACT_AUTHOR = 'Marco Amadei';
@jamadei
jamadei / contracts...Ered.sol
Created October 14, 2022 14:51
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: CC-BY-1.0
// Creative Commons Attribution 1.0 Generic
pragma solidity >=0.8.0 <0.9.0;
abstract contract Parent1 {
enum Answer {A,B,C,D}
uint[] public results ;
constructor (uint[3]
@jamadei
jamadei / contracts...OracleExample.sol
Created September 21, 2022 14:32
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.0+commit.c7dfd78e.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;
contract Oracle {
struct Request {
bytes data;
function(uint) external callback;
}
Request[] private requests;
event NewRequest(uint);
function query(bytes memory data, function(uint) external callback) public {
@jamadei
jamadei / contracts...Factory.sol
Created September 21, 2022 07:24
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.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: CC-BY-1.0
// Creative Commons Attribution 1.0 Generic
// Contract will be compiled on version 0.7.0 or greater
pragma solidity ^0.8.0;
contract Utility {
// The owner of the current instance of this smart contract
address owner;
// Event which will be raised anytime the current id information is updated.
@jamadei
jamadei / contracts...Factory.sol
Created September 20, 2022 16:26
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: CC-BY-1.0
// Creative Commons Attribution 1.0 Generic
// Contract will be compiled on version 0.7.0 or greater
pragma solidity ^0.8.0;
contract Utility {
// The owner of the current instance of this smart contract
address owner;
// Event which will be raised anytime the current id information is updated.