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
[ | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": true, | |
"name": "previousOwner", | |
"type": "address" | |
}, | |
{ |
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`) |
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.6.6; | |
interface IERC20 { | |
function balanceOf(address) external view returns (uint); | |
function transfer(address, uint) external returns (bool); | |
} | |
contract Wallet { | |
function flush(address token) public { |
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 daiAddress = dsa.tokens.info.dai.address; | |
let flashloanAmount = "1000000000000000000000000"; | |
let spells = dsa.Spell(); | |
spells.add({ | |
connector: "instapool", | |
method: "flashBorrow", | |
args: [daiAddress, flashloanAmount, 0, 0] | |
}); |