Skip to content

Instantly share code, notes, and snippets.

View glaksmono's full-sized avatar

Grady Laksmono glaksmono

View GitHub Profile
@glaksmono
glaksmono / MemeToken.sol
Created February 12, 2022 01: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.8.0+commit.c7dfd78e.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
import "https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol";
contract MemeToken is ERC20 {
constructor(string memory _name, string memory _symbol, uint8 _decimals) ERC20 (_name, _symbol, _decimals) {
// Creating shitcoin
}
@glaksmono
glaksmono / contracts...EventExample.sol
Created August 26, 2021 09:21
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.5.13+commit.5b0b510c.js&optimize=false&runs=200&gist=
pragma solidity ^0.5.11;
contract EventExample {
mapping(address => uint) public tokenBalance;
event TokensSent(address _from, address _to, uint _amount);
constructor() public {
tokenBalance[msg.sender] = 100;
@glaksmono
glaksmono / contracts...Owned.sol
Created August 22, 2021 08:50
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.5.13+commit.5b0b510c.js&optimize=false&runs=200&gist=
pragma solidity ^0.5.11;
contract Owned {
address owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
@glaksmono
glaksmono / contracts...InheritanceModifierExample.sol
Created August 22, 2021 08:50
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.5.13+commit.5b0b510c.js&optimize=false&runs=200&gist=
pragma solidity ^0.5.11;
import "./Owned.sol";
contract InheritanceModifierExample is Owned {
mapping(address => uint) public tokenBalance;
uint tokenPrice = 1 ether;
@glaksmono
glaksmono / contracts...FunctionExample.sol
Created August 22, 2021 08: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.5.13+commit.5b0b510c.js&optimize=false&runs=200&gist=
pragma solidity ^0.5.13;
contract FunctionExample {
mapping(address => uint) public balanceReceived;
address payable owner;
constructor() public {
owner = msg.sender;
@glaksmono
glaksmono / contracts...TryCatchExample.sol
Created August 22, 2021 02: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.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
//SPDX-License-Idenfitier: MIT
pragma solidity 0.8.4;
contract WillThrow {
function aFunction() public {
require (false, "Error message Test");
}
}
@glaksmono
glaksmono / contracts...IntegerExample.sol
Created August 21, 2021 08:11
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.6.0+commit.26b70077.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.1;
contract IntegerExample {
uint public myUint;
}
@glaksmono
glaksmono / contracts...artifacts...ExceptionExample.sol
Created August 21, 2021 08: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.6.0+commit.26b70077.js&optimize=false&runs=200&gist=
pragma solidity ^0.5.13;
contract ExceptionExample {
mapping(address => uint64) public balanceReceived;
function receiveMoney() public payable {
assert(balanceReceived[msg.sender] + uint64(msg.value) >= balanceReceived[msg.sender]);
balanceReceived[msg.sender] += uint64(msg.value);
}
@glaksmono
glaksmono / contracts...artifacts...SimpleMappingExample.sol
Created August 21, 2021 08: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.6.0+commit.26b70077.js&optimize=false&runs=200&gist=
pragma solidity ^0.6.0;
contract SimpleMappingExample {
mapping(uint => bool) public myMapping;
mapping(address => bool) public myAddressMapping;
mapping(uint => mapping(uint => bool)) uintUintBoolMapping;
@glaksmono
glaksmono / contracts...artifacts...StartStopUpdateExample.sol
Created August 21, 2021 08: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.6.0+commit.26b70077.js&optimize=false&runs=200&gist=
pragma solidity ^0.5.13;
contract StartStopUpdateExample {
address owner;
bool paused;
constructor() public {
owner = msg.sender;