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
[ | |
{ | |
"constant": true, | |
"inputs": [ | |
{ | |
"name": "", | |
"type": "uint256" | |
} | |
], | |
"name": "proposals", |
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 Tx = require('ethereumjs-tx'); | |
var Web3 = require('web3'); | |
var web3 = new Web3('https://ropsten.infura.io'); | |
const PRIVATE_KEY = Buffer.from('257C463ADDD55B757CCF109E4D7A3CC0E47F04D8EE591C4F7432C7501AC4C875', 'hex'); | |
const srcTokenAddress = '0x4BFBa4a8F28755Cb2061c413459EE562c6B9c51b'; // OMG Token Address | |
const srcTokenABI = [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"", |
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
// proxy.sol - execute actions atomically through the proxy's identity | |
// Copyright (C) 2017 DappHub, LLC | |
// This program is free software: you can redistribute it and/or modify | |
// it under the terms of the GNU General Public License as published by | |
// the Free Software Foundation, either version 3 of the License, or | |
// (at your option) any later version. | |
// This program is distributed in the hope that it will be useful, |
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
// starting up a dapp | |
window.addEventListener('load', async () => { | |
if (window.ethereum) { // Modern dapp browsers... | |
window.web3 = new Web3(ethereum); | |
try { | |
await ethereum.enable(); // Request account access if needed | |
} catch (error) { | |
console.log('User denied permission to use their Ethereum account.'); | |
} | |
} else if (window.web3) { // Legacy dapp browsers... |
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 { web3 } = require("./config"); | |
const BN = require('bignumber.js'); | |
const ABI = [{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": false, | |
"name": "cdpNum", | |
"type": "uint256" |
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 Tx = require('ethereumjs-tx').Transaction; | |
var Web3 = require('web3'); | |
var web3 = new Web3('https://mainnet.infura.io/e7110a9c35184df68d54b09f8a5f1199'); | |
const PRIVATE_KEY = Buffer.from('11986EC9BD99AD706D84A7A77760B4DE665571F39C4CFBFBAFBD9585A586A0C3', 'hex'); | |
const myAddress = "0xB7fA44c2E964B6EB24893f7082Ecc08c8d0c0F87"; | |
var registryAddress = "0x498b3bfabe9f73db90d252bcd4fa9548cd0fd981"; | |
var registryABI = [{"constant":true,"inputs":[{"name":"_logicAddress","type":"address"}],"name":"logic","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_logicAddress","type":"address"}],"name":"enableStaticLogic","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"logicProxies","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"logi |
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
require('dotenv').config() | |
const Tx = require('ethereumjs-tx').Transaction; | |
const Web3 = require('web3'); | |
const web3 = new Web3(new Web3.providers.HttpProvider(process.env.INFURA_ETH_NODE_URL)) | |
const WALLET_PRIVATE_KEY = Buffer.from(process.env.WALLET_PRIVATE_KEY, 'hex'); | |
const WALLET_ADDRESS = process.env.WALLET_ADDRESS | |
var BUILD_ADDRESS = "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723"; | |
var BUILD_ABI = [{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"accountVersion","type":"uint256"},{"internalType":"address","name":"_origin","type":"address"}],"name":"build","outputs":[{"internalType":"address","name":"_account","type":"address"}],"stateMutability":"nonpayable","type":"function"}]; |
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
let token1 = "0x..." | |
let token2 = "0x..." | |
let token3 = "0x..." | |
let amount = 0 // set amount to transfer | |
let to = "0x..." // target address to withdraw | |
spells.add({ | |
connector: "basic", | |
method: "deposit", | |
args: [token1, amount, getId, setId] |
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
require('dotenv').config() | |
const Web3 = require('web3') | |
const DSA = require("dsa-sdk"); | |
const web3 = new Web3(new Web3.providers.HttpProvider(process.env.INFURA_ETH_NODE_URL)) | |
const dsa = new DSA({ | |
web3: web3, | |
mode: "node", | |
privateKey: process.env.WALLET_PRIVATE_KEY | |
}); |
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
dsa.estimateCastGas({ | |
spells: spells, | |
value: 0, | |
nonce: txCount | |
}) | |
.then(gasLimit => { | |
console.log(gasLimit); | |
}) | |
.catch(err => { | |
return console.error(`This transaction is likely to fail if sent to blockchain`) |