Skip to content

Instantly share code, notes, and snippets.

View ElementalBrian's full-sized avatar

ElementalBrian ElementalBrian

View GitHub Profile
@ElementalBrian
ElementalBrian / Destroyable.sol
Created August 19, 2020 16:49
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=
pragma solidity 0.5.12;
contract Destroyable{
}
@ElementalBrian
ElementalBrian / Destroyable.sol
Created August 19, 2020 16:55
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 close() public onlyOwner { //onlyOwner is custom modifier
address payable ownerpayable = address(uint160(owner));
selfdestruct(ownerpayable); // `owner` is the owners address
}
}
@ElementalBrian
ElementalBrian / Destroyable.sol
Created August 19, 2020 17: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.5.12+commit.7709ece9.js&optimize=false&gist=
import "./Ownable.sol";
pragma solidity 0.5.12;
contract Destroyable is Ownable{
function close() public onlyOwner { //onlyOwner is custom modifier
address payable ownerpayable = address(uint160(owner));
selfdestruct(ownerpayable); // `owner` is the owners address
}
}
@ElementalBrian
ElementalBrian / Destroyable.sol
Created August 20, 2020 19: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 close() public onlyOwner { //onlyOwner is custom modifier
address payable ownerpayable = address(uint160(owner));
selfdestruct(ownerpayable); // `owner` is the owners address
}
}
@ElementalBrian
ElementalBrian / Destroyable.sol
Created August 21, 2020 15:20
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 close() public onlyOwner { //onlyOwner is custom modifier
address payable ownerpayable = address(uint160(owner));
selfdestruct(ownerpayable); // `owner` is the owners address
}
}
@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);
}
}
#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)
#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
inputToken = "dai"
outputToken = "usdc"
inputAmount = 100
tokens = json.load(open('abi/kyber_currencies.json', 'r'))["data"]