Smart Contract Interface

The problem

Consumer-facing DeFi dashboards, wallets and & applications need to remain relevant in today’s fast moving landscape. But building smart contracts to improve engagement is risky and time-consuming.

The solution

The quickest and most predictable way to increase engagement is to enable seamless access to innovative opportunities for your users. Embedding these well-defined, easy to digest strategies directly into your customer-facing dapps creates new and compelling features that differentiate your product and maximize engagement.

DeFiZap Analytics platform provides aggregate insight into user behaviors, enabling you to evolve their offerings to maximize value-add.

Benefits

› Connect and increase engagement

Connect to and leverage battle-tested brands your users are already using daily in DeFi

› Be where your users are

Embed integrations seamlessly into your dapps, emails or website

› Extend your dapp’s functionality

Rapidly increase the functionality of your dapp with each new Zap integration

› Learn from user behavior

Analyze behavior to understand & prioritize which services to integrate next

ETH Mainnet

Contract

Description

Address

ABI

Unipool Remove Liquidity

Remove liquidity from Uniswap

0x4316e3aD83ca2Cf0ea5e3b25e3DE2fA7F93cfE9c

ABI

Unipool Add Liquidity With ETH

Add liquidity to Uniswap

0x97402249515994Cc0D22092D3375033Ad0ea438A

ABI

Unipool Add Liquidity With ERC20

Add liquidity to Uniswap

0x4f026054B9C934D92cD2db344ea1ae193A22067d

ABI

LLP General

Add Liquidity to Uniswap, Leverage Long 2X

0x705637f340667EE03EfDa280C8F054976A5DBAF6

ABI

Usage

Our contract interface uses the function 'LetsInvest()' for all Zap Ins.

Zapping In to the sETH Unipool With ETH

import Web3 from "web3";
// A copy of the contract ABI is required
import UniGenContract from "../UnipoolGeneralContract.json";
const UniGenAddress = "0x97402249515994Cc0D22092D3375033Ad0ea438A";
const sethAddress = "0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb";
const zapInWithEth = (value) =>{
const valueToSend = web3.utils.toWei((+value).toFixed(18), "ether");
const provider = window.ethereum || window.web3.currentProvider;
const [account] = await window.ethereum.enable();
web3 = new Web3(provider);
const contract = new web3.eth.Contract(UniGenContract, UniGenAddress);
tx = await contract.methods.LetsInvest(
sethAddress,
account // Recipient address (currently user's address)
);
tx.send({
from: account,
valueToSend
});
}

Zapping In to the sETH Unipool With DAI

import Web3 from "web3";
import erc20ZapABI from "./ERC20toUniPoolZapV1_GeneralABI"; // DeFiZap's ERC20 Zap In ABI
import daiTokenABI from "./daiTokenABI"; // ERC20 ABI
const erc20ZapAddress = "0xF0cd9981F15695324763A06869d1c1DD90073C2A";
const sethAddress = "0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb";
const daiAddress = "0x6B175474E89094C44Da98b954EedeAC495271d0F";
const zapInWithERC20 = async value => {
const provider = window.ethereum || window.web3.currentProvider;
const [account] = await window.ethereum.enable();
web3 = new Web3(provider);
const valueToSend = web3.utils.toWei((+value).toFixed(18), "ether");
// Instantiate ERC20 Zap In Contract
const erc20ZapContract = new web3.eth.Contract(erc20ZapABI, erc20ZapAddress);
// Instantiate DAI ERC20 Token Contract
const daiContract = new web3.eth.Contract(daiTokenABI, daiAddress);
// Check if the erc20ZapContract has approval to spend user's DAI, get approval if needed
let allowance = await daiContract.methods
.allowance(account, erc20ZapAddress)
.call({ from: account });
if (+allowance < valueToSend) {
let approveTx = await contract.methods.approve(
erc20ZapAddress,
web3.utils.toWei("100000000000000000000", "ether")
);
approveTx
.send({
from: account
})
// After approval TX has been sent, create TX Object for ERC20 Zap in
.on("transactionHash", async txHash => {
let tx;
tx = await erc20ZapContract.methods.LetsInvest(
account,
daiAddress,
valueToSend,
sethAddress
);
let gas = 900000; // Gas Estimation will fail due to pending approval TX
tx.send({
from: account,
gas
}).on("transactionHash", txHash => {
console.log(txHash);
});
});
// Approval for required DAI already exists, create TX object and send it with gas estimate
} else {
tx = await erc20ZapContract.methods.LetsInvest(
account,
daiAddress,
valueToSend,
sethAddress
);
const gas = await tx.estimateGas({
from: account
});
tx.send({
from: account,
gas
}).on("transactionHash", txHash => {
console.log(txHash);
});
}
};