✅오늘 뭐했니?
- Flashot: https://buff.ly/45OAgwT
- DeFiRanger: https://buff.ly/3MGCkOx
- Curve Math: https://buff.ly/3OKY6TN
- Maximizing Extractable Value from Automated Market Makers: https://buff.ly/3qiiiCF
- Empirical Evidence from four Governance Token Distributions: https://buff.ly/3OEGusW
- Measuring Asset Composability as a Proxy for DeFi Integration: https://buff.ly/3C20Cxr
- From banks to DeFi: the evolution of the lending market: https://buff.ly/3qiiim9
- SoK: Decentralized Finance (DeFi): https://buff.ly/3C20C0p
- Attacking the DeFi Ecosystem with Flash Loans for Fun and Profit: https://buff.ly/3P2IVG3
- MakerDAO whitepaper (stables lending): https://buff.ly/3MGCl53
- Compound whitepaper (money markets): https://buff.ly/45OAh3V
- Aave whitepaper (lending pools): https://buff.ly/3C20CgV
- Frax whitepaper (algo stablecoin): https://buff.ly/3MHcA4r
- Curve intro (stables DEX, steeper AMM): https://buff.ly/3OGZS8J
- Liquidations: DeFi on a Knife-edge: https://buff.ly/3OJbjN2
- Cyclic Arbitrage in Decentralized Exchange Markets: https://buff.ly/3MDD72U
- Governance issues at DEXs (the “Curve Wars”): https://buff.ly/3qiiiTb
- The Decentralized Financial Crisis: https://buff.ly/45OAhAX
- Dynamic Curves for Decentralized Autonomous Cryptocurrency Exchanges: https://buff.ly/3C20CNX
- High-Frequency Trading on Decentralized On-Chain Exchanges: https://buff.ly/45OAhkr
- Behavior of Liquidity Providers in Decentralized Exchanges: https://buff.ly/45OAi7Z
- Blockchain Oracle Design Patterns: https://buff.ly/3OL7ved
- SoK: Oracles from the Ground Truth to Market Manipulation: https://buff.ly/3OHfGIz
- Tokenizing real-world assets primer: https://buff.ly/45OAjc3
- The Adoption of Blockchain-based Decentralized Exchanges: https://buff.ly/45OAhRt
- An analysis of Uniswap markets: https://buff.ly/3MDD7jq
- Finance 4.0: Design principles for a value-sensitive cryptoecnomic system to address sustainability: https://buff.ly/45OAiF1
- Composing Networks of Automated Market Makers: https://buff.ly/45OAiov
- DEX business models & moats: https://buff.ly/3OJHVWU
- Original Tether whitepaper: https://buff.ly/3C20D4t
import React from "react";
import { useEffect, useState } from "react";
import Web3 from "web3";
import { ethers } from "ethers";
function App() {
const [blockNumber, setBlockNumber] = useState();
const [balance, setBalance] = useState();
const [account, setAccount] = useState();
const [chainId, setChainId] = useState();
const web3 = new Web3("wss://goerli.infura.io/ws/v3/c9272c6607724aa08e2432def393cb43");
async function connect() {
if(window.ethereum) {
try {
const res = await window.ethereum.request({
method : "eth_requestAccounts",
});
setAccount(res[0]);
getBalance()
} catch(err) {
console.error(err);
}
} else {
console.log("Install metamask");
}
}
useEffect(()=>{
async function getBlock() {
const blockNumber = await web3.eth.getBlockNumber();
setBlockNumber(Number(blockNumber));
}
getBlock();
})
async function getBalance() {
const res = await window.ethereum.request({
method : "eth_requestAccounts",
});
if(account) {
const _balance = await window.ethereum.request({
method : "eth_getBalance",
params : [res[0].toString(), "latest"]
});
setBalance(ethers.formatEther(_balance));
} else {
console.log("wallet is not connected");
}
}
useEffect(()=> {
getBalance();
async function subscribeBlock() {
const subscription = await web3.eth.subscribe("newHeads");
subscription.on("data", async(blockHead) => {
setBlockNumber(Number(blockHead.number));
});
}
subscribeBlock();
})
async function getChainId() {
if(window.ethereum) {
const ID = await window.ethereum.request({
method : "eth_chainId",
});
setChainId(ID);
}
}
getChainId();
async function chainChanged() {
if(window.ethereum) {
setAccount(null);
setBalance(null);
connect();
getChainId();
}
}
useEffect(()=> {
if(window.ethereum) {
window.ethereum.on("chainChanged", chainChanged)
}
})
useEffect(()=> {
if(window.ethereum) {
window.ethereum.on("accountsChanged", connect)
}
})
async function sendTx(e) {
e.preventDefault();
const data = new FormData(e.target);
console.log(typeof(data.get("amount")));
var a = web3.utils.numberToHex(Number(data.get("amount")));
console.log(a, typeof(a));
await window.ethereum.request({
method : "eth_sendTransaction",
params : [{from : account, to : data.get("address"), value : a}]
})
}
return (
<div className="App">
<div onClick={()=>{connect();}}>CONNECT WALLET</div>
<li>current Block number : {blockNumber}</li>
<li>current Address : {account}</li>
<li>currnet balance : {balance} eth</li>
<li>current chainId : {chainId} </li>
<form onSubmit={sendTx}>
<input type="text" name="address" placeholder="write address"></input>
<input type="text" name="amount" placeholder="write amount"></input>
<button type="submit">Send TX</button>
</form>
</div>
);
}
export default App;
import React from "react";
import { useEffect, useState } from "react";
import Web3 from "web3";
import { ethers } from "ethers";
import abi from './abi.json';
function App() {
const [blockNumber, setBlockNumber] = useState();
const [balance, setBalance] = useState();
const [account, setAccount] = useState();
const [chainId, setChainId] = useState();
const [tbalance, setTbalance] = useState();
const web3 = new Web3("wss://goerli.infura.io/ws/v3/02a93bfdcfab460c97fe7ece41eb38d5");
const web3_2 = new Web3("https://goerli.infura.io/v3/02a93bfdcfab460c97fe7ece41eb38d5");
var c_addr = '0xf7389e84220FF1165842e38C8e92772846e61A9d';
var contract = new web3_2.eth.Contract(abi, c_addr);
async function connect() {
if(window.ethereum) {
try {
const res = await window.ethereum.request({
method : "eth_requestAccounts",
});
setAccount(res[0]);
getBalance()
getTbalance();
} catch(err) {
console.error(err);
}
} else {
console.log("Install metamask");
}
}
async function getTbalance() {
if(account) {
try {
var a = await contract.methods.balanceOf(account).call()
setTbalance(a);
} catch(err) {
console.error(err);
}
} else {
console.log("connect the wallet");
}
}
useEffect(()=>{
async function getBlock() {
const blockNumber = await web3.eth.getBlockNumber();
setBlockNumber(Number(blockNumber));
}
getBlock();
})
async function getBalance() {
const res = await window.ethereum.request({
method : "eth_requestAccounts",
});
if(account) {
const _balance = await window.ethereum.request({
method : "eth_getBalance",
params : [res[0].toString(), "latest"]
});
setBalance(ethers.formatEther(_balance));
} else {
console.log("wallet is not connected");
}
}
useEffect(()=> {
async function subscribeBlock() {
const subscription = await web3.eth.subscribe("newHeads");
subscription.on("data", async(blockHead) => {
setBlockNumber(Number(blockHead.number));
});
}
subscribeBlock();
getTbalance();
getBalance();
})
async function getChainId() {
if(window.ethereum) {
const ID = await window.ethereum.request({
method : "eth_chainId",
});
setChainId(ID);
}
}
getChainId();
async function chainChanged() {
if(window.ethereum) {
setAccount(null);
setBalance(null);
connect();
getChainId();
}
}
useEffect(()=> {
if(window.ethereum) {
window.ethereum.on("chainChanged", chainChanged)
}
})
useEffect(()=> {
if(window.ethereum) {
window.ethereum.on("accountsChanged", connect)
}
})
async function sendTx(e) {
e.preventDefault();
const data = new FormData(e.target);
console.log(typeof(data.get("amount")));
var a = web3.utils.numberToHex(Number(data.get("amount")));
console.log(a, typeof(a));
await window.ethereum.request({
method : "eth_sendTransaction",
params : [{from : account, to : data.get("address"), value : a}]
})
}
async function sendERC(e) {
e.preventDefault();
const data = new FormData(e.target);
var a = web3.utils.numberToHex(Number(data.get("amount_2")));
await window.ethereum.request({
method : "eth_sendTransaction",
params : [{from : account, to : c_addr, data : contract.methods.transfer(data.get("address_2"), a).encodeABI()}]
})
}
return (
<div className="App">
<div onClick={()=>{connect();}}>CONNECT WALLET</div>
<li>current Block number : {blockNumber}</li>
<li>current Address : {account}</li>
<li>currnet balance : {balance} eth</li>
<li>current token balance : {tbalance} </li>
<li>current chainId : {chainId} </li>
<form onSubmit={sendTx}>
<input type="text" name="address" placeholder="write address"></input>
<input type="text" name="amount" placeholder="write amount"></input>
<button type="submit">Send TX</button>
</form>
<form onSubmit={sendERC}>
<input type="text" name="address_2" placeholder="write address"></input>
<input type="text" name="amount_2" placeholder="write amount"></input>
<button type="submit">Send ERC</button>
</form>
</div>
);
}
export default App;
import React from "react";
import { useEffect, useState } from "react";
import Web3 from "web3";
import { ethers } from "ethers";
import abi from './abi.json';
import abi2 from './abi2.json';
function App() {
const [blockNumber, setBlockNumber] = useState();
const [balance, setBalance] = useState();
const [account, setAccount] = useState();
const [chainId, setChainId] = useState();
const [tbalance, setTbalance] = useState();
const web3 = new Web3("wss://goerli.infura.io/ws/v3/02a93bfdcfab460c97fe7ece41eb38d5");
const web3_2 = new Web3("https://goerli.infura.io/v3/02a93bfdcfab460c97fe7ece41eb38d5");
var c_addr = '0xf7389e84220FF1165842e38C8e92772846e61A9d';
var c_addr_2 = '0x127c6Abf99a85f8852352Bf269ad1073b6F21417';
var contract = new web3_2.eth.Contract(abi, c_addr);
var contract2 = new web3_2.eth.Contract(abi2, c_addr_2);
async function connect() {
if(window.ethereum) {
try {
const res = await window.ethereum.request({
method : "eth_requestAccounts",
});
setAccount(res[0]);
getBalance()
getTbalance();
} catch(err) {
console.error(err);
}
} else {
console.log("Install metamask");
}
}
async function getTbalance() {
if(account) {
try {
var a = await contract2.methods.balanceOf(account).call()
setTbalance(a);
} catch(err) {
console.error(err);
}
} else {
console.log("connect the wallet");
}
}
useEffect(()=>{
async function getBlock() {
const blockNumber = await web3.eth.getBlockNumber();
setBlockNumber(Number(blockNumber));
}
getBlock();
})
async function getBalance() {
const res = await window.ethereum.request({
method : "eth_requestAccounts",
});
if(account) {
const _balance = await window.ethereum.request({
method : "eth_getBalance",
params : [res[0].toString(), "latest"]
});
setBalance(ethers.formatEther(_balance));
} else {
console.log("wallet is not connected");
}
}
useEffect(()=> {
async function subscribeBlock() {
const subscription = await web3.eth.subscribe("newHeads");
subscription.on("data", async(blockHead) => {
setBlockNumber(Number(blockHead.number));
});
}
subscribeBlock();
getTbalance();
getBalance();
})
async function getChainId() {
if(window.ethereum) {
const ID = await window.ethereum.request({
method : "eth_chainId",
});
setChainId(ID);
}
}
getChainId();
async function chainChanged() {
if(window.ethereum) {
setAccount(null);
setBalance(null);
connect();
getChainId();
}
}
useEffect(()=> {
if(window.ethereum) {
window.ethereum.on("chainChanged", chainChanged)
}
})
useEffect(()=> {
if(window.ethereum) {
window.ethereum.on("accountsChanged", connect)
}
})
async function sendTx(e) {
e.preventDefault();
const data = new FormData(e.target);
console.log(typeof(data.get("amount")));
var a = web3.utils.numberToHex(Number(data.get("amount")));
console.log(a, typeof(a));
await window.ethereum.request({
method : "eth_sendTransaction",
params : [{from : account, to : data.get("address"), value : a}]
})
}
async function sendERC(e) {
e.preventDefault();
const data = new FormData(e.target);
var a = web3.utils.numberToHex(Number(data.get("amount_2")));
await window.ethereum.request({
method : "eth_sendTransaction",
params : [{from : account, to : c_addr_2, data : contract2.methods.transfer(data.get("address_2"), a).encodeABI()}]
})
}
async function minting(e) {
e.preventDefault();
const data = new FormData(e.target);
var a = web3.utils.numberToHex(Number(data.get("amount_3")));
var b = web3.utils.numberToHex(Number(data.get("amount_3"))*10000);
await window.ethereum.request({
method : "eth_sendTransaction",
params : [{
from : account,
to : c_addr_2,
value : b,
data : contract2.methods.MintToken(a).encodeABI()
}]
})
}
return (
<div className="App">
<div onClick={()=>{connect();}}>CONNECT WALLET</div>
<li>current Block number : {blockNumber}</li>
<li>current Address : {account}</li>
<li>currnet balance : {balance} eth</li>
<li>current token balance : {tbalance} </li>
<li>current chainId : {chainId} </li>
<form onSubmit={sendTx}>
<input type="text" name="address" placeholder="write address"></input>
<input type="text" name="amount" placeholder="write amount"></input>
<button type="submit">Send TX</button>
</form>
<form onSubmit={sendERC}>
<input type="text" name="address_2" placeholder="write address"></input>
<input type="text" name="amount_2" placeholder="write amount"></input>
<button type="submit">Send ERC</button>
</form>
<form onSubmit={minting}>
<input type="text" name="amount_3" placeholder="write amount"></input>
<button type="submit">Mint</button>
</form>
</div>
);
}
export default App;