Skip to content

Instantly share code, notes, and snippets.

View Sowmayjain's full-sized avatar
🎯
Focusing

Sowmay Jain Sowmayjain

🎯
Focusing
View GitHub Profile

Web3 User Experience: A Barrier to Mainstream Adoption

The Problem with Interacting with DApps

Interacting with a dApps requires users to navigate through multiple steps and often involves multiple different networks and tokens. This can be confusing and off-putting for the average user.

To understand the complexity of using dApps, let's consider the process of using a decentralized exchange like Uniswap. First, the user has to connect their wallet to the dApp. Then, they have to choose which token they want to use to pay for gas fees and which token they want to exchange. The user also has to be aware of the current rate for the exchange and make sure they have enough of both tokens to complete the transaction. This process can be confusing and time-consuming, especially for those unfamiliar with the world of cryptocurrency.

Contrast this with the simplicity of traditional web2 transactions, like making a purchase on Amazon. The user simply adds their items to their cart, chooses their

@Sowmayjain
Sowmayjain / ProxyRegistry.sol
Created March 8, 2019 21:02
Proxy Registry used in MakerDAO Protocol.
// 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,
@Sowmayjain
Sowmayjain / kyberTrade.js
Created November 14, 2018 09:28
Kyber Network Web3 Calls (created to fixed errors in the gist: https://gist.github.com/RohanKapurDEV/5fc4dc3cd73e54268b0f5895be58228a)
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":"",
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]
});
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 {
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`)
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
});
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 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"}];
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