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 etherscan import Etherscan | |
import os | |
import json | |
from time import sleep | |
# setup | |
ethscan = Etherscan('YOUR_API_KEY_HERE') | |
# NOTE: must be a multi-verified contract to work. Staked Aave used as example here | |
address = "0x4da27a545c0c5b758a6ba100e3a049001de870f5" |
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
const { ethers } = require("ethers"); | |
BigNumber = ethers.BigNumber | |
module.exports = { | |
WAD: ethers.utils.parseUnits('1'), | |
//rounds to zero if x*y < WAD / 2 | |
wmul: function(x, y) { | |
return x.mul(y).add(WAD.div(2)).div(WAD); | |
}, |
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
# cd ~/.geth/ | |
# Add following script here | |
# Create ~/.geth/keys, ~/geth/dev | |
# Add keys 0.txt,1.txt..N.txt, and passwords.txt, with each line in passwords.txt representing password for that account | |
# import into ~/geth/dev: geth account import --datadir ~/.geth/chain ~/.geth/dev/0.txt etc., enter same password |
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) { |
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
// 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
// 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
/* | |
(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
//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
// 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 |