Skip to content

Instantly share code, notes, and snippets.

View critesjosh's full-sized avatar
🥸

josh crites critesjosh

🥸
View GitHub Profile
@critesjosh
critesjosh / ThrowErrorExample.sol
Last active March 14, 2018 15:25
How to correctly throw errors in Solidity
pragma solidity ^0.4.0;
contract ThrowErrorExample {
bool isTrue = true;
uint num = 1;
//Bad code, do not emulate
function silentFail() public view returns (uint){
if(isTrue != true){
@critesjosh
critesjosh / SimpleStorage.sol
Last active May 12, 2018 13:53
A simple storage contract
// deployed to the Rinkeby network @ 0x4103e048515a5ebdf34b32ed7692254a16c6d184
pragma solidity ^0.4.0;
contract SimpleStorage {
uint256 storedData;
uint256 public timesSet;
address public lastCaller;
event Updated(uint newValue);
@critesjosh
critesjosh / Greeter.sol
Created May 14, 2018 21:49
Two greeter contracts. One referencing a library, the other not.
pragma solidity ^0.4.0;
contract GreeterA {
string greeting;
uint count;
address[] greeted;
function GreeterA(string _greeting) {
greeting = _greeting;
}
@critesjosh
critesjosh / Optimized.sol
Created May 17, 2018 14:03
Optimizations to the Unoptimized.sol contract
pragma solidity ^0.4.0;
contract Optimized {
bool oftenTrue = true;
bool oftenFalse = false;
uint loops = 0;
bytes32 constant statictext = "Hello world";
@critesjosh
critesjosh / Unoptimized.sol
Last active May 17, 2018 14:03
An unoptimized solidity contract
pragma solidity ^0.4.0;
contract Unoptimized {
bool oftenTrue = true;
bool oftenFalse = false;
uint loops = 0;
string greeting;
3Box is a social profiles network for web3. This post links my 3Box profile to my Github account!
✅ did:muport:Qma2o5oqaVY9hdyNKpdCfGCutgWiotrL9mN3aPWFjnZ8kN ✅
Create your profile today to start building social connection and trust online. https://3box.io/

Keybase proof

I hereby claim:

  • I am critesjosh on github.
  • I am critesjosh (https://keybase.io/critesjosh) on keybase.
  • I have a public key ASALHa0sxv6oOg3lRoNaBG2hCwHcVMGGUiXAbF4L-p0bFgo

To claim this, I am signing this object:

pragma solidity ^0.5.0;
import "http://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
contract ERC20Lockable is ERC20 {
mapping (address => uint) unlockTime;
mapping (address => bool) isLocked;
uint lockDuration = 1000;
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:muport:QmaBNA6ykghaKJVkLob3fiNtNF25EURzQUu7dez2dyi67y ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
{
"contractName": "SimpleStorage",
"abi": [
{
"constant": false,
"inputs": [
{
"name": "x",
"type": "uint256"
}