First edits made like in the video.

This commit is contained in:
StockiP
2022-11-01 17:04:55 +01:00
parent 5e9d67bef4
commit 9fdfe8b23f
31 changed files with 69943 additions and 12522 deletions

55511
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -9,10 +9,6 @@
], ],
"private": true, "private": true,
"scripts": { "scripts": {
"subgraph:auth": "yarn workspace @my-app/subgraph auth",
"subgraph:codegen": "yarn workspace @my-app/subgraph codegen",
"subgraph:build": "yarn workspace @my-app/subgraph build",
"subgraph:deploy": "yarn workspace @my-app/subgraph deploy",
"react-app:build": "yarn workspace @my-app/react-app build", "react-app:build": "yarn workspace @my-app/react-app build",
"react-app:eject": "yarn workspace @my-app/react-app eject", "react-app:eject": "yarn workspace @my-app/react-app eject",
"react-app:ipfs": "yarn workspace @my-app/react-app ipfs", "react-app:ipfs": "yarn workspace @my-app/react-app ipfs",
@@ -23,5 +19,8 @@
"packages": [ "packages": [
"packages/*" "packages/*"
] ]
},
"resolutions": {
"react-error-overlay": "6.0.9"
} }
} }

View File

@@ -1,9 +1,13 @@
import erc20Abi from "./abis/erc20.json"; import erc20 from "./abis/erc20.json";
import ownableAbi from "./abis/ownable.json"; import factory from "./abis/factory.json";
import pair from "./abis/pair.json";
import router01 from "./abis/router01.json";
import router02 from "./abis/router02.json";
const abis = { export default {
erc20: erc20Abi, erc20,
ownable: ownableAbi, factory,
pair,
router01,
router02,
}; };
export default abis;

View File

@@ -1,222 +1,693 @@
[ {
{ "abi": [
"constant": true, {
"inputs": [], "anonymous": false,
"name": "name", "inputs": [
"outputs": [ {
{ "indexed": true,
"name": "", "internalType": "address",
"type": "string" "name": "owner",
} "type": "address"
], },
"payable": false, {
"stateMutability": "view", "indexed": true,
"type": "function" "internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"constant": true,
"inputs": [],
"name": "DOMAIN_SEPARATOR",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "PERMIT_TYPEHASH",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "pure",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "pure",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "pure",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "nonces",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "deadline",
"type": "uint256"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"name": "permit",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "pure",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
],
"evm": {
"bytecode": {
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
}
}, },
{ "interface": [
"constant": false, {
"inputs": [ "anonymous": false,
{ "inputs": [
"name": "spender", {
"type": "address" "indexed": true,
}, "internalType": "address",
{ "name": "owner",
"name": "value", "type": "address"
"type": "uint256" },
} {
], "indexed": true,
"name": "approve", "internalType": "address",
"outputs": [ "name": "spender",
{ "type": "address"
"name": "", },
"type": "bool" {
} "indexed": false,
], "internalType": "uint256",
"payable": false, "name": "value",
"stateMutability": "nonpayable", "type": "uint256"
"type": "function" }
}, ],
{ "name": "Approval",
"constant": true, "type": "event"
"inputs": [], },
"name": "totalSupply", {
"outputs": [ "anonymous": false,
{ "inputs": [
"name": "", {
"type": "uint256" "indexed": true,
} "internalType": "address",
], "name": "from",
"payable": false, "type": "address"
"stateMutability": "view", },
"type": "function" {
}, "indexed": true,
{ "internalType": "address",
"constant": false, "name": "to",
"inputs": [ "type": "address"
{ },
"name": "from", {
"type": "address" "indexed": false,
}, "internalType": "uint256",
{ "name": "value",
"name": "to", "type": "uint256"
"type": "address" }
}, ],
{ "name": "Transfer",
"name": "value", "type": "event"
"type": "uint256" },
} {
], "constant": true,
"name": "transferFrom", "inputs": [],
"outputs": [ "name": "DOMAIN_SEPARATOR",
{ "outputs": [
"name": "", {
"type": "bool" "internalType": "bytes32",
} "name": "",
], "type": "bytes32"
"payable": false, }
"stateMutability": "nonpayable", ],
"type": "function" "payable": false,
}, "stateMutability": "view",
{ "type": "function"
"constant": true, },
"inputs": [], {
"name": "decimals", "constant": true,
"outputs": [ "inputs": [],
{ "name": "PERMIT_TYPEHASH",
"name": "", "outputs": [
"type": "uint8" {
} "internalType": "bytes32",
], "name": "",
"payable": false, "type": "bytes32"
"stateMutability": "view", }
"type": "function" ],
}, "payable": false,
{ "stateMutability": "pure",
"constant": true, "type": "function"
"inputs": [ },
{ {
"name": "owner", "constant": true,
"type": "address" "inputs": [
} {
], "internalType": "address",
"name": "balanceOf", "name": "owner",
"outputs": [ "type": "address"
{ },
"name": "balance", {
"type": "uint256" "internalType": "address",
} "name": "spender",
], "type": "address"
"payable": false, }
"stateMutability": "view", ],
"type": "function" "name": "allowance",
}, "outputs": [
{ {
"constant": true, "internalType": "uint256",
"inputs": [], "name": "",
"name": "symbol", "type": "uint256"
"outputs": [ }
{ ],
"name": "", "payable": false,
"type": "string" "stateMutability": "view",
} "type": "function"
], },
"payable": false, {
"stateMutability": "view", "constant": false,
"type": "function" "inputs": [
}, {
{ "internalType": "address",
"constant": false, "name": "spender",
"inputs": [ "type": "address"
{ },
"name": "to", {
"type": "address" "internalType": "uint256",
}, "name": "value",
{ "type": "uint256"
"name": "value", }
"type": "uint256" ],
} "name": "approve",
], "outputs": [
"name": "transfer", {
"outputs": [ "internalType": "bool",
{ "name": "",
"name": "", "type": "bool"
"type": "bool" }
} ],
], "payable": false,
"payable": false, "stateMutability": "nonpayable",
"stateMutability": "nonpayable", "type": "function"
"type": "function" },
}, {
{ "constant": true,
"constant": true, "inputs": [
"inputs": [ {
{ "internalType": "address",
"name": "owner", "name": "owner",
"type": "address" "type": "address"
}, }
{ ],
"name": "spender", "name": "balanceOf",
"type": "address" "outputs": [
} {
], "internalType": "uint256",
"name": "allowance", "name": "",
"outputs": [ "type": "uint256"
{ }
"name": "", ],
"type": "uint256" "payable": false,
} "stateMutability": "view",
], "type": "function"
"payable": false, },
"stateMutability": "view", {
"type": "function" "constant": true,
}, "inputs": [],
{ "name": "decimals",
"payable": true, "outputs": [
"stateMutability": "payable", {
"type": "fallback" "internalType": "uint8",
}, "name": "",
{ "type": "uint8"
"anonymous": false, }
"inputs": [ ],
{ "payable": false,
"indexed": true, "stateMutability": "pure",
"name": "owner", "type": "function"
"type": "address" },
}, {
{ "constant": true,
"indexed": true, "inputs": [],
"name": "spender", "name": "name",
"type": "address" "outputs": [
}, {
{ "internalType": "string",
"indexed": false, "name": "",
"name": "value", "type": "string"
"type": "uint256" }
} ],
], "payable": false,
"name": "Approval", "stateMutability": "pure",
"type": "event" "type": "function"
}, },
{ {
"anonymous": false, "constant": true,
"inputs": [ "inputs": [
{ {
"indexed": true, "internalType": "address",
"name": "from", "name": "owner",
"type": "address" "type": "address"
}, }
{ ],
"indexed": true, "name": "nonces",
"name": "to", "outputs": [
"type": "address" {
}, "internalType": "uint256",
{ "name": "",
"indexed": false, "type": "uint256"
"name": "value", }
"type": "uint256" ],
} "payable": false,
], "stateMutability": "view",
"name": "Transfer", "type": "function"
"type": "event" },
} {
] "constant": false,
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "deadline",
"type": "uint256"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"name": "permit",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "pure",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": ""
}

View File

@@ -0,0 +1,97 @@
[
{
"inputs": [{ "internalType": "address", "name": "_feeToSetter", "type": "address" }],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "token0", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "token1", "type": "address" },
{ "indexed": false, "internalType": "address", "name": "pair", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "", "type": "uint256" }
],
"name": "PairCreated",
"type": "event"
},
{
"constant": true,
"inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"name": "allPairs",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "allPairsLength",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{ "internalType": "address", "name": "tokenA", "type": "address" },
{ "internalType": "address", "name": "tokenB", "type": "address" }
],
"name": "createPair",
"outputs": [{ "internalType": "address", "name": "pair", "type": "address" }],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "feeTo",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "feeToSetter",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{ "internalType": "address", "name": "", "type": "address" },
{ "internalType": "address", "name": "", "type": "address" }
],
"name": "getPair",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [{ "internalType": "address", "name": "_feeTo", "type": "address" }],
"name": "setFeeTo",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [{ "internalType": "address", "name": "_feeToSetter", "type": "address" }],
"name": "setFeeToSetter",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
]

View File

@@ -1,81 +0,0 @@
[
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "isOwner",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
]

View File

@@ -0,0 +1,345 @@
[
{ "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" },
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "owner", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "spender", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "sender", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" },
{ "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" },
{ "indexed": true, "internalType": "address", "name": "to", "type": "address" }
],
"name": "Burn",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "sender", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" },
{ "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" }
],
"name": "Mint",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "sender", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "amount0In", "type": "uint256" },
{ "indexed": false, "internalType": "uint256", "name": "amount1In", "type": "uint256" },
{ "indexed": false, "internalType": "uint256", "name": "amount0Out", "type": "uint256" },
{ "indexed": false, "internalType": "uint256", "name": "amount1Out", "type": "uint256" },
{ "indexed": true, "internalType": "address", "name": "to", "type": "address" }
],
"name": "Swap",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "uint112", "name": "reserve0", "type": "uint112" },
{ "indexed": false, "internalType": "uint112", "name": "reserve1", "type": "uint112" }
],
"name": "Sync",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "from", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "to", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "Transfer",
"type": "event"
},
{
"constant": true,
"inputs": [],
"name": "DOMAIN_SEPARATOR",
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "MINIMUM_LIQUIDITY",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "PERMIT_TYPEHASH",
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{ "internalType": "address", "name": "", "type": "address" },
{ "internalType": "address", "name": "", "type": "address" }
],
"name": "allowance",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{ "internalType": "address", "name": "spender", "type": "address" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "approve",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
"name": "balanceOf",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [{ "internalType": "address", "name": "to", "type": "address" }],
"name": "burn",
"outputs": [
{ "internalType": "uint256", "name": "amount0", "type": "uint256" },
{ "internalType": "uint256", "name": "amount1", "type": "uint256" }
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "factory",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getReserves",
"outputs": [
{ "internalType": "uint112", "name": "_reserve0", "type": "uint112" },
{ "internalType": "uint112", "name": "_reserve1", "type": "uint112" },
{ "internalType": "uint32", "name": "_blockTimestampLast", "type": "uint32" }
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{ "internalType": "address", "name": "_token0", "type": "address" },
{ "internalType": "address", "name": "_token1", "type": "address" }
],
"name": "initialize",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "kLast",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [{ "internalType": "address", "name": "to", "type": "address" }],
"name": "mint",
"outputs": [{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
"name": "nonces",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{ "internalType": "address", "name": "owner", "type": "address" },
{ "internalType": "address", "name": "spender", "type": "address" },
{ "internalType": "uint256", "name": "value", "type": "uint256" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
{ "internalType": "uint8", "name": "v", "type": "uint8" },
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
],
"name": "permit",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "price0CumulativeLast",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "price1CumulativeLast",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [{ "internalType": "address", "name": "to", "type": "address" }],
"name": "skim",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{ "internalType": "uint256", "name": "amount0Out", "type": "uint256" },
{ "internalType": "uint256", "name": "amount1Out", "type": "uint256" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "bytes", "name": "data", "type": "bytes" }
],
"name": "swap",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "sync",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "token0",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "token1",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "transfer",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{ "internalType": "address", "name": "from", "type": "address" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "transferFrom",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
]

View File

@@ -0,0 +1,270 @@
[
{
"inputs": [
{ "internalType": "address", "name": "_factory", "type": "address" },
{ "internalType": "address", "name": "_WETH", "type": "address" }
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "WETH",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "tokenA", "type": "address" },
{ "internalType": "address", "name": "tokenB", "type": "address" },
{ "internalType": "uint256", "name": "amountADesired", "type": "uint256" },
{ "internalType": "uint256", "name": "amountBDesired", "type": "uint256" },
{ "internalType": "uint256", "name": "amountAMin", "type": "uint256" },
{ "internalType": "uint256", "name": "amountBMin", "type": "uint256" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "addLiquidity",
"outputs": [
{ "internalType": "uint256", "name": "amountA", "type": "uint256" },
{ "internalType": "uint256", "name": "amountB", "type": "uint256" },
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "token", "type": "address" },
{ "internalType": "uint256", "name": "amountTokenDesired", "type": "uint256" },
{ "internalType": "uint256", "name": "amountTokenMin", "type": "uint256" },
{ "internalType": "uint256", "name": "amountETHMin", "type": "uint256" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "addLiquidityETH",
"outputs": [
{ "internalType": "uint256", "name": "amountToken", "type": "uint256" },
{ "internalType": "uint256", "name": "amountETH", "type": "uint256" },
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "factory",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
{ "internalType": "uint256", "name": "reserveIn", "type": "uint256" },
{ "internalType": "uint256", "name": "reserveOut", "type": "uint256" }
],
"name": "getAmountIn",
"outputs": [{ "internalType": "uint256", "name": "amountIn", "type": "uint256" }],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
{ "internalType": "uint256", "name": "reserveIn", "type": "uint256" },
{ "internalType": "uint256", "name": "reserveOut", "type": "uint256" }
],
"name": "getAmountOut",
"outputs": [{ "internalType": "uint256", "name": "amountOut", "type": "uint256" }],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" }
],
"name": "getAmountsIn",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" }
],
"name": "getAmountsOut",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountA", "type": "uint256" },
{ "internalType": "uint256", "name": "reserveA", "type": "uint256" },
{ "internalType": "uint256", "name": "reserveB", "type": "uint256" }
],
"name": "quote",
"outputs": [{ "internalType": "uint256", "name": "amountB", "type": "uint256" }],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "tokenA", "type": "address" },
{ "internalType": "address", "name": "tokenB", "type": "address" },
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" },
{ "internalType": "uint256", "name": "amountAMin", "type": "uint256" },
{ "internalType": "uint256", "name": "amountBMin", "type": "uint256" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "removeLiquidity",
"outputs": [
{ "internalType": "uint256", "name": "amountA", "type": "uint256" },
{ "internalType": "uint256", "name": "amountB", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "token", "type": "address" },
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" },
{ "internalType": "uint256", "name": "amountTokenMin", "type": "uint256" },
{ "internalType": "uint256", "name": "amountETHMin", "type": "uint256" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "removeLiquidityETH",
"outputs": [
{ "internalType": "uint256", "name": "amountToken", "type": "uint256" },
{ "internalType": "uint256", "name": "amountETH", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "token", "type": "address" },
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" },
{ "internalType": "uint256", "name": "amountTokenMin", "type": "uint256" },
{ "internalType": "uint256", "name": "amountETHMin", "type": "uint256" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
{ "internalType": "bool", "name": "approveMax", "type": "bool" },
{ "internalType": "uint8", "name": "v", "type": "uint8" },
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
],
"name": "removeLiquidityETHWithPermit",
"outputs": [
{ "internalType": "uint256", "name": "amountToken", "type": "uint256" },
{ "internalType": "uint256", "name": "amountETH", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "tokenA", "type": "address" },
{ "internalType": "address", "name": "tokenB", "type": "address" },
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" },
{ "internalType": "uint256", "name": "amountAMin", "type": "uint256" },
{ "internalType": "uint256", "name": "amountBMin", "type": "uint256" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
{ "internalType": "bool", "name": "approveMax", "type": "bool" },
{ "internalType": "uint8", "name": "v", "type": "uint8" },
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
],
"name": "removeLiquidityWithPermit",
"outputs": [
{ "internalType": "uint256", "name": "amountA", "type": "uint256" },
{ "internalType": "uint256", "name": "amountB", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "swapETHForExactTokens",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountOutMin", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "swapExactETHForTokens",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
{ "internalType": "uint256", "name": "amountOutMin", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "swapExactTokensForETH",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
{ "internalType": "uint256", "name": "amountOutMin", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "swapExactTokensForTokens",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
{ "internalType": "uint256", "name": "amountInMax", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "swapTokensForExactETH",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
{ "internalType": "uint256", "name": "amountInMax", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "swapTokensForExactTokens",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "nonpayable",
"type": "function"
},
{ "stateMutability": "payable", "type": "receive" }
]

View File

@@ -0,0 +1,340 @@
[
{
"inputs": [
{ "internalType": "address", "name": "_factory", "type": "address" },
{ "internalType": "address", "name": "_WETH", "type": "address" }
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "WETH",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "tokenA", "type": "address" },
{ "internalType": "address", "name": "tokenB", "type": "address" },
{ "internalType": "uint256", "name": "amountADesired", "type": "uint256" },
{ "internalType": "uint256", "name": "amountBDesired", "type": "uint256" },
{ "internalType": "uint256", "name": "amountAMin", "type": "uint256" },
{ "internalType": "uint256", "name": "amountBMin", "type": "uint256" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "addLiquidity",
"outputs": [
{ "internalType": "uint256", "name": "amountA", "type": "uint256" },
{ "internalType": "uint256", "name": "amountB", "type": "uint256" },
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "token", "type": "address" },
{ "internalType": "uint256", "name": "amountTokenDesired", "type": "uint256" },
{ "internalType": "uint256", "name": "amountTokenMin", "type": "uint256" },
{ "internalType": "uint256", "name": "amountETHMin", "type": "uint256" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "addLiquidityETH",
"outputs": [
{ "internalType": "uint256", "name": "amountToken", "type": "uint256" },
{ "internalType": "uint256", "name": "amountETH", "type": "uint256" },
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "factory",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
{ "internalType": "uint256", "name": "reserveIn", "type": "uint256" },
{ "internalType": "uint256", "name": "reserveOut", "type": "uint256" }
],
"name": "getAmountIn",
"outputs": [{ "internalType": "uint256", "name": "amountIn", "type": "uint256" }],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
{ "internalType": "uint256", "name": "reserveIn", "type": "uint256" },
{ "internalType": "uint256", "name": "reserveOut", "type": "uint256" }
],
"name": "getAmountOut",
"outputs": [{ "internalType": "uint256", "name": "amountOut", "type": "uint256" }],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" }
],
"name": "getAmountsIn",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" }
],
"name": "getAmountsOut",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountA", "type": "uint256" },
{ "internalType": "uint256", "name": "reserveA", "type": "uint256" },
{ "internalType": "uint256", "name": "reserveB", "type": "uint256" }
],
"name": "quote",
"outputs": [{ "internalType": "uint256", "name": "amountB", "type": "uint256" }],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "tokenA", "type": "address" },
{ "internalType": "address", "name": "tokenB", "type": "address" },
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" },
{ "internalType": "uint256", "name": "amountAMin", "type": "uint256" },
{ "internalType": "uint256", "name": "amountBMin", "type": "uint256" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "removeLiquidity",
"outputs": [
{ "internalType": "uint256", "name": "amountA", "type": "uint256" },
{ "internalType": "uint256", "name": "amountB", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "token", "type": "address" },
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" },
{ "internalType": "uint256", "name": "amountTokenMin", "type": "uint256" },
{ "internalType": "uint256", "name": "amountETHMin", "type": "uint256" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "removeLiquidityETH",
"outputs": [
{ "internalType": "uint256", "name": "amountToken", "type": "uint256" },
{ "internalType": "uint256", "name": "amountETH", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "token", "type": "address" },
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" },
{ "internalType": "uint256", "name": "amountTokenMin", "type": "uint256" },
{ "internalType": "uint256", "name": "amountETHMin", "type": "uint256" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "removeLiquidityETHSupportingFeeOnTransferTokens",
"outputs": [{ "internalType": "uint256", "name": "amountETH", "type": "uint256" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "token", "type": "address" },
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" },
{ "internalType": "uint256", "name": "amountTokenMin", "type": "uint256" },
{ "internalType": "uint256", "name": "amountETHMin", "type": "uint256" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
{ "internalType": "bool", "name": "approveMax", "type": "bool" },
{ "internalType": "uint8", "name": "v", "type": "uint8" },
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
],
"name": "removeLiquidityETHWithPermit",
"outputs": [
{ "internalType": "uint256", "name": "amountToken", "type": "uint256" },
{ "internalType": "uint256", "name": "amountETH", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "token", "type": "address" },
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" },
{ "internalType": "uint256", "name": "amountTokenMin", "type": "uint256" },
{ "internalType": "uint256", "name": "amountETHMin", "type": "uint256" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
{ "internalType": "bool", "name": "approveMax", "type": "bool" },
{ "internalType": "uint8", "name": "v", "type": "uint8" },
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
],
"name": "removeLiquidityETHWithPermitSupportingFeeOnTransferTokens",
"outputs": [{ "internalType": "uint256", "name": "amountETH", "type": "uint256" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "tokenA", "type": "address" },
{ "internalType": "address", "name": "tokenB", "type": "address" },
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" },
{ "internalType": "uint256", "name": "amountAMin", "type": "uint256" },
{ "internalType": "uint256", "name": "amountBMin", "type": "uint256" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
{ "internalType": "bool", "name": "approveMax", "type": "bool" },
{ "internalType": "uint8", "name": "v", "type": "uint8" },
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
],
"name": "removeLiquidityWithPermit",
"outputs": [
{ "internalType": "uint256", "name": "amountA", "type": "uint256" },
{ "internalType": "uint256", "name": "amountB", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "swapETHForExactTokens",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountOutMin", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "swapExactETHForTokens",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountOutMin", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "swapExactETHForTokensSupportingFeeOnTransferTokens",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
{ "internalType": "uint256", "name": "amountOutMin", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "swapExactTokensForETH",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
{ "internalType": "uint256", "name": "amountOutMin", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "swapExactTokensForETHSupportingFeeOnTransferTokens",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
{ "internalType": "uint256", "name": "amountOutMin", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "swapExactTokensForTokens",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
{ "internalType": "uint256", "name": "amountOutMin", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "swapExactTokensForTokensSupportingFeeOnTransferTokens",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
{ "internalType": "uint256", "name": "amountInMax", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "swapTokensForExactETH",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
{ "internalType": "uint256", "name": "amountInMax", "type": "uint256" },
{ "internalType": "address[]", "name": "path", "type": "address[]" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
],
"name": "swapTokensForExactTokens",
"outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }],
"stateMutability": "nonpayable",
"type": "function"
},
{ "stateMutability": "payable", "type": "receive" }
]

View File

@@ -1,5 +1,86 @@
// This address points to a dummy ERC-20 contract. Replace it with your own smart contracts. /**
const addresses = { * See all ids below
ceaErc20: "0xa6dF0C88916f3e2831A329CE46566dDfBe9E74b7", * https://ethereum.stackexchange.com/questions/17051/how-to-select-a-network-id-or-is-there-a-list-of-network-ids
*/
export const GOERLI_ID = 5;
export const KOVAN_ID = 42;
export const MAINNET_ID = 1;
export const RINKEBY_ID = 4;
export const ROPSTEN_ID = 3;
const commonContracts = {
factory: "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
router01: "0xf164fC0Ec4E93095b804a4795bBe1e041497b92a",
router02: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
};
export default {
[GOERLI_ID]: {
pairs: {
"DAI-WETH": "0x8F609d85ebC64316B0B2f9E53c11b4e48B7A06d2",
},
tokens: {
DAI: "0x697Ed3E98aaeCFa3121F536251F9D500de159dBa",
WETH: "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
},
...commonContracts,
},
[KOVAN_ID]: {
pairs: {
"DAI-WETH": "0xB10cf58E08b94480fCb81d341A63295eBb2062C2",
},
tokens: {
DAI: "0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa",
WETH: "0xd0A1E359811322d97991E03f863a0C30C2cF029C",
},
...commonContracts,
},
[MAINNET_ID]: {
pairs: {
"BAT-WETH": "0xB6909B960DbbE7392D405429eB2b3649752b4838",
"COMP-WETH": "0xCFfDdeD873554F362Ac02f8Fb1f02E5ada10516f",
"DAI-WETH": "0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11",
"LEND-WETH": "0xaB3F9bF1D81ddb224a2014e98B238638824bCf20",
"LINK-WETH": "0xa2107fa5b38d9bbd2c461d6edf11b11a50f6b974",
"MKR-WETH": "0xC2aDdA861F89bBB333c90c492cB837741916A225",
"USDC-WETH": "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc",
"USDC-USDT": "0x3041CbD36888bECc7bbCBc0045E3B1f144466f5f",
"WBTC-WETH": "0xBb2b8038a1640196FbE3e38816F3e67Cba72D940",
"WETH-AMPL": "0xc5be99A02C6857f9Eac67BbCE58DF5572498F40c",
},
tokens: {
AMPL: "0xD46bA6D942050d489DBd938a2C909A5d5039A161",
BAT: "0x0D8775F648430679A709E98d2b0Cb6250d2887EF",
COMP: "0xc00e94Cb662C3520282E6f5717214004A7f26888",
DAI: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
LEND: "0x80fB784B7eD66730e8b1DBd9820aFD29931aab03",
LINK: "0x514910771AF9Ca656af840dff83E8264EcF986CA",
MKR: "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2",
USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
wBTC: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
WETH: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
},
...commonContracts,
},
[RINKEBY_ID]: {
pairs: {
"DAI-WETH": "0x8B22F85d0c844Cf793690F6D9DFE9F11Ddb35449",
},
tokens: {
DAI: "0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735",
WETH: "0xc778417E063141139Fce010982780140Aa0cD5Ab",
},
...commonContracts,
},
[ROPSTEN_ID]: {
pairs: {
"DAI-WETH": "0x1c5DEe94a34D795f9EEeF830B68B80e44868d316",
},
tokens: {
DAI: "0xaD6D458402F60fD3Bd25163575031ACDce07538D",
WETH: "0xc778417E063141139Fce010982780140Aa0cD5Ab",
},
...commonContracts,
},
}; };
export default addresses;

View File

@@ -1,10 +0,0 @@
import { render } from "@testing-library/react";
import React from "react";
import App from "./App";
test("renders learn react link", () => {
const { getByText } = render(<App />);
const linkElement = getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

View File

@@ -0,0 +1 @@
<svg width="12" height="7" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg" class="sc-3zewi2-11 kHQTSW"><path d="M0.97168 1L6.20532 6L11.439 1" stroke="#AEAEAE"></path></svg>

After

Width:  |  Height:  |  Size: 191 B

View File

Before

Width:  |  Height:  |  Size: 211 KiB

After

Width:  |  Height:  |  Size: 211 KiB

View File

@@ -0,0 +1,5 @@
import chevronDown from "./chevron-down.svg";
import ethereumLogo from "./ethereumLogo.png";
import uniswapLogo from "./uniswapLogo.png";
export { chevronDown, ethereumLogo, uniswapLogo };

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -1,55 +0,0 @@
import styled from "styled-components";
export const Body = styled.div`
align-items: center;
color: white;
display: flex;
flex-direction: column;
font-size: calc(10px + 2vmin);
justify-content: center;
margin-top: 40px;
`;
export const Button = styled.button`
background-color: white;
border: none;
border-radius: 8px;
color: #282c34;
cursor: pointer;
font-size: 16px;
margin: 0px 20px;
padding: 12px 24px;
text-align: center;
text-decoration: none;
`;
export const Container = styled.div`
background-color: #282c34;
display: flex;
flex-direction: column;
height: calc(100vh);
`;
export const Header = styled.header`
align-items: center;
background-color: #282c34;
color: white;
display: flex;
flex-direction: row;
justify-content: flex-end;
min-height: 70px;
`;
export const Image = styled.img`
height: 40vmin;
margin-bottom: 16px;
pointer-events: none;
`;
export const Link = styled.a.attrs({
target: "_blank",
rel: "noopener noreferrer",
})`
color: #61dafb;
margin-top: 8px;
`;

10
packages/react-app/src/config.js vendored Normal file
View File

@@ -0,0 +1,10 @@
import { Goerli } from "@usedapp/core";
export const ROUTER_ADDRESS = "[YOUR ADDRESS HERE]";
export const DAPP_CONFIG = {
readOnlyChainId: Goerli.chainId,
readOnlyUrls: {
[Goerli.chainId]: "[YOUR URL HERE]",
},
};

View File

@@ -1,15 +0,0 @@
import { gql } from "@apollo/client";
// See more example queries on https://thegraph.com/explorer/subgraph/paulrberg/create-eth-app
const GET_TRANSFERS = gql`
{
transfers(first: 10) {
id
from
to
value
}
}
`;
export default GET_TRANSFERS;

View File

@@ -1,11 +1,59 @@
body { @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap");
@tailwind base;
@tailwind components;
@tailwind utilities;
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0; margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans",
"Droid Sans", "Helvetica Neue", sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
} }
code { /* Firefox */
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; input[type="number"] {
-moz-appearance: textfield;
}
.gradient_btn {
background: linear-gradient(
103.91deg,
#9b51e0 21.01%,
rgba(48, 129, 237, 0.8) 100%
);
}
.pink_gradient {
position: absolute;
top: 0%;
left: 0%;
width: 123px;
height: 123px;
border-radius: 50%;
background: #fb37ff;
filter: blur(200px);
}
.blue_gradient {
position: absolute;
bottom: 0%;
right: 0%;
width: 123px;
height: 123px;
border-radius: 50%;
background: #18b2de;
filter: blur(200px);
}
.gradient-border {
background: linear-gradient(
168.82deg,
#fb37ff 1.7%,
rgba(155, 111, 238, 0) 27.12%,
rgba(123, 127, 234, 0) 61.28%,
#1bb2de 99.52%
);
} }

View File

@@ -1,37 +1,17 @@
import "./index.css";
import { ApolloClient, ApolloProvider, InMemoryCache } from "@apollo/client";
import { DAppProvider, Mainnet } from "@usedapp/core";
import React from "react"; import React from "react";
import ReactDOM from "react-dom"; import ReactDOM from "react-dom";
import { DAppProvider } from "@usedapp/core";
import App from "./App"; import App from "./App";
import { DAPP_CONFIG } from "./config";
// IMPORTANT, PLEASE READ import "./index.css";
// To avoid disruptions in your app, change this to your own Infura project id.
// https://infura.io/register
const INFURA_PROJECT_ID = "529670718fd74cd2a041466303daecd7";
const config = {
readOnlyChainId: Mainnet.chainId,
readOnlyUrls: {
[Mainnet.chainId]: "https://mainnet.infura.io/v3/" + INFURA_PROJECT_ID,
},
}
// You should replace this url with your own and put it into a .env file
// See all subgraphs: https://thegraph.com/explorer/
const client = new ApolloClient({
cache: new InMemoryCache(),
uri: "https://api.thegraph.com/subgraphs/name/paulrberg/create-eth-app",
});
ReactDOM.render( ReactDOM.render(
<React.StrictMode> <React.StrictMode>
<DAppProvider config={config}> <DAppProvider config={DAPP_CONFIG}>
<ApolloProvider client={client}> <App />
<App />
</ApolloProvider>
</DAppProvider> </DAppProvider>
</React.StrictMode>, </React.StrictMode>,
document.getElementById("root"), document.getElementById("root")
); );

View File

@@ -1,5 +0,0 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import "@testing-library/jest-dom/extend-expect";

50
packages/react-app/src/styles/index.js vendored Normal file
View File

@@ -0,0 +1,50 @@
const styles = {
// App.js
container: "flex justify-center min-h-screen sm:px-16 px-6 bg-site-black",
innerContainer:
"flex justify-between items-center flex-col max-w-[1280px] w-full",
header: "flex flex-row justify-between items-center w-full sm:py-10 py-6",
exchangeContainer:
"flex-1 flex justify-start items-center flex-col w-full mt-10",
headTitle: "text-white font-poppins font-black text-5xl tracking-wide",
subTitle: "text-dim-white font-poppins font-medium mt-3 text-base",
exchangeBoxWrapper: "mt-10 w-full flex justify-center",
exchangeBox:
"relative md:max-w-[700px] md:min-w-[500px] min-w-full max-w-full gradient-border p-[2px] rounded-3xl",
exchange:
"w-full min-h-[400px] bg-site-black backdrop-blur-[4px] rounded-3xl shadow-card flex p-10",
// AmountIn & AmountOut
amountContainer:
"flex justify-between items-center flex-row w-full min-w-full bg-site-dim border-[1px] border-transparent hover:border-site-dim2 min-h-[96px] sm:p-8 p-4 rounded-[20px]",
amountInput:
"w-full flex-1 bg-transparent outline-none font-poppins font-black text-2xl text-white",
currencyButton:
"flex flex-row items-center bg-site-dim2 py-2 px-4 rounded-xl font-poppins font-bold text-white",
currencyList:
"absolute z-10 right-0 bg-site-black border-[1px] border-site-dim2 w-full mt-2 rounded-lg min-w-[170px] overflow-hidden",
currencyListItem:
"font-poppins font-medium text-base text-white hover:text-dim-white px-5 py-3 hover:bg-site-dim2 cursor-pointer",
// Exchange
actionButton:
"border-none outline-none px-6 py-2 font-poppins font-bold text-lg rounded-2xl leading-[24px] transition-all min-h-[56px]",
message: "font-poppins font-lg text-white font-bold mt-7",
// WalletButton
walletButton:
"bg-site-pink border-none outline-none px-6 py-2 font-poppins font-bold text-lg text-white rounded-3xl leading-[24px] hover:bg-pink-600 transition-all",
// loader
loader: "flex justify-center items-center flex-col w-full min-h-full",
loaderImg: "w-56 h-56 object-contain",
loaderText:
"font-poppins font-normal text-dim-white text-lg text-center mt-10",
// balance
balance: "w-full text-left mt-2 ml-2",
balanceText: "font-poppins font-normal text-dim-white",
balanceBold: "font-semibold text-white",
};
export default styles;

110
packages/react-app/src/utils/helpers.js vendored Normal file
View File

@@ -0,0 +1,110 @@
import { Contract } from "@ethersproject/contracts";
import { abis } from "@my-app/contracts";
import { useCall } from "@usedapp/core";
import { parseUnits } from "ethers/lib/utils";
import { useEffect } from "react";
import { ROUTER_ADDRESS } from "../config";
export const getAvailableTokens = (pools) =>
pools.reduce((prev, curr) => {
prev[curr.token0Address] = curr.token0Name;
prev[curr.token1Address] = curr.token1Name;
return prev;
}, {});
export const getCounterpartTokens = (pools, fromToken) => pools
.filter((cur) => cur.token0Address === fromToken || cur.token1Address)
.reduce((prev, curr) => {
if (curr.token0Address === fromToken) {
prev[curr.token1Address] = curr.token1Name;
} else if (curr.token1Address === fromToken) {
prev[curr.token0Address] = curr.token0Name;
}
return prev;
}, {});
export const findPoolByTokens = (pools, fromToken, toToken) => {
if (!Array.isArray(pools) || !fromToken || !toToken) return undefined;
return pools.find((cur) =>
(cur.token0Address === fromToken && cur.token1Address === toToken) ||
(cur.token1Address === fromToken && cur.token0Address === toToken)
);
};
export const isOperationPending = (operationState) =>
operationState.status === "PendingSignature" || operationState.status === "Mining";
export const isOperationFailed = (operationState) =>
operationState.status === "Fail" || operationState.status === "Exception";
export const isOperationSucceeded = (operationState) =>
operationState.status === "Success";
export const getFailureMessage = (swapApproveState, swapExecuteState) => {
if (isOperationPending(swapApproveState) || isOperationPending(swapExecuteState)) {
return undefined;
}
if (isOperationFailed(swapApproveState)) {
return "Approval failed - " + swapApproveState.errorMessage;
}
if (isOperationFailed(swapExecuteState)) {
return "Swap failed - " + swapExecuteState.errorMessage;
}
return undefined;
};
export const getSuccessMessage = (swapApproveState, swapExecuteState) => {
if (isOperationPending(swapExecuteState) ||isOperationPending(swapApproveState)) {
return undefined;
}
if (isOperationSucceeded(swapExecuteState)) {
return "Swap executed successfully";
}
if (isOperationSucceeded(swapApproveState)) {
return "Approval successful";
}
return undefined;
};
export const useAmountsOut = (pairAddress, amountIn, fromToken, toToken) => {
const isValidAmountIn = amountIn.gt(parseUnits("0"));
const areParamsValid = !!(pairAddress && isValidAmountIn && fromToken && toToken);
const { error, value } =
useCall(
areParamsValid && {
contract: new Contract(ROUTER_ADDRESS, abis.router02),
method: "getAmountsOut",
args: [amountIn, [fromToken, toToken]],
}
) ?? {};
return error ? parseUnits("0") : value?.amounts[1];
}
export const useOnClickOutside = (ref, handler) => {
useEffect(() => {
const listener = (event) => {
// Do nothing if clicking ref's element or descendent elements
if (!ref.current || ref.current.contains(event.target)) {
return;
}
handler(event);
};
document.addEventListener("mousedown", listener);
document.addEventListener("touchstart", listener);
return () => {
document.removeEventListener("mousedown", listener);
document.removeEventListener("touchstart", listener);
};
}, [ref, handler]);
}

10
packages/react-app/src/utils/index.js vendored Normal file
View File

@@ -0,0 +1,10 @@
export {
getAvailableTokens,
getCounterpartTokens,
findPoolByTokens,
isOperationPending,
getFailureMessage,
getSuccessMessage,
useAmountsOut,
useOnClickOutside
} from './helpers';

View File

@@ -1,76 +0,0 @@
## @my-app/subgraph
The Graph is a tool for for indexing events emitted on the Ethereum blockchain. It provides you with an easy-to-use GraphQL API.
## Available Scripts
In the project directory, you can run:
### Subgraph
#### `yarn codegen`
Generates AssemblyScript types for smart contract ABIs and the subgraph schema.
#### `yarn build`
Compiles the subgraph to WebAssembly.
#### `yarn auth`
Before deploying your subgraph, you need to sign up on the
[Graph Explorer](https://thegraph.com/explorer/). There, you will be given an access token. Drop it in the command
below:
```sh
GRAPH_ACCESS_TOKEN=your-access-token-here yarn subgraph:auth
```
#### `yarn deploy`
Deploys the subgraph to the official Graph Node.<br/>
Replace `paulrberg/create-eth-app` in the package.json script with your subgraph's name.
You may also want to [read more about the hosted service](https://thegraph.com/docs/quick-start#hosted-service).
## Learn More
To learn The Graph, check out the [The Graph documentation](https://thegraph.com/docs).
---
1. Generate types
2. Build distributable files
3. Deploy to the remote API
## Learn More
You can learn more in the [The Graph documentation](https://thegraph.com/docs).<br/>
Also consider joining [The Graph Discord server](https://discord.gg/vtvv7FP), where you can seek out help.
## Common Errors
### Failed to Compile
> ✖ Failed to compile subgraph: Failed to compile data source mapping: Import file 'src/types/schema.ts' not found.
> Error: Failed to compile data source mapping: Import file 'src/types/schema.ts' not found.
Run the `yarn subgraph` and this error will go away.
### No Access Token
> ✖ No access token provided
Make sure that you followed the instructions listed above for [yarn auth](#yarn-auth).
### Failed to Deploy
> ✖ Failed to deploy to Graph node https://api.thegraph.com/deploy/: Invalid account name or access token
Make sure that you:
1. Signed up on the [Graph Explorer](https://thegraph.com/explorer)
2. Followed the instructions listed above for [yarn auth](#yarn-auth)
3. Replaced `paulrberg/create-eth-app` with your subgraph's name

View File

@@ -1,15 +0,0 @@
{
"name": "@my-app/subgraph",
"version": "1.0.0",
"dependencies": {
"@graphprotocol/graph-cli": "0.28.0",
"@graphprotocol/graph-ts": "0.26.0"
},
"license": "MIT",
"scripts": {
"auth": "graph auth https://api.thegraph.com/ $GRAPH_ACCESS_TOKEN",
"build": "graph build",
"codegen": "graph codegen --output-dir src/types/",
"deploy": "graph deploy paulrberg/create-eth-app --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/"
}
}

View File

@@ -1,13 +0,0 @@
type Token @entity {
id: ID!
decimals: Int
name: String
symbol: String
}
type Transfer @entity {
id: ID!
from: String!
to: String!
value: BigInt!
}

View File

@@ -1,21 +0,0 @@
import { Token } from "../types/schema";
export function addToken(address: string): void {
let token: Token | null = Token.load(address);
if (token != null) {
return;
}
token = new Token(address);
if (address == "0xa6dF0C88916f3e2831A329CE46566dDfBe9E74b7") {
token.decimals = 18;
token.name = "CeaErc20";
token.symbol = "CEAERC20";
} else {
token.decimals = 0;
token.name = null;
token.symbol = null;
}
token.save();
}

View File

@@ -1,19 +0,0 @@
import { Address } from "@graphprotocol/graph-ts";
import { Transfer as TransferEvent } from "../types/CeaErc20/erc20";
import { Transfer } from "../types/schema";
import { addToken } from "./tokens";
export function handleTransfer(event: TransferEvent): void {
let transactionHash: string = event.transaction.hash.toHex();
let transfer = new Transfer(transactionHash);
transfer.from = event.params.from.toHex();
transfer.to = event.params.to.toHex();
transfer.value = event.params.value;
transfer.save();
let to: Address | null = event.transaction.to;
if (to) {
addToken(to.toHex());
}
}

View File

@@ -1,26 +0,0 @@
specVersion: 0.0.4
description: Subgraph that indexes the blockchain data
repository: https://github.com/sablierhq/sablier-subgraph
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: CeaErc20
network: mainnet
source:
abi: erc20
address: "0xa6dF0C88916f3e2831A329CE46566dDfBe9E74b7"
mapping:
kind: ethereum/events
apiVersion: 0.0.6
abis:
- name: erc20
file: ../contracts/src/abis/erc20.json
entities:
- Token
- Transfer
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
file: ./src/mappings/transfers.ts
language: wasm/assemblyscript

24257
yarn.lock

File diff suppressed because it is too large Load Diff