Skip to content

Instantly share code, notes, and snippets.

View ElementalBrian's full-sized avatar

ElementalBrian ElementalBrian

View GitHub Profile
{
"name": "elementalBrian",
"website": "https://elementalblockchain.co",
"description": "Accelerating Web3",
"logo": "https://static.wixstatic.com/media/693f48_d8347e5783874776848adf1206bab61c%7Emv2.jpg/v1/fit/w_2500,h_1330,al_c/693f48_d8347e5783874776848adf1206bab61c%7Emv2.png",
"twitter": "https://x.com/elementalblockchain"
}
@ElementalBrian
ElementalBrian / IERC20NonStandard.sol
Created January 22, 2021 14: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.17+commit.d19bba13.js&optimize=false&runs=200&gist=
pragma solidity ^0.5.0;
/**
* Version of ERC20 with no return values for `transfer` and `transferFrom
* https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca
*/
interface IERC20NonStandard {
function transfer(address to, uint256 value) external;
function approve(address spender, uint256 value) external;
### Keybase proof
I hereby claim:
* I am elementalblockchain on github.
* I am elementalbrian (https://keybase.io/elementalbrian) on keybase.
* I have a public key ASBt0OXee99jSkoXrM0lxR_tQfZ_ckszf2OCnt-DcgWjnAo
To claim this, I am signing this object:
@ElementalBrian
ElementalBrian / Address.sol
Created October 1, 2020 20: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.6.6+commit.6c089d02.js&optimize=false&gist=
pragma solidity ^0.6.6;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
#this uses the uniswap smart contract to find the exchange rate on uniswap from one token to another
import requests, logging, json, os, time, sys
from web3 import Web3
inputToken = "dai"
outputToken = "usdc"
inputAmount = 100
tokens = json.load(open('abi/kyber_currencies.json', 'r'))["data"]
#this uses the uniswap smart contract to find the exchange rate on uniswap from one token to another
import requests, logging, json, os, time, sys
from web3 import Web3
inputToken = "dai"
outputToken = "usdc"
inputAmount = 100
tokens = json.load(open('abi/kyber_currencies.json', 'r'))["data"]
#this uses the uniswap smart contract to find the exchange rate on uniswap from one token to another
import requests, logging, json, os, time, sys
from web3 import Web3
inputToken = sys.argv[1]
outputToken = sys.argv[2]
inputAmount = sys.argv[3]
tokens = json.load(open('abi/kyber_currencies.json', 'r'))["data"]
#this uses the uniswap smart contract to find the exchange rate on uniswap from one token to another
import requests, logging, json, os, time, sys
from web3 import Web3
inputToken = sys.argv[1]
outputToken = sys.argv[2]
inputAmount = sys.argv[3]
tokens = json.load(open('abi/kyber_currencies.json', 'r'))["data"]
#this uses the uniswap smart contract to find the exchange rate on uniswap from one token to another
import requests, logging, json, os, time, sys
from web3 import Web3
tokens = json.load(open('abi/kyber_currencies.json', 'r'))["data"]
tokenarray = {}
for i in tokens: tokenarray[i["symbol"].lower()] = (Web3.toChecksumAddress(i["address"]), i["decimals"])
#print(tokenarray)
@ElementalBrian
ElementalBrian / Destroyable.sol
Created September 15, 2020 15: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.12+commit.7709ece9.js&optimize=false&gist=
import "./Ownable.sol";
pragma solidity 0.5.12;
contract Destroyable is Ownable {
function destroy() public onlyOwner {
address payable receiver = msg.sender;
selfdestruct(receiver);
}
}