Skip to content

Instantly share code, notes, and snippets.

View Sowmayjain's full-sized avatar
🎯
Focusing

Sowmay Jain Sowmayjain

🎯
Focusing
View GitHub Profile
@Sowmayjain
Sowmayjain / BlockEther ABI
Last active May 1, 2018 05:59
ABI JSON file of BlockEther
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "previousOwner",
"type": "address"
},
{
// 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...
const { web3 } = require("./config");
const BN = require('bignumber.js');
const ABI = [{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "cdpNum",
"type": "uint256"
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
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"}];
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]
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
});
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`)
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 {
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]
});