This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import pdb | |
import time | |
import sys | |
BUY = 0 | |
SELL = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Wrapper for built-in BigNumber_modexp (contract 0x5) as described here. https://github.com/ethereum/EIPs/pull/198 | |
function modexp(bytes memory _base, bytes memory _exp, bytes memory _mod) internal view returns(bytes memory ret) { | |
assembly { | |
let bl := mload(_base) | |
let el := mload(_exp) | |
let ml := mload(_mod) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import time | |
import hashlib | |
import hmac | |
import requests | |
key = "API_KEY" | |
secret = "SECRET_KEY" | |
nonce = str(int(time() * 1000)) | |
#sign and call the url. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// setup ethers.js, sends an instance of a struct to an external function, and returns it the instance values. | |
//load in node: .load ~/path/to/file/ethers_setup.js | |
//first run testrpc locally. | |
var privkey = "0x{privkey}" //insert privkey from testrpc here | |
//dependancies | |
var solc = require('solc') //include solc application | |
var fs = require('fs') //include node file manipulation module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//to accompany ethers_structs.js | |
pragma solidity 0.4.21; | |
pragma experimental ABIEncoderV2; | |
contract TestContract { | |
struct SubStruct { | |
uint256 id; | |
string description; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
(Extension of the main answer for the question here - https://stackoverflow.com/questions/11370908/how-do-i-use-minizip-on-zlib) | |
* Creates a ZIP file - | |
after specifying an absolute path to a "root" directory, all filepaths derived from this path are stored in the ZIP file, | |
with only files and their paths from the root preserved. | |
eg. root path: /a/b/c/d/ | |
filepaths(from root path): e/f.txt | |
g.dat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install @apollo/client node-fetch apollo-link-http | |
// node account_liquidity_uniswap.js | |
apolloClient = require('@apollo/client') | |
fetch = require('node-fetch') | |
httpLink = require('apollo-link-http') | |
ApolloClient = apolloClient.ApolloClient | |
HttpLink = httpLink.HttpLink | |
InMemoryCache = apolloClient.InMemoryCache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install axios | |
// node account_liquidity_balancer.js | |
axios = require('axios') | |
// variables | |
const poolId = "0xd3d14de568990854705c40221f75efbad8c0c981"; | |
const userAddress = "0x64a63ef1b19519be8afb9080e5725bd608d6f389"; | |
async function getPool(poolId, userAddress) { | |
const response = await axios({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.0; | |
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.3.0/contracts/token/ERC20/ERC20.sol"; | |
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.3.0/contracts/token/ERC20/ERC20Detailed.sol"; | |
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.3.0/contracts/ownership/Ownable.sol"; | |
contract Token is ERC20, ERC20Detailed, Ownable { | |
string private _name = "DAOMaker Token"; | |
string private _symbol = "DAO"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ethers = require('ethers'); | |
// ganache deterministic mnemonic | |
const mnemonic = 'myth like bonus scare over problem client lizard pioneer submit female collect'; | |
// use last funded account | |
const account = "m/44'/60'/0'/0/9"; | |
// default ganache provider | |
const provider = new ethers.providers.JsonRpcProvider("http://127.0.0.1:8545"); | |
function getRandomInt(min, max) { |
OlderNewer