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

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
const { web3 } = require("./config");
const BN = require('bignumber.js');
const ABI = [{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "cdpNum",
"type": "uint256"
// 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...