├── .gitignore ├── utils ├── error.js └── provider.js ├── package.json ├── script-1-create-wallet └── index.js ├── constants └── tokens.js ├── script-5-empty-ethereum-wallet └── index.js ├── script-6-input-data-decoder └── index.js ├── script-2-transfer-token └── index.js ├── README.md ├── abis ├── erc20.json ├── masterChef.json ├── router.json └── pancakeRouterV3.json ├── script-3-swap-on-dex └── index.js └── script-4-bonus-getting-on-dex └── index.js /.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | /node_modules 3 | 4 | package-lock.json 5 | -------------------------------------------------------------------------------- /utils/error.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @LastEditors: Bot80926 3 | * @LastEditTime: 2023-04-29 14:49:28 4 | * @FilePath: /ethers-scripts/utils/error.js 5 | * Copyright (c) 2023 by Bot80926, All Rights Reserved. 6 | */ 7 | 8 | const ethers = require("ethers"); 9 | const Provider = require('../utils/provider') 10 | 11 | const provider = new Provider({ 12 | chain: "kcc", 13 | chainId: 322, 14 | fullnode: "https://rpc-testnet.kcc.network", 15 | }).getProvider(); 16 | 17 | 18 | const main = async (txHash) => { 19 | const tx = await provider.getTransaction(txHash) 20 | if (!tx) { 21 | console.log('tx not found') 22 | } else { 23 | const code = await provider.call(tx) 24 | console.log('revert reason:', code) 25 | } 26 | } 27 | 28 | main('input your txHash'); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ethers-scripts", 3 | "version": "1.0.0", 4 | "description": "simple scripts for web3 freshman", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1", 7 | "commit": "npx git-cz" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/Bot80926/ethers-scripts.git" 12 | }, 13 | "keywords": [ 14 | "web3", 15 | "frontend", 16 | "ethers", 17 | "blockchain", 18 | "javascript" 19 | ], 20 | "author": "Bot80926", 21 | "license": "MIT", 22 | "bugs": { 23 | "url": "https://github.com/Bot80926/ethers-scripts/issues" 24 | }, 25 | "homepage": "https://github.com/Bot80926/ethers-scripts#readme", 26 | "dependencies": { 27 | "chalk": "^4.0.0", 28 | "ethereum-input-data-decoder": "^0.4.2", 29 | "ethers": "^4.0.49" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /script-1-create-wallet/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @LastEditors: Bot80926 3 | * @Description: Create wallet in batches 4 | * @FilePath: /ethers-scripts/script-1-create-wallet/index.js 5 | * Copyright (c) 2023 by Bot80926, All Rights Reserved. 6 | * Buy me a coffee: 0xa1ebF7E97Cfd6939fb90b27567AEBa5904a66630 7 | */ 8 | 9 | const ethers = require("ethers"); 10 | const fs = require("fs"); 11 | const chalk = require("chalk"); 12 | 13 | const createAccount = () => { 14 | let list = ""; 15 | 16 | //step1: create wallet 17 | for (let i = 0; i < 100; i++) { 18 | const wallet = ethers.Wallet.createRandom(); 19 | 20 | const pv = wallet.privateKey; 21 | 22 | const address = wallet.address; 23 | 24 | list += '\r "address: ' + address + '", privateKey: "' + pv + '", \r'; 25 | } 26 | 27 | //step2: create txt file and save wallet 28 | fs.writeFile(`./addr_key_book.txt`, list, (error) => { 29 | if (error) { 30 | return console.log("create wallet failed, error: ", error); 31 | } 32 | console.log(chalk.green("Successfully created wallets in batches, file name: addr_key_book.txt")); 33 | }); 34 | }; 35 | 36 | const main = async () => { 37 | createAccount(); 38 | }; 39 | 40 | main(); -------------------------------------------------------------------------------- /constants/tokens.js: -------------------------------------------------------------------------------- 1 | const tokens = { 2 | 'kcc-testnet': { 3 | 'BASE_TOKEN': '0x6551358EDC7fee9ADAB1E2E49560E68a12E82d9e', // KCS 4 | 'USDT': '0x67f6a7BbE0da067A747C6b2bEdF8aBBF7D6f60dc', 5 | 'USDC': '0xD6c7E27a598714c2226404Eb054e0c074C906Fc9', 6 | 'ROUTER': '0x59a4210Dd69FDdE1457905098fF03E0617A548C5', // mojitoSwap 7 | 'MASTERCHEF': '0xc7CBbb318318242fCC314ec723269d9E41ff6B4D', 8 | 'KCS_USDT_LP': '0x4047c095d63397dfc44c9183c2ce01b38ae3c72a', 9 | }, 10 | 'kcc-mainnet': { 11 | 'BASE_TOKEN': '0x4446fc4eb47f2f6586f9faab68b3498f86c07521', //KCS 12 | 'USDT': '0x0039f574ee5cc39bdd162e9a88e3eb1f111baf48', 13 | 'USDC': '0x980a5AfEf3D17aD98635F6C5aebCBAedEd3c3430', 14 | 'ROUTER': '0x8c8067ed3bC19ACcE28C1953bfC18DC85A2127F7', // mojitoSwap 15 | 'MASTERCHEF': '0xfdfcE767aDD9dCF032Cbd0DE35F0E57b04495324', 16 | 'KCS_USDT_LP': '0xa0d7C8aA789362CDf4FAAE24b9D1528eD5a3777f', 17 | }, 18 | 'bsc-mainnet': { 19 | 'BASE_TOKEN': '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // BNB 20 | 'USDT': '0x55d398326f99059fF775485246999027B3197955', 21 | 'USDC': '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', 22 | 'ROUTER': '0x10ED43C718714eb63d5aA57B78B54704E256024E', // pancakeSwap 23 | 'MASTERCHEF': '0xa5f8C5Dbd5F286960b9d90548680aE5ebFf07652', 24 | } 25 | } 26 | 27 | module.exports = tokens; -------------------------------------------------------------------------------- /script-5-empty-ethereum-wallet/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @LastEditors: Bot80926 3 | * @Description: transfer all base token(eth/bnb/kcs/...) balance from one wallet to another wallet. 4 | * @LastEditTime: 2023-04-29 16:33:22 5 | * @FilePath: /ethers-scripts/script-5-empty-ethereum-wallet/index.js 6 | * Copyright (c) 2023 by Bot80926, All Rights Reserved. 7 | */ 8 | 9 | const ethers = require("ethers"); 10 | const Provider = require('../utils/provider') 11 | const chalk = require("chalk"); 12 | 13 | 14 | const to = ''; // received token address 15 | 16 | const wallet = new ethers.Wallet('input your private key here', new Provider({ // from wallet private key 17 | chain: "kcc", 18 | chainId: 322, 19 | fullnode: "https://rpc-testnet.kcc.network", 20 | }).getProvider()); 21 | 22 | 23 | const main = async () => { 24 | const getGasPrice = await wallet.provider.getGasPrice(); 25 | console.log('current gas price:', getGasPrice.toString()); 26 | 27 | // override gasPrice and gasLimit 28 | const overrides = { 29 | gasPrice: getGasPrice._hex, // need hex string 30 | gasLimit: "0x5208" // "21,000", 31 | }; 32 | 33 | const balance = await wallet.getBalance(); 34 | console.log('balance:', ethers.utils.formatEther(balance)); 35 | 36 | const transferBalance = balance.sub(getGasPrice * 21000); // transfer all balance except gas fee 37 | 38 | const tx = await wallet.sendTransaction({ 39 | to, 40 | value: transferBalance._hex, 41 | ...overrides 42 | }); 43 | tx.wait(1); 44 | console.log(chalk.green(`Successfully sent ${ethers.utils.formatEther(transferBalance)} Base Token to ${to}, detail: https://scan-testnet.kcc.network/tx/${tx.hash}`)); 45 | 46 | } 47 | 48 | main(); -------------------------------------------------------------------------------- /script-6-input-data-decoder/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @LastEditors: Bot80926 3 | * @LastEditTime: 2023-05-02 11:47:22 4 | * @FilePath: /ethers-scripts/script-6-input-data-decoder/index.js 5 | * Copyright (c) 2023 by Bot80926, All Rights Reserved. 6 | */ 7 | 8 | const InputDataDecoder = require('ethereum-input-data-decoder'); 9 | const v3Router = require('../abis/pancakeRouterV3.json') 10 | const decoder = new InputDataDecoder(v3Router); 11 | 12 | // tx url: https://etherscan.io/tx/0x4169ddf78be52aade30a6043feac7d6a3b00bddad64e80d27e660761cec7d0ef 13 | // pancake v3 router: https://etherscan.io/address/0x13f4ea83d0bd40e75c8222255bc855a974568dd4#code 14 | const data = '0x5ae401dc00000000000000000000000000000000000000000000000000000000645088eb00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000e404e45aaf000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006982508145454ce325ddbe47a25d4ec3d231193300000000000000000000000000000000000000000000000000000000000009c4000000000000000000000000307e3fdf958e61e593ffd53efa68bd798477c7bd0000000000000000000000000000000000000000000000000058d15e176280000000000000000000000000000000000000000000001d4ebb90dc9195172b5342000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' 15 | const result = decoder.decodeData(data); 16 | console.log(result); 17 | 18 | const multicallData = '0x04e45aaf000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006982508145454ce325ddbe47a25d4ec3d231193300000000000000000000000000000000000000000000000000000000000009c4000000000000000000000000307e3fdf958e61e593ffd53efa68bd798477c7bd0000000000000000000000000000000000000000000000000058d15e176280000000000000000000000000000000000000000000001d4ebb90dc9195172b53420000000000000000000000000000000000000000000000000000000000000000' 19 | const resultMulticallData = decoder.decodeData(multicallData); 20 | console.log(resultMulticallData); -------------------------------------------------------------------------------- /script-2-transfer-token/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @LastEditors: Bot80926 3 | * @Description: Transfer token (including erc20 and base Token, since the script tested in kcc testnet, so the base token is KCS) 4 | * @FilePath: /ethers-scripts/script-2-transfer-token/index.js 5 | * Copyright (c) 2023 by Bot80926, All Rights Reserved. 6 | * Buy me a coffee: 0xa1ebF7E97Cfd6939fb90b27567AEBa5904a66630 7 | * 8 | */ 9 | 10 | // kcc network info: https://docs.kcc.io/developers/network-endpoints 11 | // kcc faucet: https://faucet.kcc.io/ 12 | 13 | const ethers = require("ethers"); 14 | const Provider = require('../utils/provider') 15 | const fs = require("fs"); 16 | const chalk = require("chalk"); 17 | const erc20Abi = require('../abis/erc20.json') 18 | 19 | // input your private key here 20 | const wallet = new ethers.Wallet('replace with your private key', new Provider({ 21 | chain: "kcc", 22 | chainId: 322, 23 | fullnode: "https://rpc-testnet.kcc.network", 24 | }).getProvider()); 25 | 26 | // override gasPrice and gasLimit 27 | const overrides = { 28 | gasPrice: "0x3b9aca00", // "1000000000", 29 | gasLimit: "0x7a120" // "500000", 30 | }; 31 | 32 | const sendBaseToken = async (to, amount) => { 33 | const tx = await wallet.sendTransaction({ 34 | to, 35 | value: ethers.utils.parseEther(amount), 36 | }); 37 | tx.wait(1); 38 | console.log(chalk.green(`Successfully sent ${amount} Base Token to ${to}, detail: https://scan-testnet.kcc.network/tx/${tx.hash}`)); 39 | return tx; 40 | }; 41 | 42 | const sendErc20 = async (to, amount, contractAddress) => { 43 | const contract = new ethers.Contract(contractAddress, erc20Abi, wallet); 44 | const tx = await contract.transfer(to, ethers.utils.parseEther(amount).toString(), overrides); // overrides is optional 45 | tx.wait(1); 46 | console.log(chalk.green(`Successfully sent ${amount} ERC20 to ${to}, detail: https://scan-testnet.kcc.network/tx/${tx.hash}`)); 47 | return tx; 48 | }; 49 | 50 | const main = async () => { 51 | await sendBaseToken('target transfer address', '0.1'); 52 | await sendErc20('target transfer address', '0.1', 'target transfer erc20 token contract address') 53 | }; 54 | 55 | main(); 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ethers-scripts ![](https://img.shields.io/badge/license-MIT-blue) ![](https://img.shields.io/badge/version-v1.0.0-blue) ![](https://img.shields.io/badge/ethers-v4.0.47-blue) ![](https://img.shields.io/badge/nodejs-passing-brightgreen) 2 | 3 | 作者创建这个库的意图 4 | 5 | - 开源简单脚本,方便想要入门 web3 的前端工程师学习 6 | - 技术交流,欢迎大家提 issues 共同进步 7 | - 装笔性,向他人展示自己代码的美好的一面 🌞 8 | - 用代码说话 9 | 10 | Author's intention 11 | 12 | - Open source easy scripts to help frontend engineer who want to learn about web3 13 | - For technical exchanges, everyone is welcome to raise issues and make progress together 14 | - Be cool :sunglasses: 15 | 16 | ## Installation 17 | 18 | ``` 19 | npm install 20 | ``` 21 | 22 | ## Examples 23 | 24 | 运行脚本 1: 快速创建 100 个钱包地址,并生成 txt 文件保存地址和私钥; 25 | 26 | running script-1: create 100 wallet addresses, and init a txt file to record adresses and private keys; 27 | 28 | ```js 29 | cd script-1-create-wallet && node index.js 30 | ``` 31 | 32 | output 33 | 34 | ``` 35 | Successfully created wallets in batches, file name: addr_key_book.txt 36 | ``` 37 | 38 | ## Directory 39 | 40 | - [script-1-create-wallet](https://github.com/Bot80926/ethers-scripts/blob/main/script-1-create-wallet/index.js): 快速创建 100 个钱包地址并生产 txt 文件保存 41 | - [script-2-transfer-token](https://github.com/Bot80926/ethers-scripts/blob/main/script-2-transfer-token/index.js): 向目标地址转账 42 | - [script-3-swap-on-dex](https://github.com/Bot80926/ethers-scripts/blob/main/script-3-swap-on-dex/index.js): 在 dex 里做一笔 swap 交易 43 | - [script-4-bonus-getting-on-dex](https://github.com/Bot80926/ethers-scripts/blob/main/script-4-bonus-getting-on-dex/index.js): 一键完成与 dex 的交互,swap & 添加移除流动性 & farm 44 | - [script-5-empty-ethereum-wallet](https://github.com/Bot80926/ethers-scripts/blob/main/script-5-empty-ethereum-wallet/index.js): 清空一个钱包的余额 45 | - [script-6-input-data-decoder](https://github.com/Bot80926/ethers-scripts/blob/main/script-6-input-data-decoder/index.js): input data 解码 46 | 47 | **EN Directory** 48 | 49 | - [script-1-create-wallet](https://github.com/Bot80926/ethers-scripts/blob/main/script-1-create-wallet/index.js): create 100 wallet addresses and save as txt file 50 | - [script-2-transfer-token](https://github.com/Bot80926/ethers-scripts/blob/main/script-2-transfer-token/index.js): transfer to target address 51 | - [script-3-swap-on-dex](https://github.com/Bot80926/ethers-scripts/blob/main/script-3-swap-on-dex/index.js): swap on target dex 52 | - [script-4-bonus-getting-on-dex](https://github.com/Bot80926/ethers-scripts/blob/main/script-4-bonus-getting-on-dex/index.js): one click finish swap & add liquidity & remove liquidity & farm 53 | - [script-5-empty-ethereum-wallet](https://github.com/Bot80926/ethers-scripts/blob/main/script-5-empty-ethereum-wallet/index.js): empty wallet balance 54 | - [script-6-input-data-decoder](https://github.com/Bot80926/ethers-scripts/blob/main/script-6-input-data-decoder/index.js): input data decoder 55 | 56 | ## Maintainers 57 | 58 | [@Bot80926](https://github.com/Bot80926) 59 | 60 | [中文博客讲解](https://blog.csdn.net/qq_31915745?type=blog) 61 | 62 | ## Contributing 63 | 64 | 欢迎大家踊跃提 issue 65 | 66 | Feel free to dive in! [Open an issue](https://github.com/Bot80926/ethers-scripts/issues/new) or submit PRs. 67 | 68 | ## License 69 | 70 | MIT licensed. 71 | -------------------------------------------------------------------------------- /abis/erc20.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant": true, 4 | "inputs": [], 5 | "name": "name", 6 | "outputs": [{ "name": "", "type": "string" }], 7 | "payable": false, 8 | "stateMutability": "view", 9 | "type": "function" 10 | }, 11 | { 12 | "constant": false, 13 | "inputs": [{ "name": "_spender", "type": "address" }, { "name": "_value", "type": "uint256" }], 14 | "name": "approve", 15 | "outputs": [{ "name": "", "type": "bool" }], 16 | "payable": false, 17 | "stateMutability": "nonpayable", 18 | "type": "function" 19 | }, 20 | { 21 | "constant": true, 22 | "inputs": [], 23 | "name": "totalSupply", 24 | "outputs": [{ "name": "", "type": "uint256" }], 25 | "payable": false, 26 | "stateMutability": "view", 27 | "type": "function" 28 | }, 29 | { 30 | "constant": false, 31 | "inputs": [ 32 | { "name": "_from", "type": "address" }, 33 | { "name": "_to", "type": "address" }, 34 | { "name": "_value", "type": "uint256" } 35 | ], 36 | "name": "transferFrom", 37 | "outputs": [{ "name": "", "type": "bool" }], 38 | "payable": false, 39 | "stateMutability": "nonpayable", 40 | "type": "function" 41 | }, 42 | { 43 | "constant": true, 44 | "inputs": [], 45 | "name": "decimals", 46 | "outputs": [{ "name": "", "type": "uint8" }], 47 | "payable": false, 48 | "stateMutability": "view", 49 | "type": "function" 50 | }, 51 | { 52 | "constant": true, 53 | "inputs": [{ "name": "_owner", "type": "address" }], 54 | "name": "balanceOf", 55 | "outputs": [{ "name": "balance", "type": "uint256" }], 56 | "payable": false, 57 | "stateMutability": "view", 58 | "type": "function" 59 | }, 60 | { 61 | "constant": true, 62 | "inputs": [], 63 | "name": "symbol", 64 | "outputs": [{ "name": "", "type": "string" }], 65 | "payable": false, 66 | "stateMutability": "view", 67 | "type": "function" 68 | }, 69 | { 70 | "constant": false, 71 | "inputs": [{ "name": "_to", "type": "address" }, { "name": "_value", "type": "uint256" }], 72 | "name": "transfer", 73 | "outputs": [{ "name": "", "type": "bool" }], 74 | "payable": false, 75 | "stateMutability": "nonpayable", 76 | "type": "function" 77 | }, 78 | { 79 | "constant": true, 80 | "inputs": [{ "name": "_owner", "type": "address" }, { "name": "_spender", "type": "address" }], 81 | "name": "allowance", 82 | "outputs": [{ "name": "", "type": "uint256" }], 83 | "payable": false, 84 | "stateMutability": "view", 85 | "type": "function" 86 | }, 87 | { "payable": true, "stateMutability": "payable", "type": "fallback" }, 88 | { 89 | "anonymous": false, 90 | "inputs": [ 91 | { "indexed": true, "name": "owner", "type": "address" }, 92 | { "indexed": true, "name": "spender", "type": "address" }, 93 | { "indexed": false, "name": "value", "type": "uint256" } 94 | ], 95 | "name": "Approval", 96 | "type": "event" 97 | }, 98 | { 99 | "anonymous": false, 100 | "inputs": [ 101 | { "indexed": true, "name": "from", "type": "address" }, 102 | { "indexed": true, "name": "to", "type": "address" }, 103 | { "indexed": false, "name": "value", "type": "uint256" } 104 | ], 105 | "name": "Transfer", 106 | "type": "event" 107 | } 108 | ] 109 | -------------------------------------------------------------------------------- /utils/provider.js: -------------------------------------------------------------------------------- 1 | const Ethers = require("ethers"); 2 | 3 | class Provider { 4 | constructor(props = {}) { 5 | this.props = props; 6 | this.chain = props.chain; 7 | this.chainId = props.chainId; 8 | this.fullnode = props.fullnode; 9 | this.provider = new Ethers.providers.JsonRpcProvider(this.fullnode, this.chainId); 10 | } 11 | 12 | getProvider() { 13 | return this.provider; 14 | } 15 | 16 | async getBlockNumber() { 17 | return await this.provider.getBlockNumber(); 18 | } 19 | 20 | async getBlock(blockNumber) { 21 | // const block = await this.provider.getBlock(blockNumber); 22 | const block = await this.provider.send("eth_getBlockByNumber", [Decimal.toHex(blockNumber), false]); 23 | 24 | return { 25 | hash: block.hash, 26 | parentHash: block.parentHash, 27 | number: lodash.toInteger(Decimal.fromHex(block.number)), 28 | timestamp: lodash.toInteger(Decimal.fromHex(block.timestamp)), 29 | nonce: block.nonce, 30 | difficulty: lodash.toInteger(Decimal.fromHex(block.difficulty)), 31 | gasLimit: Decimal.fromHex(block.gasLimit), // 32 | gasUsed: Decimal.fromHex(block.gasUsed), // 33 | miner: block.miner, 34 | extraData: block.extraData, 35 | transactions: block.transactions, 36 | logsBloom: block.logsBloom, 37 | baseFeePerGas: lodash.isUndefined(block.baseFeePerGas) ? null : Decimal.fromHex(block.baseFeePerGas), // 38 | }; 39 | } 40 | 41 | async getChainBalance(address, blockTag = "latest") { 42 | return await this.provider.getBalance(address, blockTag); 43 | } 44 | 45 | async getTokenBalance(address, contract, blockTag = "latest") { 46 | const balanceOfAbi = [{ 47 | "inputs": [{ 48 | "internalType": "address", 49 | "name": "account", 50 | "type": "address", 51 | }, ], 52 | "name": "balanceOf", 53 | "outputs": [{ 54 | "internalType": "uint256", 55 | "name": "", 56 | "type": "uint256", 57 | }, ], 58 | "stateMutability": "view", 59 | "type": "function", 60 | }]; 61 | const erc20 = new Ethers.Contract(contract, balanceOfAbi, this.provider); 62 | 63 | return await erc20.balanceOf(address, { 64 | blockTag 65 | }); 66 | } 67 | 68 | async getTransactionCount(address, blockTag = "latest") { 69 | return await this.provider.getTransactionCount(address, blockTag); 70 | } 71 | 72 | async getTransaction(hash) { 73 | return await this.provider.getTransaction(hash); 74 | } 75 | 76 | async getTransactionReceipt(hash) { 77 | return await this.provider.getTransactionReceipt(hash); 78 | } 79 | 80 | async getTransactionEvent(event) { 81 | let filters = "0123456789".split(""); 82 | let result = { 83 | chain: this.chain, 84 | address: event.address, 85 | blockHash: event.blockHash, 86 | blockNumber: event.blockNumber, 87 | txHash: event.transactionHash, 88 | txIndex: event.transactionIndex, 89 | logIndex: event.logIndex, 90 | event: event.event, 91 | args: {}, 92 | }; 93 | 94 | for (let [key, value] of Object.entries(event.args)) { 95 | if (!lodash.includes(filters, key)) { 96 | result.args[key] = Ethers.BigNumber.isBigNumber(value) ? value.toString() : value; 97 | } 98 | } 99 | 100 | return result; 101 | } 102 | 103 | async getEventList(filter, fromBlock, toBlock) { 104 | const contract = new Ethers.Contract(filter.contract, filter.abi, this.provider); 105 | const result = []; 106 | 107 | // abi should contain a list of all events when using * 108 | const events = await contract.queryFilter("*", fromBlock, toBlock); 109 | for (const event of events) { 110 | if (!!event.args) { 111 | result.push(await this.getTransactionEvent(event)); 112 | } 113 | } 114 | 115 | return result; 116 | } 117 | 118 | async getGasPrice() { 119 | return await this.provider.getGasPrice(); 120 | } 121 | 122 | async estimateGas(transaction) { 123 | return await this.provider.estimateGas(transaction); 124 | } 125 | 126 | async sendTransaction(transaction) { 127 | return await this.provider.sendTransaction(transaction); 128 | } 129 | 130 | async waitForTransaction(hash) { 131 | return await this.provider.waitForTransaction(hash) 132 | } 133 | 134 | } 135 | 136 | module.exports = Provider; -------------------------------------------------------------------------------- /script-3-swap-on-dex/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @LastEditors: Bot80926 3 | * @LastEditTime: 2023-04-27 23:43:08 4 | * @FilePath: /ethers-scripts/script-3-swap-on-dex/index.js 5 | * Copyright (c) 2023 by Bot80926, All Rights Reserved. 6 | */ 7 | 8 | const ethers = require("ethers"); 9 | const Provider = require('../utils/provider') 10 | const fs = require("fs"); 11 | const chalk = require("chalk"); 12 | const erc20 = require('../abis/erc20.json') 13 | const router = require('../abis/router.json') 14 | 15 | const wallet = new ethers.Wallet('input your private key here', new Provider({ 16 | chain: "kcc", 17 | chainId: 322, 18 | fullnode: "https://rpc-testnet.kcc.network", 19 | }).getProvider()); 20 | 21 | // override gasPrice and gasLimit 22 | const overrides = { 23 | gasPrice: "0x3b9aca00", // "1000000000", 24 | gasLimit: "0x7a120" // "500000", 25 | }; 26 | 27 | // in this demo, we choose mojitoSwap as the dex. since it's the biggest dex in kcc. 28 | // you can find more info: https://www.mojitoswap.finance, it's a fork of pancakeSwap and audited by PeckShield. 29 | // not financial advice, just for demo purpose :) 30 | const kcsAddress = '0x6551358EDC7fee9ADAB1E2E49560E68a12E82d9e' 31 | const usdtAddress = '0x67f6a7BbE0da067A747C6b2bEdF8aBBF7D6f60dc' 32 | const usdcAddress = '0xD6c7E27a598714c2226404Eb054e0c074C906Fc9' 33 | const routerAddress = '0x59a4210Dd69FDdE1457905098fF03E0617A548C5' 34 | 35 | const swap = new ethers.Contract(routerAddress, router, wallet); // swap router contract address 36 | const usdt = new ethers.Contract(usdtAddress, erc20, wallet); // usdt contract address 37 | const usdc = new ethers.Contract(usdcAddress, erc20, wallet); // usdc contract address 38 | const transferAmount = '0.1' 39 | 40 | const checkUSDTBalance = async () => { 41 | const balance = await usdt.balanceOf(wallet.address); 42 | console.log(chalk.green(`USDT balance: ${ethers.utils.formatEther(balance)}`)); 43 | return balance; 44 | } 45 | 46 | const checkKCSBalance = async () => { 47 | const balance = await wallet.getBalance(); 48 | console.log(chalk.green(`KCS balance: ${ethers.utils.formatEther(balance)}`)); 49 | return balance; 50 | } 51 | 52 | const approveUSDT = async () => { 53 | const tx = await usdt.approve( 54 | swap.address, 55 | ethers.utils.parseEther("1000000000"), // max approve amount 56 | overrides 57 | ); 58 | tx.wait(1); 59 | console.log(chalk.green(`Successfully approve USDT, detail: https://scan-testnet.kcc.network/tx/${tx.hash}`)); 60 | return tx; 61 | } 62 | 63 | const swapKCS2USDT = async () => { 64 | const tx = await swap.swapExactETHForTokens( 65 | 0, // min amount of usdt 66 | [ // path 67 | kcsAddress, // kcs contract address 68 | usdtAddress, // usdt contract address 69 | ], 70 | wallet.address, 71 | Date.now() + 1000 * 60 * 10, // deadline 72 | { 73 | value: ethers.utils.parseEther(transferAmount), // amount of kcs 74 | ...overrides, 75 | } 76 | ); 77 | tx.wait(1); 78 | console.log(chalk.green(`Successfully swap ${transferAmount} KCS to USDT, detail: https://scan-testnet.kcc.network/tx/${tx.hash}`)); 79 | return tx; 80 | } 81 | 82 | const swapUSDT2KCS = async () => { 83 | const tx = await swap.swapExactTokensForETH( 84 | ethers.utils.parseEther(transferAmount), // amount of usdt 85 | 0, // min amount of kcs 86 | [ // path 87 | usdtAddress, // usdt contract address 88 | kcsAddress, // kcs contract address 89 | ], 90 | wallet.address, 91 | Date.now() + 1000 * 60 * 10, // deadline 92 | overrides 93 | ); 94 | tx.wait(1); 95 | console.log(chalk.green(`Successfully swap ${transferAmount} USDT to KCS, detail: https://scan-testnet.kcc.network/tx/${tx.hash}`)); 96 | return tx; 97 | } 98 | 99 | const swapUSDT2USDC = async () => { 100 | const tx = await swap.swapExactTokensForTokens( 101 | ethers.utils.parseEther(transferAmount), // amount of usdt 102 | 0, // min amount of usdc 103 | [ // path 104 | usdtAddress, // usdt contract address 105 | usdcAddress, // usdc contract address 106 | ], 107 | wallet.address, 108 | Date.now() + 1000 * 60 * 10, // deadline 109 | overrides 110 | ); 111 | tx.wait(1); 112 | console.log(chalk.green(`Successfully swap ${transferAmount} USDT to USDC, detail: https://scan-testnet.kcc.network/tx/${tx.hash}`)); 113 | return tx; 114 | } 115 | 116 | 117 | const main = async () => { 118 | 119 | // step1: check balance 120 | const usdtBalance = await checkUSDTBalance(); 121 | const kcsBalance = await checkKCSBalance(); 122 | 123 | // step2: if ksc, just swap or if usdt, approve and swap 124 | if (Number(ethers.utils.formatEther(kcsBalance)) > 0.1) { // KCS balance need to > 0.1, since we swap 0.1 kcs to usdt and we need to pay gas fee 125 | await swapKCS2USDT(); 126 | } 127 | 128 | if (Number(ethers.utils.formatEther(usdtBalance)) >= 0.2) { // 0.2 is min amount of usdt, since we swap 0.1 usdt to kcs and 0.1 usdt to usdc 129 | await approveUSDT(); 130 | await swapUSDT2KCS(); 131 | await swapUSDT2USDC(); 132 | } 133 | 134 | }; 135 | 136 | main(); -------------------------------------------------------------------------------- /script-4-bonus-getting-on-dex/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @LastEditors: Bot80926 3 | * @Description: run the script to swap & add liquidity & stake LP token to get bonus. 一键完成dex交互,包括swap/添加流动性/质押LP挖矿。撸羊毛的必备脚本 4 | * @LastEditTime: 2023-04-29 10:56:31 5 | * @FilePath: /ethers-scripts/script-4-bonus-getting-on-dex/index.js 6 | * Copyright (c) 2023 by Bot80926, All Rights Reserved. 7 | */ 8 | 9 | const ethers = require("ethers"); 10 | const Provider = require('../utils/provider') 11 | const fs = require("fs"); 12 | const chalk = require("chalk"); 13 | const erc20 = require('../abis/erc20.json') 14 | const router = require('../abis/router.json') 15 | const masterchef = require('../abis/masterchef.json') 16 | const tokens = require('../constants/tokens') 17 | 18 | const wallet = new ethers.Wallet('input your private key here', new Provider({ 19 | chain: "kcc", 20 | chainId: 322, 21 | fullnode: "https://rpc-testnet.kcc.network", 22 | }).getProvider()); 23 | 24 | // override gasPrice and gasLimit 25 | const overrides = { 26 | gasPrice: "0x3b9aca00", // "1000000000", 27 | gasLimit: "0x7a120" // "500000", 28 | }; 29 | 30 | const routerContract = new ethers.Contract(tokens["kcc-testnet"].ROUTER, router, wallet); 31 | const masterchefContract = new ethers.Contract(tokens["kcc-testnet"].MASTERCHEF, masterchef, wallet); 32 | const usdtContract = new ethers.Contract(tokens["kcc-testnet"].USDT, erc20, wallet); 33 | const lpToken = new ethers.Contract(tokens["kcc-testnet"].KCS_USDT_LP, erc20, wallet); 34 | 35 | const amount = '0.1' // swap 0.1 KCS to USDT & add 0.1KCS & 0.1USDT to LP pool 36 | let lpBalance = '' 37 | 38 | const swapKCS2USDT = async () => { 39 | const tx = await routerContract.swapExactETHForTokens( 40 | 0, // min amount of usdt 41 | [ // path 42 | tokens["kcc-testnet"].BASE_TOKEN, // kcs contract address 43 | tokens["kcc-testnet"].USDT, // usdt contract address 44 | ], 45 | wallet.address, 46 | Date.now() + 1000 * 60 * 10, // deadline 47 | { 48 | value: ethers.utils.parseEther(amount), // amount of kcs 49 | ...overrides 50 | } 51 | ); 52 | tx.wait(1); 53 | console.log(chalk.green(`Successfully swap ${amount} KCS to USDT`)); 54 | return tx; 55 | } 56 | 57 | const swapUSDT2KCS = async () => { 58 | const tx = await routerContract.swapExactTokensForETH( 59 | ethers.utils.parseEther(amount), // amount of usdt 60 | 0, // min amount of kcs 61 | [ // path 62 | tokens["kcc-testnet"].USDT, // usdt contract address 63 | tokens["kcc-testnet"].BASE_TOKEN, // kcs contract address 64 | ], 65 | wallet.address, 66 | Date.now() + 1000 * 60 * 10, // deadline 67 | overrides 68 | ); 69 | tx.wait(1); 70 | console.log(chalk.green(`Successfully swap ${amount} USDT to KCS`)); 71 | return tx; 72 | } 73 | 74 | const approveLP2Router = async () => { 75 | const tx1 = await usdtContract.approve(tokens["kcc-testnet"].ROUTER, ethers.constants.MaxUint256) 76 | const tx2 = await lpToken.approve(tokens["kcc-testnet"].ROUTER, ethers.constants.MaxUint256) 77 | const tx3 = await lpToken.approve(tokens["kcc-testnet"].MASTERCHEF, ethers.constants.MaxUint256) 78 | 79 | tx1.wait(1); 80 | tx2.wait(1); 81 | tx3.wait(1); 82 | 83 | console.log(chalk.green(`Successfully approve USDT to Router & LP to Router & LP to masterChef`)); 84 | } 85 | 86 | // add liquidity KCS & USDT 87 | const addLiquidity = async (tokenB, amountA, amountB) => { 88 | const tx = await routerContract.addLiquidityETH( 89 | tokenB, 90 | ethers.utils.parseEther(amountB), // amountBDesired 91 | ethers.utils.parseEther(amountA), // minAmountA 92 | ethers.utils.parseEther(amountB), // minAmountB 93 | wallet.address, 94 | Date.now() + 1000 * 60 * 10, { 95 | value: ethers.utils.parseEther(amountA), // amountA 96 | ...overrides 97 | } 98 | ); 99 | tx.wait(1); 100 | console.log(chalk.green(`Successfully added liquidity KCS/USDT `)); 101 | return tx; 102 | } 103 | 104 | const depositLP2MasterChef = async () => { 105 | lpBalance = await lpToken.balanceOf(wallet.address) 106 | const tx = await masterchefContract.deposit(1, lpBalance.toString(), overrides) 107 | tx.wait(1); 108 | console.log(chalk.green(`Successfully deposit LP token to masterchef`)); 109 | return tx; 110 | } 111 | 112 | const withdrawLP2MasterChef = async () => { 113 | const tx = await masterchefContract.withdraw(1, lpBalance.toString(), overrides) 114 | tx.wait(1); 115 | console.log(chalk.green(`Successfully withdraw LP token from masterchef`)); 116 | return tx; 117 | } 118 | 119 | const removeLPFromRouter = async () => { 120 | const tx = await routerContract.removeLiquidity( 121 | tokens["kcc-testnet"].BASE_TOKEN, 122 | tokens["kcc-testnet"].USDT, 123 | lpBalance.toString(), 124 | '0', 125 | '0', 126 | wallet.address, 127 | Date.now() + 1000 * 60 * 10, 128 | overrides 129 | ); 130 | tx.wait(1); 131 | console.log(chalk.green(`Successfully remove liquidity KCS/USDT `)); 132 | return tx; 133 | } 134 | 135 | const main = async () => { 136 | 137 | const kcsBalance = await wallet.getBalance() 138 | const usdtBalance = await usdtContract.balanceOf(wallet.address) 139 | 140 | // // swap twice times 141 | if (Number(ethers.utils.formatEther(kcsBalance)) > Number(amount) * 1.5 && Number(ethers.utils.formatEther(usdtBalance)) > Number(amount)) { // amount times 150% in order to confirm that the balance is sufficient, no exact value, just > 100% 142 | await approveLP2Router(); 143 | await swapKCS2USDT(); 144 | await swapUSDT2KCS(); 145 | } else { 146 | console.log(chalk.red(`KCS or USDT balance is not enough, please check your wallet`)); 147 | } 148 | 149 | // add liquidity 150 | await addLiquidity(tokens["kcc-testnet"].USDT, '0.0001', '0.1'); 151 | 152 | // deposit LP token & withdraw 153 | await depositLP2MasterChef(); 154 | await withdrawLP2MasterChef(); 155 | 156 | // remove liquidity 157 | await removeLPFromRouter(); 158 | 159 | console.log('Done: 2 swap, 1 add liquidity, 1 deposit, 1 withdraw, 1 remove liquidity') 160 | 161 | }; 162 | 163 | main(); -------------------------------------------------------------------------------- /abis/masterChef.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "contract IMojitoToken", 6 | "name": "_mojito", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "uint256", 11 | "name": "_mojitoPerBlock", 12 | "type": "uint256" 13 | }, 14 | { 15 | "internalType": "uint256", 16 | "name": "_startBlock", 17 | "type": "uint256" 18 | } 19 | ], 20 | "stateMutability": "nonpayable", 21 | "type": "constructor" 22 | }, 23 | { 24 | "anonymous": false, 25 | "inputs": [ 26 | { 27 | "indexed": true, 28 | "internalType": "uint256", 29 | "name": "previousDecayRateNumerator", 30 | "type": "uint256" 31 | }, 32 | { 33 | "indexed": true, 34 | "internalType": "uint256", 35 | "name": "newDecayRateNumerator", 36 | "type": "uint256" 37 | } 38 | ], 39 | "name": "DecayRateNumeratorTransferred", 40 | "type": "event" 41 | }, 42 | { 43 | "anonymous": false, 44 | "inputs": [ 45 | { 46 | "indexed": true, 47 | "internalType": "address", 48 | "name": "user", 49 | "type": "address" 50 | }, 51 | { 52 | "indexed": true, 53 | "internalType": "uint256", 54 | "name": "pid", 55 | "type": "uint256" 56 | }, 57 | { 58 | "indexed": false, 59 | "internalType": "uint256", 60 | "name": "amount", 61 | "type": "uint256" 62 | } 63 | ], 64 | "name": "Deposit", 65 | "type": "event" 66 | }, 67 | { 68 | "anonymous": false, 69 | "inputs": [ 70 | { 71 | "indexed": true, 72 | "internalType": "address", 73 | "name": "user", 74 | "type": "address" 75 | }, 76 | { 77 | "indexed": true, 78 | "internalType": "uint256", 79 | "name": "pid", 80 | "type": "uint256" 81 | }, 82 | { 83 | "indexed": false, 84 | "internalType": "uint256", 85 | "name": "amount", 86 | "type": "uint256" 87 | } 88 | ], 89 | "name": "EmergencyWithdraw", 90 | "type": "event" 91 | }, 92 | { 93 | "anonymous": false, 94 | "inputs": [ 95 | { 96 | "indexed": true, 97 | "internalType": "uint256", 98 | "name": "previousEpochStartBlock", 99 | "type": "uint256" 100 | }, 101 | { 102 | "indexed": true, 103 | "internalType": "uint256", 104 | "name": "newEpochStartBlock", 105 | "type": "uint256" 106 | } 107 | ], 108 | "name": "EpochStartBlockTransferred", 109 | "type": "event" 110 | }, 111 | { 112 | "anonymous": false, 113 | "inputs": [ 114 | { 115 | "indexed": true, 116 | "internalType": "uint256", 117 | "name": "previousMintPeriodDuration", 118 | "type": "uint256" 119 | }, 120 | { 121 | "indexed": true, 122 | "internalType": "uint256", 123 | "name": "newMintPeriodDuration", 124 | "type": "uint256" 125 | } 126 | ], 127 | "name": "MintPeriodDurationTransferred", 128 | "type": "event" 129 | }, 130 | { 131 | "anonymous": false, 132 | "inputs": [ 133 | { 134 | "indexed": true, 135 | "internalType": "uint256", 136 | "name": "previousMojitoPerBlock", 137 | "type": "uint256" 138 | }, 139 | { 140 | "indexed": true, 141 | "internalType": "uint256", 142 | "name": "newMojitoPerBlock", 143 | "type": "uint256" 144 | } 145 | ], 146 | "name": "MojitoPerBlockTransferred", 147 | "type": "event" 148 | }, 149 | { 150 | "anonymous": false, 151 | "inputs": [ 152 | { 153 | "indexed": true, 154 | "internalType": "address", 155 | "name": "previousOwner", 156 | "type": "address" 157 | }, 158 | { 159 | "indexed": true, 160 | "internalType": "address", 161 | "name": "newOwner", 162 | "type": "address" 163 | } 164 | ], 165 | "name": "OwnershipTransferred", 166 | "type": "event" 167 | }, 168 | { 169 | "anonymous": false, 170 | "inputs": [ 171 | { 172 | "indexed": true, 173 | "internalType": "address", 174 | "name": "user", 175 | "type": "address" 176 | }, 177 | { 178 | "indexed": true, 179 | "internalType": "uint256", 180 | "name": "pid", 181 | "type": "uint256" 182 | }, 183 | { 184 | "indexed": false, 185 | "internalType": "uint256", 186 | "name": "amount", 187 | "type": "uint256" 188 | } 189 | ], 190 | "name": "Withdraw", 191 | "type": "event" 192 | }, 193 | { 194 | "inputs": [], 195 | "name": "BONUS_MULTIPLIER", 196 | "outputs": [ 197 | { 198 | "internalType": "uint256", 199 | "name": "", 200 | "type": "uint256" 201 | } 202 | ], 203 | "stateMutability": "view", 204 | "type": "function" 205 | }, 206 | { 207 | "inputs": [], 208 | "name": "decayRateDenominator", 209 | "outputs": [ 210 | { 211 | "internalType": "uint256", 212 | "name": "", 213 | "type": "uint256" 214 | } 215 | ], 216 | "stateMutability": "view", 217 | "type": "function" 218 | }, 219 | { 220 | "inputs": [], 221 | "name": "decayRateNumerator", 222 | "outputs": [ 223 | { 224 | "internalType": "uint256", 225 | "name": "", 226 | "type": "uint256" 227 | } 228 | ], 229 | "stateMutability": "view", 230 | "type": "function" 231 | }, 232 | { 233 | "inputs": [ 234 | { 235 | "internalType": "uint256", 236 | "name": "blockNumber", 237 | "type": "uint256" 238 | } 239 | ], 240 | "name": "epoch", 241 | "outputs": [ 242 | { 243 | "internalType": "uint256", 244 | "name": "", 245 | "type": "uint256" 246 | } 247 | ], 248 | "stateMutability": "view", 249 | "type": "function" 250 | }, 251 | { 252 | "inputs": [], 253 | "name": "epochStartBlock", 254 | "outputs": [ 255 | { 256 | "internalType": "uint256", 257 | "name": "", 258 | "type": "uint256" 259 | } 260 | ], 261 | "stateMutability": "view", 262 | "type": "function" 263 | }, 264 | { 265 | "inputs": [], 266 | "name": "migrator", 267 | "outputs": [ 268 | { 269 | "internalType": "contract IMigratorChef", 270 | "name": "", 271 | "type": "address" 272 | } 273 | ], 274 | "stateMutability": "view", 275 | "type": "function" 276 | }, 277 | { 278 | "inputs": [], 279 | "name": "mintPeriodDuration", 280 | "outputs": [ 281 | { 282 | "internalType": "uint256", 283 | "name": "", 284 | "type": "uint256" 285 | } 286 | ], 287 | "stateMutability": "view", 288 | "type": "function" 289 | }, 290 | { 291 | "inputs": [ 292 | { 293 | "internalType": "uint256", 294 | "name": "blockNumber", 295 | "type": "uint256" 296 | } 297 | ], 298 | "name": "mintable", 299 | "outputs": [ 300 | { 301 | "internalType": "uint256", 302 | "name": "", 303 | "type": "uint256" 304 | } 305 | ], 306 | "stateMutability": "view", 307 | "type": "function" 308 | }, 309 | { 310 | "inputs": [], 311 | "name": "mojito", 312 | "outputs": [ 313 | { 314 | "internalType": "contract IMojitoToken", 315 | "name": "", 316 | "type": "address" 317 | } 318 | ], 319 | "stateMutability": "view", 320 | "type": "function" 321 | }, 322 | { 323 | "inputs": [], 324 | "name": "mojitoPerBlock", 325 | "outputs": [ 326 | { 327 | "internalType": "uint256", 328 | "name": "", 329 | "type": "uint256" 330 | } 331 | ], 332 | "stateMutability": "view", 333 | "type": "function" 334 | }, 335 | { 336 | "inputs": [], 337 | "name": "owner", 338 | "outputs": [ 339 | { 340 | "internalType": "address", 341 | "name": "", 342 | "type": "address" 343 | } 344 | ], 345 | "stateMutability": "view", 346 | "type": "function" 347 | }, 348 | { 349 | "inputs": [ 350 | { 351 | "internalType": "uint256", 352 | "name": "", 353 | "type": "uint256" 354 | } 355 | ], 356 | "name": "poolInfo", 357 | "outputs": [ 358 | { 359 | "internalType": "contract IERC20", 360 | "name": "lpToken", 361 | "type": "address" 362 | }, 363 | { 364 | "internalType": "uint256", 365 | "name": "allocPoint", 366 | "type": "uint256" 367 | }, 368 | { 369 | "internalType": "uint256", 370 | "name": "lastRewardBlock", 371 | "type": "uint256" 372 | }, 373 | { 374 | "internalType": "uint256", 375 | "name": "accMojitoPerShare", 376 | "type": "uint256" 377 | } 378 | ], 379 | "stateMutability": "view", 380 | "type": "function" 381 | }, 382 | { 383 | "inputs": [], 384 | "name": "renounceOwnership", 385 | "outputs": [], 386 | "stateMutability": "nonpayable", 387 | "type": "function" 388 | }, 389 | { 390 | "inputs": [ 391 | { 392 | "internalType": "uint256", 393 | "name": "blockNumber", 394 | "type": "uint256" 395 | } 396 | ], 397 | "name": "reward", 398 | "outputs": [ 399 | { 400 | "internalType": "uint256", 401 | "name": "", 402 | "type": "uint256" 403 | } 404 | ], 405 | "stateMutability": "view", 406 | "type": "function" 407 | }, 408 | { 409 | "inputs": [ 410 | { 411 | "internalType": "uint256", 412 | "name": "_decayRateNumerator", 413 | "type": "uint256" 414 | } 415 | ], 416 | "name": "setDecayRateNumerator", 417 | "outputs": [], 418 | "stateMutability": "nonpayable", 419 | "type": "function" 420 | }, 421 | { 422 | "inputs": [ 423 | { 424 | "internalType": "uint256", 425 | "name": "_epochStartBlock", 426 | "type": "uint256" 427 | } 428 | ], 429 | "name": "setEpochStartBlock", 430 | "outputs": [], 431 | "stateMutability": "nonpayable", 432 | "type": "function" 433 | }, 434 | { 435 | "inputs": [ 436 | { 437 | "internalType": "uint256", 438 | "name": "_mintPeriodDuration", 439 | "type": "uint256" 440 | } 441 | ], 442 | "name": "setMintPeriodDuration", 443 | "outputs": [], 444 | "stateMutability": "nonpayable", 445 | "type": "function" 446 | }, 447 | { 448 | "inputs": [], 449 | "name": "startBlock", 450 | "outputs": [ 451 | { 452 | "internalType": "uint256", 453 | "name": "", 454 | "type": "uint256" 455 | } 456 | ], 457 | "stateMutability": "view", 458 | "type": "function" 459 | }, 460 | { 461 | "inputs": [], 462 | "name": "totalAllocPoint", 463 | "outputs": [ 464 | { 465 | "internalType": "uint256", 466 | "name": "", 467 | "type": "uint256" 468 | } 469 | ], 470 | "stateMutability": "view", 471 | "type": "function" 472 | }, 473 | { 474 | "inputs": [ 475 | { 476 | "internalType": "address", 477 | "name": "newOwner", 478 | "type": "address" 479 | } 480 | ], 481 | "name": "transferOwnership", 482 | "outputs": [], 483 | "stateMutability": "nonpayable", 484 | "type": "function" 485 | }, 486 | { 487 | "inputs": [ 488 | { 489 | "internalType": "uint256", 490 | "name": "", 491 | "type": "uint256" 492 | }, 493 | { 494 | "internalType": "address", 495 | "name": "", 496 | "type": "address" 497 | } 498 | ], 499 | "name": "userInfo", 500 | "outputs": [ 501 | { 502 | "internalType": "uint256", 503 | "name": "amount", 504 | "type": "uint256" 505 | }, 506 | { 507 | "internalType": "uint256", 508 | "name": "rewardDebt", 509 | "type": "uint256" 510 | } 511 | ], 512 | "stateMutability": "view", 513 | "type": "function" 514 | }, 515 | { 516 | "inputs": [ 517 | { 518 | "internalType": "uint256", 519 | "name": "multiplierNumber", 520 | "type": "uint256" 521 | } 522 | ], 523 | "name": "updateMultiplier", 524 | "outputs": [], 525 | "stateMutability": "nonpayable", 526 | "type": "function" 527 | }, 528 | { 529 | "inputs": [], 530 | "name": "poolLength", 531 | "outputs": [ 532 | { 533 | "internalType": "uint256", 534 | "name": "", 535 | "type": "uint256" 536 | } 537 | ], 538 | "stateMutability": "view", 539 | "type": "function" 540 | }, 541 | { 542 | "inputs": [ 543 | { 544 | "internalType": "uint256", 545 | "name": "_allocPoint", 546 | "type": "uint256" 547 | }, 548 | { 549 | "internalType": "contract IERC20", 550 | "name": "_lpToken", 551 | "type": "address" 552 | }, 553 | { 554 | "internalType": "bool", 555 | "name": "_withUpdate", 556 | "type": "bool" 557 | } 558 | ], 559 | "name": "add", 560 | "outputs": [], 561 | "stateMutability": "nonpayable", 562 | "type": "function" 563 | }, 564 | { 565 | "inputs": [ 566 | { 567 | "internalType": "uint256", 568 | "name": "_pid", 569 | "type": "uint256" 570 | }, 571 | { 572 | "internalType": "uint256", 573 | "name": "_allocPoint", 574 | "type": "uint256" 575 | }, 576 | { 577 | "internalType": "bool", 578 | "name": "_withUpdate", 579 | "type": "bool" 580 | } 581 | ], 582 | "name": "set", 583 | "outputs": [], 584 | "stateMutability": "nonpayable", 585 | "type": "function" 586 | }, 587 | { 588 | "inputs": [ 589 | { 590 | "internalType": "contract IMigratorChef", 591 | "name": "_migrator", 592 | "type": "address" 593 | } 594 | ], 595 | "name": "setMigrator", 596 | "outputs": [], 597 | "stateMutability": "nonpayable", 598 | "type": "function" 599 | }, 600 | { 601 | "inputs": [ 602 | { 603 | "internalType": "uint256", 604 | "name": "_mojitoPerBlock", 605 | "type": "uint256" 606 | } 607 | ], 608 | "name": "setMojitoPerBlock", 609 | "outputs": [], 610 | "stateMutability": "nonpayable", 611 | "type": "function" 612 | }, 613 | { 614 | "inputs": [ 615 | { 616 | "internalType": "uint256", 617 | "name": "_pid", 618 | "type": "uint256" 619 | } 620 | ], 621 | "name": "migrate", 622 | "outputs": [], 623 | "stateMutability": "nonpayable", 624 | "type": "function" 625 | }, 626 | { 627 | "inputs": [ 628 | { 629 | "internalType": "uint256", 630 | "name": "_pid", 631 | "type": "uint256" 632 | }, 633 | { 634 | "internalType": "address", 635 | "name": "_user", 636 | "type": "address" 637 | } 638 | ], 639 | "name": "pendingMojito", 640 | "outputs": [ 641 | { 642 | "internalType": "uint256", 643 | "name": "", 644 | "type": "uint256" 645 | } 646 | ], 647 | "stateMutability": "view", 648 | "type": "function" 649 | }, 650 | { 651 | "inputs": [], 652 | "name": "massUpdatePools", 653 | "outputs": [], 654 | "stateMutability": "nonpayable", 655 | "type": "function" 656 | }, 657 | { 658 | "inputs": [ 659 | { 660 | "internalType": "uint256", 661 | "name": "_pid", 662 | "type": "uint256" 663 | } 664 | ], 665 | "name": "updatePool", 666 | "outputs": [], 667 | "stateMutability": "nonpayable", 668 | "type": "function" 669 | }, 670 | { 671 | "inputs": [ 672 | { 673 | "internalType": "uint256", 674 | "name": "_pid", 675 | "type": "uint256" 676 | }, 677 | { 678 | "internalType": "uint256", 679 | "name": "_amount", 680 | "type": "uint256" 681 | } 682 | ], 683 | "name": "deposit", 684 | "outputs": [], 685 | "stateMutability": "nonpayable", 686 | "type": "function" 687 | }, 688 | { 689 | "inputs": [ 690 | { 691 | "internalType": "uint256", 692 | "name": "_pid", 693 | "type": "uint256" 694 | }, 695 | { 696 | "internalType": "uint256", 697 | "name": "_amount", 698 | "type": "uint256" 699 | } 700 | ], 701 | "name": "withdraw", 702 | "outputs": [], 703 | "stateMutability": "nonpayable", 704 | "type": "function" 705 | }, 706 | { 707 | "inputs": [ 708 | { 709 | "internalType": "uint256", 710 | "name": "_amount", 711 | "type": "uint256" 712 | } 713 | ], 714 | "name": "enterStaking", 715 | "outputs": [], 716 | "stateMutability": "nonpayable", 717 | "type": "function" 718 | }, 719 | { 720 | "inputs": [ 721 | { 722 | "internalType": "uint256", 723 | "name": "_amount", 724 | "type": "uint256" 725 | } 726 | ], 727 | "name": "leaveStaking", 728 | "outputs": [], 729 | "stateMutability": "nonpayable", 730 | "type": "function" 731 | }, 732 | { 733 | "inputs": [ 734 | { 735 | "internalType": "uint256", 736 | "name": "_pid", 737 | "type": "uint256" 738 | } 739 | ], 740 | "name": "emergencyWithdraw", 741 | "outputs": [], 742 | "stateMutability": "nonpayable", 743 | "type": "function" 744 | } 745 | ] -------------------------------------------------------------------------------- /abis/router.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs":[ 4 | { 5 | "internalType":"address", 6 | "name":"_factory", 7 | "type":"address" 8 | }, 9 | { 10 | "internalType":"address", 11 | "name":"_WETH", 12 | "type":"address" 13 | } 14 | ], 15 | "stateMutability":"nonpayable", 16 | "type":"constructor" 17 | }, 18 | { 19 | "anonymous":false, 20 | "inputs":[ 21 | { 22 | "indexed":true, 23 | "internalType":"address", 24 | "name":"previousOwner", 25 | "type":"address" 26 | }, 27 | { 28 | "indexed":true, 29 | "internalType":"address", 30 | "name":"newOwner", 31 | "type":"address" 32 | } 33 | ], 34 | "name":"OwnershipTransferred", 35 | "type":"event" 36 | }, 37 | { 38 | "inputs":[ 39 | 40 | ], 41 | "name":"WETH", 42 | "outputs":[ 43 | { 44 | "internalType":"address", 45 | "name":"", 46 | "type":"address" 47 | } 48 | ], 49 | "stateMutability":"view", 50 | "type":"function" 51 | }, 52 | { 53 | "inputs":[ 54 | { 55 | "internalType":"address", 56 | "name":"tokenA", 57 | "type":"address" 58 | }, 59 | { 60 | "internalType":"address", 61 | "name":"tokenB", 62 | "type":"address" 63 | }, 64 | { 65 | "internalType":"uint256", 66 | "name":"amountADesired", 67 | "type":"uint256" 68 | }, 69 | { 70 | "internalType":"uint256", 71 | "name":"amountBDesired", 72 | "type":"uint256" 73 | }, 74 | { 75 | "internalType":"uint256", 76 | "name":"amountAMin", 77 | "type":"uint256" 78 | }, 79 | { 80 | "internalType":"uint256", 81 | "name":"amountBMin", 82 | "type":"uint256" 83 | }, 84 | { 85 | "internalType":"address", 86 | "name":"to", 87 | "type":"address" 88 | }, 89 | { 90 | "internalType":"uint256", 91 | "name":"deadline", 92 | "type":"uint256" 93 | } 94 | ], 95 | "name":"addLiquidity", 96 | "outputs":[ 97 | { 98 | "internalType":"uint256", 99 | "name":"amountA", 100 | "type":"uint256" 101 | }, 102 | { 103 | "internalType":"uint256", 104 | "name":"amountB", 105 | "type":"uint256" 106 | }, 107 | { 108 | "internalType":"uint256", 109 | "name":"liquidity", 110 | "type":"uint256" 111 | } 112 | ], 113 | "stateMutability":"nonpayable", 114 | "type":"function" 115 | }, 116 | { 117 | "inputs":[ 118 | { 119 | "internalType":"address", 120 | "name":"token", 121 | "type":"address" 122 | }, 123 | { 124 | "internalType":"uint256", 125 | "name":"amountTokenDesired", 126 | "type":"uint256" 127 | }, 128 | { 129 | "internalType":"uint256", 130 | "name":"amountTokenMin", 131 | "type":"uint256" 132 | }, 133 | { 134 | "internalType":"uint256", 135 | "name":"amountETHMin", 136 | "type":"uint256" 137 | }, 138 | { 139 | "internalType":"address", 140 | "name":"to", 141 | "type":"address" 142 | }, 143 | { 144 | "internalType":"uint256", 145 | "name":"deadline", 146 | "type":"uint256" 147 | } 148 | ], 149 | "name":"addLiquidityETH", 150 | "outputs":[ 151 | { 152 | "internalType":"uint256", 153 | "name":"amountToken", 154 | "type":"uint256" 155 | }, 156 | { 157 | "internalType":"uint256", 158 | "name":"amountETH", 159 | "type":"uint256" 160 | }, 161 | { 162 | "internalType":"uint256", 163 | "name":"liquidity", 164 | "type":"uint256" 165 | } 166 | ], 167 | "stateMutability":"payable", 168 | "type":"function" 169 | }, 170 | { 171 | "inputs":[ 172 | 173 | ], 174 | "name":"factory", 175 | "outputs":[ 176 | { 177 | "internalType":"address", 178 | "name":"", 179 | "type":"address" 180 | } 181 | ], 182 | "stateMutability":"view", 183 | "type":"function" 184 | }, 185 | { 186 | "inputs":[ 187 | { 188 | "internalType":"uint256", 189 | "name":"amountOut", 190 | "type":"uint256" 191 | }, 192 | { 193 | "internalType":"uint256", 194 | "name":"reserveIn", 195 | "type":"uint256" 196 | }, 197 | { 198 | "internalType":"uint256", 199 | "name":"reserveOut", 200 | "type":"uint256" 201 | }, 202 | { 203 | "internalType":"uint256", 204 | "name":"swapFeeNumerator", 205 | "type":"uint256" 206 | } 207 | ], 208 | "name":"getAmountIn", 209 | "outputs":[ 210 | { 211 | "internalType":"uint256", 212 | "name":"amountIn", 213 | "type":"uint256" 214 | } 215 | ], 216 | "stateMutability":"pure", 217 | "type":"function" 218 | }, 219 | { 220 | "inputs":[ 221 | { 222 | "internalType":"uint256", 223 | "name":"amountIn", 224 | "type":"uint256" 225 | }, 226 | { 227 | "internalType":"uint256", 228 | "name":"reserveIn", 229 | "type":"uint256" 230 | }, 231 | { 232 | "internalType":"uint256", 233 | "name":"reserveOut", 234 | "type":"uint256" 235 | }, 236 | { 237 | "internalType":"uint256", 238 | "name":"swapFeeNumerator", 239 | "type":"uint256" 240 | } 241 | ], 242 | "name":"getAmountOut", 243 | "outputs":[ 244 | { 245 | "internalType":"uint256", 246 | "name":"amountOut", 247 | "type":"uint256" 248 | } 249 | ], 250 | "stateMutability":"pure", 251 | "type":"function" 252 | }, 253 | { 254 | "inputs":[ 255 | { 256 | "internalType":"uint256", 257 | "name":"amountOut", 258 | "type":"uint256" 259 | }, 260 | { 261 | "internalType":"address[]", 262 | "name":"path", 263 | "type":"address[]" 264 | } 265 | ], 266 | "name":"getAmountsIn", 267 | "outputs":[ 268 | { 269 | "internalType":"uint256[]", 270 | "name":"amounts", 271 | "type":"uint256[]" 272 | } 273 | ], 274 | "stateMutability":"view", 275 | "type":"function" 276 | }, 277 | { 278 | "inputs":[ 279 | { 280 | "internalType":"uint256", 281 | "name":"amountIn", 282 | "type":"uint256" 283 | }, 284 | { 285 | "internalType":"address[]", 286 | "name":"path", 287 | "type":"address[]" 288 | } 289 | ], 290 | "name":"getAmountsOut", 291 | "outputs":[ 292 | { 293 | "internalType":"uint256[]", 294 | "name":"amounts", 295 | "type":"uint256[]" 296 | } 297 | ], 298 | "stateMutability":"view", 299 | "type":"function" 300 | }, 301 | { 302 | "inputs":[ 303 | 304 | ], 305 | "name":"owner", 306 | "outputs":[ 307 | { 308 | "internalType":"address", 309 | "name":"", 310 | "type":"address" 311 | } 312 | ], 313 | "stateMutability":"view", 314 | "type":"function" 315 | }, 316 | { 317 | "inputs":[ 318 | { 319 | "internalType":"uint256", 320 | "name":"amountA", 321 | "type":"uint256" 322 | }, 323 | { 324 | "internalType":"uint256", 325 | "name":"reserveA", 326 | "type":"uint256" 327 | }, 328 | { 329 | "internalType":"uint256", 330 | "name":"reserveB", 331 | "type":"uint256" 332 | } 333 | ], 334 | "name":"quote", 335 | "outputs":[ 336 | { 337 | "internalType":"uint256", 338 | "name":"amountB", 339 | "type":"uint256" 340 | } 341 | ], 342 | "stateMutability":"pure", 343 | "type":"function" 344 | }, 345 | { 346 | "inputs":[ 347 | { 348 | "internalType":"address", 349 | "name":"tokenA", 350 | "type":"address" 351 | }, 352 | { 353 | "internalType":"address", 354 | "name":"tokenB", 355 | "type":"address" 356 | }, 357 | { 358 | "internalType":"uint256", 359 | "name":"liquidity", 360 | "type":"uint256" 361 | }, 362 | { 363 | "internalType":"uint256", 364 | "name":"amountAMin", 365 | "type":"uint256" 366 | }, 367 | { 368 | "internalType":"uint256", 369 | "name":"amountBMin", 370 | "type":"uint256" 371 | }, 372 | { 373 | "internalType":"address", 374 | "name":"to", 375 | "type":"address" 376 | }, 377 | { 378 | "internalType":"uint256", 379 | "name":"deadline", 380 | "type":"uint256" 381 | } 382 | ], 383 | "name":"removeLiquidity", 384 | "outputs":[ 385 | { 386 | "internalType":"uint256", 387 | "name":"amountA", 388 | "type":"uint256" 389 | }, 390 | { 391 | "internalType":"uint256", 392 | "name":"amountB", 393 | "type":"uint256" 394 | } 395 | ], 396 | "stateMutability":"nonpayable", 397 | "type":"function" 398 | }, 399 | { 400 | "inputs":[ 401 | { 402 | "internalType":"address", 403 | "name":"token", 404 | "type":"address" 405 | }, 406 | { 407 | "internalType":"uint256", 408 | "name":"liquidity", 409 | "type":"uint256" 410 | }, 411 | { 412 | "internalType":"uint256", 413 | "name":"amountTokenMin", 414 | "type":"uint256" 415 | }, 416 | { 417 | "internalType":"uint256", 418 | "name":"amountETHMin", 419 | "type":"uint256" 420 | }, 421 | { 422 | "internalType":"address", 423 | "name":"to", 424 | "type":"address" 425 | }, 426 | { 427 | "internalType":"uint256", 428 | "name":"deadline", 429 | "type":"uint256" 430 | } 431 | ], 432 | "name":"removeLiquidityETH", 433 | "outputs":[ 434 | { 435 | "internalType":"uint256", 436 | "name":"amountToken", 437 | "type":"uint256" 438 | }, 439 | { 440 | "internalType":"uint256", 441 | "name":"amountETH", 442 | "type":"uint256" 443 | } 444 | ], 445 | "stateMutability":"nonpayable", 446 | "type":"function" 447 | }, 448 | { 449 | "inputs":[ 450 | { 451 | "internalType":"address", 452 | "name":"token", 453 | "type":"address" 454 | }, 455 | { 456 | "internalType":"uint256", 457 | "name":"liquidity", 458 | "type":"uint256" 459 | }, 460 | { 461 | "internalType":"uint256", 462 | "name":"amountTokenMin", 463 | "type":"uint256" 464 | }, 465 | { 466 | "internalType":"uint256", 467 | "name":"amountETHMin", 468 | "type":"uint256" 469 | }, 470 | { 471 | "internalType":"address", 472 | "name":"to", 473 | "type":"address" 474 | }, 475 | { 476 | "internalType":"uint256", 477 | "name":"deadline", 478 | "type":"uint256" 479 | } 480 | ], 481 | "name":"removeLiquidityETHSupportingFeeOnTransferTokens", 482 | "outputs":[ 483 | { 484 | "internalType":"uint256", 485 | "name":"amountETH", 486 | "type":"uint256" 487 | } 488 | ], 489 | "stateMutability":"nonpayable", 490 | "type":"function" 491 | }, 492 | { 493 | "inputs":[ 494 | { 495 | "internalType":"address", 496 | "name":"token", 497 | "type":"address" 498 | }, 499 | { 500 | "internalType":"uint256", 501 | "name":"liquidity", 502 | "type":"uint256" 503 | }, 504 | { 505 | "internalType":"uint256", 506 | "name":"amountTokenMin", 507 | "type":"uint256" 508 | }, 509 | { 510 | "internalType":"uint256", 511 | "name":"amountETHMin", 512 | "type":"uint256" 513 | }, 514 | { 515 | "internalType":"address", 516 | "name":"to", 517 | "type":"address" 518 | }, 519 | { 520 | "internalType":"uint256", 521 | "name":"deadline", 522 | "type":"uint256" 523 | }, 524 | { 525 | "internalType":"bool", 526 | "name":"approveMax", 527 | "type":"bool" 528 | }, 529 | { 530 | "internalType":"uint8", 531 | "name":"v", 532 | "type":"uint8" 533 | }, 534 | { 535 | "internalType":"bytes32", 536 | "name":"r", 537 | "type":"bytes32" 538 | }, 539 | { 540 | "internalType":"bytes32", 541 | "name":"s", 542 | "type":"bytes32" 543 | } 544 | ], 545 | "name":"removeLiquidityETHWithPermit", 546 | "outputs":[ 547 | { 548 | "internalType":"uint256", 549 | "name":"amountToken", 550 | "type":"uint256" 551 | }, 552 | { 553 | "internalType":"uint256", 554 | "name":"amountETH", 555 | "type":"uint256" 556 | } 557 | ], 558 | "stateMutability":"nonpayable", 559 | "type":"function" 560 | }, 561 | { 562 | "inputs":[ 563 | { 564 | "internalType":"address", 565 | "name":"token", 566 | "type":"address" 567 | }, 568 | { 569 | "internalType":"uint256", 570 | "name":"liquidity", 571 | "type":"uint256" 572 | }, 573 | { 574 | "internalType":"uint256", 575 | "name":"amountTokenMin", 576 | "type":"uint256" 577 | }, 578 | { 579 | "internalType":"uint256", 580 | "name":"amountETHMin", 581 | "type":"uint256" 582 | }, 583 | { 584 | "internalType":"address", 585 | "name":"to", 586 | "type":"address" 587 | }, 588 | { 589 | "internalType":"uint256", 590 | "name":"deadline", 591 | "type":"uint256" 592 | }, 593 | { 594 | "internalType":"bool", 595 | "name":"approveMax", 596 | "type":"bool" 597 | }, 598 | { 599 | "internalType":"uint8", 600 | "name":"v", 601 | "type":"uint8" 602 | }, 603 | { 604 | "internalType":"bytes32", 605 | "name":"r", 606 | "type":"bytes32" 607 | }, 608 | { 609 | "internalType":"bytes32", 610 | "name":"s", 611 | "type":"bytes32" 612 | } 613 | ], 614 | "name":"removeLiquidityETHWithPermitSupportingFeeOnTransferTokens", 615 | "outputs":[ 616 | { 617 | "internalType":"uint256", 618 | "name":"amountETH", 619 | "type":"uint256" 620 | } 621 | ], 622 | "stateMutability":"nonpayable", 623 | "type":"function" 624 | }, 625 | { 626 | "inputs":[ 627 | { 628 | "internalType":"address", 629 | "name":"tokenA", 630 | "type":"address" 631 | }, 632 | { 633 | "internalType":"address", 634 | "name":"tokenB", 635 | "type":"address" 636 | }, 637 | { 638 | "internalType":"uint256", 639 | "name":"liquidity", 640 | "type":"uint256" 641 | }, 642 | { 643 | "internalType":"uint256", 644 | "name":"amountAMin", 645 | "type":"uint256" 646 | }, 647 | { 648 | "internalType":"uint256", 649 | "name":"amountBMin", 650 | "type":"uint256" 651 | }, 652 | { 653 | "internalType":"address", 654 | "name":"to", 655 | "type":"address" 656 | }, 657 | { 658 | "internalType":"uint256", 659 | "name":"deadline", 660 | "type":"uint256" 661 | }, 662 | { 663 | "internalType":"bool", 664 | "name":"approveMax", 665 | "type":"bool" 666 | }, 667 | { 668 | "internalType":"uint8", 669 | "name":"v", 670 | "type":"uint8" 671 | }, 672 | { 673 | "internalType":"bytes32", 674 | "name":"r", 675 | "type":"bytes32" 676 | }, 677 | { 678 | "internalType":"bytes32", 679 | "name":"s", 680 | "type":"bytes32" 681 | } 682 | ], 683 | "name":"removeLiquidityWithPermit", 684 | "outputs":[ 685 | { 686 | "internalType":"uint256", 687 | "name":"amountA", 688 | "type":"uint256" 689 | }, 690 | { 691 | "internalType":"uint256", 692 | "name":"amountB", 693 | "type":"uint256" 694 | } 695 | ], 696 | "stateMutability":"nonpayable", 697 | "type":"function" 698 | }, 699 | { 700 | "inputs":[ 701 | 702 | ], 703 | "name":"renounceOwnership", 704 | "outputs":[ 705 | 706 | ], 707 | "stateMutability":"nonpayable", 708 | "type":"function" 709 | }, 710 | { 711 | "inputs":[ 712 | { 713 | "internalType":"address", 714 | "name":"_swapMininng", 715 | "type":"address" 716 | } 717 | ], 718 | "name":"setSwapMining", 719 | "outputs":[ 720 | 721 | ], 722 | "stateMutability":"nonpayable", 723 | "type":"function" 724 | }, 725 | { 726 | "inputs":[ 727 | { 728 | "internalType":"uint256", 729 | "name":"amountOut", 730 | "type":"uint256" 731 | }, 732 | { 733 | "internalType":"address[]", 734 | "name":"path", 735 | "type":"address[]" 736 | }, 737 | { 738 | "internalType":"address", 739 | "name":"to", 740 | "type":"address" 741 | }, 742 | { 743 | "internalType":"uint256", 744 | "name":"deadline", 745 | "type":"uint256" 746 | } 747 | ], 748 | "name":"swapETHForExactTokens", 749 | "outputs":[ 750 | { 751 | "internalType":"uint256[]", 752 | "name":"amounts", 753 | "type":"uint256[]" 754 | } 755 | ], 756 | "stateMutability":"payable", 757 | "type":"function" 758 | }, 759 | { 760 | "inputs":[ 761 | { 762 | "internalType":"uint256", 763 | "name":"amountOutMin", 764 | "type":"uint256" 765 | }, 766 | { 767 | "internalType":"address[]", 768 | "name":"path", 769 | "type":"address[]" 770 | }, 771 | { 772 | "internalType":"address", 773 | "name":"to", 774 | "type":"address" 775 | }, 776 | { 777 | "internalType":"uint256", 778 | "name":"deadline", 779 | "type":"uint256" 780 | } 781 | ], 782 | "name":"swapExactETHForTokens", 783 | "outputs":[ 784 | { 785 | "internalType":"uint256[]", 786 | "name":"amounts", 787 | "type":"uint256[]" 788 | } 789 | ], 790 | "stateMutability":"payable", 791 | "type":"function" 792 | }, 793 | { 794 | "inputs":[ 795 | { 796 | "internalType":"uint256", 797 | "name":"amountOutMin", 798 | "type":"uint256" 799 | }, 800 | { 801 | "internalType":"address[]", 802 | "name":"path", 803 | "type":"address[]" 804 | }, 805 | { 806 | "internalType":"address", 807 | "name":"to", 808 | "type":"address" 809 | }, 810 | { 811 | "internalType":"uint256", 812 | "name":"deadline", 813 | "type":"uint256" 814 | } 815 | ], 816 | "name":"swapExactETHForTokensSupportingFeeOnTransferTokens", 817 | "outputs":[ 818 | 819 | ], 820 | "stateMutability":"payable", 821 | "type":"function" 822 | }, 823 | { 824 | "inputs":[ 825 | { 826 | "internalType":"uint256", 827 | "name":"amountIn", 828 | "type":"uint256" 829 | }, 830 | { 831 | "internalType":"uint256", 832 | "name":"amountOutMin", 833 | "type":"uint256" 834 | }, 835 | { 836 | "internalType":"address[]", 837 | "name":"path", 838 | "type":"address[]" 839 | }, 840 | { 841 | "internalType":"address", 842 | "name":"to", 843 | "type":"address" 844 | }, 845 | { 846 | "internalType":"uint256", 847 | "name":"deadline", 848 | "type":"uint256" 849 | } 850 | ], 851 | "name":"swapExactTokensForETH", 852 | "outputs":[ 853 | { 854 | "internalType":"uint256[]", 855 | "name":"amounts", 856 | "type":"uint256[]" 857 | } 858 | ], 859 | "stateMutability":"nonpayable", 860 | "type":"function" 861 | }, 862 | { 863 | "inputs":[ 864 | { 865 | "internalType":"uint256", 866 | "name":"amountIn", 867 | "type":"uint256" 868 | }, 869 | { 870 | "internalType":"uint256", 871 | "name":"amountOutMin", 872 | "type":"uint256" 873 | }, 874 | { 875 | "internalType":"address[]", 876 | "name":"path", 877 | "type":"address[]" 878 | }, 879 | { 880 | "internalType":"address", 881 | "name":"to", 882 | "type":"address" 883 | }, 884 | { 885 | "internalType":"uint256", 886 | "name":"deadline", 887 | "type":"uint256" 888 | } 889 | ], 890 | "name":"swapExactTokensForETHSupportingFeeOnTransferTokens", 891 | "outputs":[ 892 | 893 | ], 894 | "stateMutability":"nonpayable", 895 | "type":"function" 896 | }, 897 | { 898 | "inputs":[ 899 | { 900 | "internalType":"uint256", 901 | "name":"amountIn", 902 | "type":"uint256" 903 | }, 904 | { 905 | "internalType":"uint256", 906 | "name":"amountOutMin", 907 | "type":"uint256" 908 | }, 909 | { 910 | "internalType":"address[]", 911 | "name":"path", 912 | "type":"address[]" 913 | }, 914 | { 915 | "internalType":"address", 916 | "name":"to", 917 | "type":"address" 918 | }, 919 | { 920 | "internalType":"uint256", 921 | "name":"deadline", 922 | "type":"uint256" 923 | } 924 | ], 925 | "name":"swapExactTokensForTokens", 926 | "outputs":[ 927 | { 928 | "internalType":"uint256[]", 929 | "name":"amounts", 930 | "type":"uint256[]" 931 | } 932 | ], 933 | "stateMutability":"nonpayable", 934 | "type":"function" 935 | }, 936 | { 937 | "inputs":[ 938 | { 939 | "internalType":"uint256", 940 | "name":"amountIn", 941 | "type":"uint256" 942 | }, 943 | { 944 | "internalType":"uint256", 945 | "name":"amountOutMin", 946 | "type":"uint256" 947 | }, 948 | { 949 | "internalType":"address[]", 950 | "name":"path", 951 | "type":"address[]" 952 | }, 953 | { 954 | "internalType":"address", 955 | "name":"to", 956 | "type":"address" 957 | }, 958 | { 959 | "internalType":"uint256", 960 | "name":"deadline", 961 | "type":"uint256" 962 | } 963 | ], 964 | "name":"swapExactTokensForTokensSupportingFeeOnTransferTokens", 965 | "outputs":[ 966 | 967 | ], 968 | "stateMutability":"nonpayable", 969 | "type":"function" 970 | }, 971 | { 972 | "inputs":[ 973 | 974 | ], 975 | "name":"swapMining", 976 | "outputs":[ 977 | { 978 | "internalType":"address", 979 | "name":"", 980 | "type":"address" 981 | } 982 | ], 983 | "stateMutability":"view", 984 | "type":"function" 985 | }, 986 | { 987 | "inputs":[ 988 | { 989 | "internalType":"uint256", 990 | "name":"amountOut", 991 | "type":"uint256" 992 | }, 993 | { 994 | "internalType":"uint256", 995 | "name":"amountInMax", 996 | "type":"uint256" 997 | }, 998 | { 999 | "internalType":"address[]", 1000 | "name":"path", 1001 | "type":"address[]" 1002 | }, 1003 | { 1004 | "internalType":"address", 1005 | "name":"to", 1006 | "type":"address" 1007 | }, 1008 | { 1009 | "internalType":"uint256", 1010 | "name":"deadline", 1011 | "type":"uint256" 1012 | } 1013 | ], 1014 | "name":"swapTokensForExactETH", 1015 | "outputs":[ 1016 | { 1017 | "internalType":"uint256[]", 1018 | "name":"amounts", 1019 | "type":"uint256[]" 1020 | } 1021 | ], 1022 | "stateMutability":"nonpayable", 1023 | "type":"function" 1024 | }, 1025 | { 1026 | "inputs":[ 1027 | { 1028 | "internalType":"uint256", 1029 | "name":"amountOut", 1030 | "type":"uint256" 1031 | }, 1032 | { 1033 | "internalType":"uint256", 1034 | "name":"amountInMax", 1035 | "type":"uint256" 1036 | }, 1037 | { 1038 | "internalType":"address[]", 1039 | "name":"path", 1040 | "type":"address[]" 1041 | }, 1042 | { 1043 | "internalType":"address", 1044 | "name":"to", 1045 | "type":"address" 1046 | }, 1047 | { 1048 | "internalType":"uint256", 1049 | "name":"deadline", 1050 | "type":"uint256" 1051 | } 1052 | ], 1053 | "name":"swapTokensForExactTokens", 1054 | "outputs":[ 1055 | { 1056 | "internalType":"uint256[]", 1057 | "name":"amounts", 1058 | "type":"uint256[]" 1059 | } 1060 | ], 1061 | "stateMutability":"nonpayable", 1062 | "type":"function" 1063 | }, 1064 | { 1065 | "inputs":[ 1066 | { 1067 | "internalType":"address", 1068 | "name":"newOwner", 1069 | "type":"address" 1070 | } 1071 | ], 1072 | "name":"transferOwnership", 1073 | "outputs":[ 1074 | 1075 | ], 1076 | "stateMutability":"nonpayable", 1077 | "type":"function" 1078 | }, 1079 | { 1080 | "stateMutability":"payable", 1081 | "type":"receive" 1082 | } 1083 | ] -------------------------------------------------------------------------------- /abis/pancakeRouterV3.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs":[ 4 | { 5 | "internalType":"address", 6 | "name":"_factoryV2", 7 | "type":"address" 8 | }, 9 | { 10 | "internalType":"address", 11 | "name":"_deployer", 12 | "type":"address" 13 | }, 14 | { 15 | "internalType":"address", 16 | "name":"_factoryV3", 17 | "type":"address" 18 | }, 19 | { 20 | "internalType":"address", 21 | "name":"_positionManager", 22 | "type":"address" 23 | }, 24 | { 25 | "internalType":"address", 26 | "name":"_stableFactory", 27 | "type":"address" 28 | }, 29 | { 30 | "internalType":"address", 31 | "name":"_stableInfo", 32 | "type":"address" 33 | }, 34 | { 35 | "internalType":"address", 36 | "name":"_WETH9", 37 | "type":"address" 38 | } 39 | ], 40 | "stateMutability":"nonpayable", 41 | "type":"constructor" 42 | }, 43 | { 44 | "anonymous":false, 45 | "inputs":[ 46 | { 47 | "indexed":true, 48 | "internalType":"address", 49 | "name":"previousOwner", 50 | "type":"address" 51 | }, 52 | { 53 | "indexed":true, 54 | "internalType":"address", 55 | "name":"newOwner", 56 | "type":"address" 57 | } 58 | ], 59 | "name":"OwnershipTransferred", 60 | "type":"event" 61 | }, 62 | { 63 | "anonymous":false, 64 | "inputs":[ 65 | { 66 | "indexed":true, 67 | "internalType":"address", 68 | "name":"factory", 69 | "type":"address" 70 | }, 71 | { 72 | "indexed":true, 73 | "internalType":"address", 74 | "name":"info", 75 | "type":"address" 76 | } 77 | ], 78 | "name":"SetStableSwap", 79 | "type":"event" 80 | }, 81 | { 82 | "inputs":[ 83 | 84 | ], 85 | "name":"WETH9", 86 | "outputs":[ 87 | { 88 | "internalType":"address", 89 | "name":"", 90 | "type":"address" 91 | } 92 | ], 93 | "stateMutability":"view", 94 | "type":"function" 95 | }, 96 | { 97 | "inputs":[ 98 | { 99 | "internalType":"address", 100 | "name":"token", 101 | "type":"address" 102 | } 103 | ], 104 | "name":"approveMax", 105 | "outputs":[ 106 | 107 | ], 108 | "stateMutability":"payable", 109 | "type":"function" 110 | }, 111 | { 112 | "inputs":[ 113 | { 114 | "internalType":"address", 115 | "name":"token", 116 | "type":"address" 117 | } 118 | ], 119 | "name":"approveMaxMinusOne", 120 | "outputs":[ 121 | 122 | ], 123 | "stateMutability":"payable", 124 | "type":"function" 125 | }, 126 | { 127 | "inputs":[ 128 | { 129 | "internalType":"address", 130 | "name":"token", 131 | "type":"address" 132 | } 133 | ], 134 | "name":"approveZeroThenMax", 135 | "outputs":[ 136 | 137 | ], 138 | "stateMutability":"payable", 139 | "type":"function" 140 | }, 141 | { 142 | "inputs":[ 143 | { 144 | "internalType":"address", 145 | "name":"token", 146 | "type":"address" 147 | } 148 | ], 149 | "name":"approveZeroThenMaxMinusOne", 150 | "outputs":[ 151 | 152 | ], 153 | "stateMutability":"payable", 154 | "type":"function" 155 | }, 156 | { 157 | "inputs":[ 158 | { 159 | "internalType":"bytes", 160 | "name":"data", 161 | "type":"bytes" 162 | } 163 | ], 164 | "name":"callPositionManager", 165 | "outputs":[ 166 | { 167 | "internalType":"bytes", 168 | "name":"result", 169 | "type":"bytes" 170 | } 171 | ], 172 | "stateMutability":"payable", 173 | "type":"function" 174 | }, 175 | { 176 | "inputs":[ 177 | { 178 | "internalType":"bytes[]", 179 | "name":"paths", 180 | "type":"bytes[]" 181 | }, 182 | { 183 | "internalType":"uint128[]", 184 | "name":"amounts", 185 | "type":"uint128[]" 186 | }, 187 | { 188 | "internalType":"uint24", 189 | "name":"maximumTickDivergence", 190 | "type":"uint24" 191 | }, 192 | { 193 | "internalType":"uint32", 194 | "name":"secondsAgo", 195 | "type":"uint32" 196 | } 197 | ], 198 | "name":"checkOracleSlippage", 199 | "outputs":[ 200 | 201 | ], 202 | "stateMutability":"view", 203 | "type":"function" 204 | }, 205 | { 206 | "inputs":[ 207 | { 208 | "internalType":"bytes", 209 | "name":"path", 210 | "type":"bytes" 211 | }, 212 | { 213 | "internalType":"uint24", 214 | "name":"maximumTickDivergence", 215 | "type":"uint24" 216 | }, 217 | { 218 | "internalType":"uint32", 219 | "name":"secondsAgo", 220 | "type":"uint32" 221 | } 222 | ], 223 | "name":"checkOracleSlippage", 224 | "outputs":[ 225 | 226 | ], 227 | "stateMutability":"view", 228 | "type":"function" 229 | }, 230 | { 231 | "inputs":[ 232 | 233 | ], 234 | "name":"deployer", 235 | "outputs":[ 236 | { 237 | "internalType":"address", 238 | "name":"", 239 | "type":"address" 240 | } 241 | ], 242 | "stateMutability":"view", 243 | "type":"function" 244 | }, 245 | { 246 | "inputs":[ 247 | { 248 | "components":[ 249 | { 250 | "internalType":"bytes", 251 | "name":"path", 252 | "type":"bytes" 253 | }, 254 | { 255 | "internalType":"address", 256 | "name":"recipient", 257 | "type":"address" 258 | }, 259 | { 260 | "internalType":"uint256", 261 | "name":"amountIn", 262 | "type":"uint256" 263 | }, 264 | { 265 | "internalType":"uint256", 266 | "name":"amountOutMinimum", 267 | "type":"uint256" 268 | } 269 | ], 270 | "internalType":"struct IV3SwapRouter.ExactInputParams", 271 | "name":"params", 272 | "type":"tuple" 273 | } 274 | ], 275 | "name":"exactInput", 276 | "outputs":[ 277 | { 278 | "internalType":"uint256", 279 | "name":"amountOut", 280 | "type":"uint256" 281 | } 282 | ], 283 | "stateMutability":"payable", 284 | "type":"function" 285 | }, 286 | { 287 | "inputs":[ 288 | { 289 | "components":[ 290 | { 291 | "internalType":"address", 292 | "name":"tokenIn", 293 | "type":"address" 294 | }, 295 | { 296 | "internalType":"address", 297 | "name":"tokenOut", 298 | "type":"address" 299 | }, 300 | { 301 | "internalType":"uint24", 302 | "name":"fee", 303 | "type":"uint24" 304 | }, 305 | { 306 | "internalType":"address", 307 | "name":"recipient", 308 | "type":"address" 309 | }, 310 | { 311 | "internalType":"uint256", 312 | "name":"amountIn", 313 | "type":"uint256" 314 | }, 315 | { 316 | "internalType":"uint256", 317 | "name":"amountOutMinimum", 318 | "type":"uint256" 319 | }, 320 | { 321 | "internalType":"uint160", 322 | "name":"sqrtPriceLimitX96", 323 | "type":"uint160" 324 | } 325 | ], 326 | "internalType":"struct IV3SwapRouter.ExactInputSingleParams", 327 | "name":"params", 328 | "type":"tuple" 329 | } 330 | ], 331 | "name":"exactInputSingle", 332 | "outputs":[ 333 | { 334 | "internalType":"uint256", 335 | "name":"amountOut", 336 | "type":"uint256" 337 | } 338 | ], 339 | "stateMutability":"payable", 340 | "type":"function" 341 | }, 342 | { 343 | "inputs":[ 344 | { 345 | "internalType":"address[]", 346 | "name":"path", 347 | "type":"address[]" 348 | }, 349 | { 350 | "internalType":"uint256[]", 351 | "name":"flag", 352 | "type":"uint256[]" 353 | }, 354 | { 355 | "internalType":"uint256", 356 | "name":"amountIn", 357 | "type":"uint256" 358 | }, 359 | { 360 | "internalType":"uint256", 361 | "name":"amountOutMin", 362 | "type":"uint256" 363 | }, 364 | { 365 | "internalType":"address", 366 | "name":"to", 367 | "type":"address" 368 | } 369 | ], 370 | "name":"exactInputStableSwap", 371 | "outputs":[ 372 | { 373 | "internalType":"uint256", 374 | "name":"amountOut", 375 | "type":"uint256" 376 | } 377 | ], 378 | "stateMutability":"payable", 379 | "type":"function" 380 | }, 381 | { 382 | "inputs":[ 383 | { 384 | "components":[ 385 | { 386 | "internalType":"bytes", 387 | "name":"path", 388 | "type":"bytes" 389 | }, 390 | { 391 | "internalType":"address", 392 | "name":"recipient", 393 | "type":"address" 394 | }, 395 | { 396 | "internalType":"uint256", 397 | "name":"amountOut", 398 | "type":"uint256" 399 | }, 400 | { 401 | "internalType":"uint256", 402 | "name":"amountInMaximum", 403 | "type":"uint256" 404 | } 405 | ], 406 | "internalType":"struct IV3SwapRouter.ExactOutputParams", 407 | "name":"params", 408 | "type":"tuple" 409 | } 410 | ], 411 | "name":"exactOutput", 412 | "outputs":[ 413 | { 414 | "internalType":"uint256", 415 | "name":"amountIn", 416 | "type":"uint256" 417 | } 418 | ], 419 | "stateMutability":"payable", 420 | "type":"function" 421 | }, 422 | { 423 | "inputs":[ 424 | { 425 | "components":[ 426 | { 427 | "internalType":"address", 428 | "name":"tokenIn", 429 | "type":"address" 430 | }, 431 | { 432 | "internalType":"address", 433 | "name":"tokenOut", 434 | "type":"address" 435 | }, 436 | { 437 | "internalType":"uint24", 438 | "name":"fee", 439 | "type":"uint24" 440 | }, 441 | { 442 | "internalType":"address", 443 | "name":"recipient", 444 | "type":"address" 445 | }, 446 | { 447 | "internalType":"uint256", 448 | "name":"amountOut", 449 | "type":"uint256" 450 | }, 451 | { 452 | "internalType":"uint256", 453 | "name":"amountInMaximum", 454 | "type":"uint256" 455 | }, 456 | { 457 | "internalType":"uint160", 458 | "name":"sqrtPriceLimitX96", 459 | "type":"uint160" 460 | } 461 | ], 462 | "internalType":"struct IV3SwapRouter.ExactOutputSingleParams", 463 | "name":"params", 464 | "type":"tuple" 465 | } 466 | ], 467 | "name":"exactOutputSingle", 468 | "outputs":[ 469 | { 470 | "internalType":"uint256", 471 | "name":"amountIn", 472 | "type":"uint256" 473 | } 474 | ], 475 | "stateMutability":"payable", 476 | "type":"function" 477 | }, 478 | { 479 | "inputs":[ 480 | { 481 | "internalType":"address[]", 482 | "name":"path", 483 | "type":"address[]" 484 | }, 485 | { 486 | "internalType":"uint256[]", 487 | "name":"flag", 488 | "type":"uint256[]" 489 | }, 490 | { 491 | "internalType":"uint256", 492 | "name":"amountOut", 493 | "type":"uint256" 494 | }, 495 | { 496 | "internalType":"uint256", 497 | "name":"amountInMax", 498 | "type":"uint256" 499 | }, 500 | { 501 | "internalType":"address", 502 | "name":"to", 503 | "type":"address" 504 | } 505 | ], 506 | "name":"exactOutputStableSwap", 507 | "outputs":[ 508 | { 509 | "internalType":"uint256", 510 | "name":"amountIn", 511 | "type":"uint256" 512 | } 513 | ], 514 | "stateMutability":"payable", 515 | "type":"function" 516 | }, 517 | { 518 | "inputs":[ 519 | 520 | ], 521 | "name":"factory", 522 | "outputs":[ 523 | { 524 | "internalType":"address", 525 | "name":"", 526 | "type":"address" 527 | } 528 | ], 529 | "stateMutability":"view", 530 | "type":"function" 531 | }, 532 | { 533 | "inputs":[ 534 | 535 | ], 536 | "name":"factoryV2", 537 | "outputs":[ 538 | { 539 | "internalType":"address", 540 | "name":"", 541 | "type":"address" 542 | } 543 | ], 544 | "stateMutability":"view", 545 | "type":"function" 546 | }, 547 | { 548 | "inputs":[ 549 | { 550 | "internalType":"address", 551 | "name":"token", 552 | "type":"address" 553 | }, 554 | { 555 | "internalType":"uint256", 556 | "name":"amount", 557 | "type":"uint256" 558 | } 559 | ], 560 | "name":"getApprovalType", 561 | "outputs":[ 562 | { 563 | "internalType":"enum IApproveAndCall.ApprovalType", 564 | "name":"", 565 | "type":"uint8" 566 | } 567 | ], 568 | "stateMutability":"nonpayable", 569 | "type":"function" 570 | }, 571 | { 572 | "inputs":[ 573 | { 574 | "components":[ 575 | { 576 | "internalType":"address", 577 | "name":"token0", 578 | "type":"address" 579 | }, 580 | { 581 | "internalType":"address", 582 | "name":"token1", 583 | "type":"address" 584 | }, 585 | { 586 | "internalType":"uint256", 587 | "name":"tokenId", 588 | "type":"uint256" 589 | }, 590 | { 591 | "internalType":"uint256", 592 | "name":"amount0Min", 593 | "type":"uint256" 594 | }, 595 | { 596 | "internalType":"uint256", 597 | "name":"amount1Min", 598 | "type":"uint256" 599 | } 600 | ], 601 | "internalType":"struct IApproveAndCall.IncreaseLiquidityParams", 602 | "name":"params", 603 | "type":"tuple" 604 | } 605 | ], 606 | "name":"increaseLiquidity", 607 | "outputs":[ 608 | { 609 | "internalType":"bytes", 610 | "name":"result", 611 | "type":"bytes" 612 | } 613 | ], 614 | "stateMutability":"payable", 615 | "type":"function" 616 | }, 617 | { 618 | "inputs":[ 619 | { 620 | "components":[ 621 | { 622 | "internalType":"address", 623 | "name":"token0", 624 | "type":"address" 625 | }, 626 | { 627 | "internalType":"address", 628 | "name":"token1", 629 | "type":"address" 630 | }, 631 | { 632 | "internalType":"uint24", 633 | "name":"fee", 634 | "type":"uint24" 635 | }, 636 | { 637 | "internalType":"int24", 638 | "name":"tickLower", 639 | "type":"int24" 640 | }, 641 | { 642 | "internalType":"int24", 643 | "name":"tickUpper", 644 | "type":"int24" 645 | }, 646 | { 647 | "internalType":"uint256", 648 | "name":"amount0Min", 649 | "type":"uint256" 650 | }, 651 | { 652 | "internalType":"uint256", 653 | "name":"amount1Min", 654 | "type":"uint256" 655 | }, 656 | { 657 | "internalType":"address", 658 | "name":"recipient", 659 | "type":"address" 660 | } 661 | ], 662 | "internalType":"struct IApproveAndCall.MintParams", 663 | "name":"params", 664 | "type":"tuple" 665 | } 666 | ], 667 | "name":"mint", 668 | "outputs":[ 669 | { 670 | "internalType":"bytes", 671 | "name":"result", 672 | "type":"bytes" 673 | } 674 | ], 675 | "stateMutability":"payable", 676 | "type":"function" 677 | }, 678 | { 679 | "inputs":[ 680 | { 681 | "internalType":"bytes32", 682 | "name":"previousBlockhash", 683 | "type":"bytes32" 684 | }, 685 | { 686 | "internalType":"bytes[]", 687 | "name":"data", 688 | "type":"bytes[]" 689 | } 690 | ], 691 | "name":"multicall", 692 | "outputs":[ 693 | { 694 | "internalType":"bytes[]", 695 | "name":"", 696 | "type":"bytes[]" 697 | } 698 | ], 699 | "stateMutability":"payable", 700 | "type":"function" 701 | }, 702 | { 703 | "inputs":[ 704 | { 705 | "internalType":"uint256", 706 | "name":"deadline", 707 | "type":"uint256" 708 | }, 709 | { 710 | "internalType":"bytes[]", 711 | "name":"data", 712 | "type":"bytes[]" 713 | } 714 | ], 715 | "name":"multicall", 716 | "outputs":[ 717 | { 718 | "internalType":"bytes[]", 719 | "name":"", 720 | "type":"bytes[]" 721 | } 722 | ], 723 | "stateMutability":"payable", 724 | "type":"function" 725 | }, 726 | { 727 | "inputs":[ 728 | { 729 | "internalType":"bytes[]", 730 | "name":"data", 731 | "type":"bytes[]" 732 | } 733 | ], 734 | "name":"multicall", 735 | "outputs":[ 736 | { 737 | "internalType":"bytes[]", 738 | "name":"results", 739 | "type":"bytes[]" 740 | } 741 | ], 742 | "stateMutability":"payable", 743 | "type":"function" 744 | }, 745 | { 746 | "inputs":[ 747 | 748 | ], 749 | "name":"owner", 750 | "outputs":[ 751 | { 752 | "internalType":"address", 753 | "name":"", 754 | "type":"address" 755 | } 756 | ], 757 | "stateMutability":"view", 758 | "type":"function" 759 | }, 760 | { 761 | "inputs":[ 762 | { 763 | "internalType":"int256", 764 | "name":"amount0Delta", 765 | "type":"int256" 766 | }, 767 | { 768 | "internalType":"int256", 769 | "name":"amount1Delta", 770 | "type":"int256" 771 | }, 772 | { 773 | "internalType":"bytes", 774 | "name":"_data", 775 | "type":"bytes" 776 | } 777 | ], 778 | "name":"pancakeV3SwapCallback", 779 | "outputs":[ 780 | 781 | ], 782 | "stateMutability":"nonpayable", 783 | "type":"function" 784 | }, 785 | { 786 | "inputs":[ 787 | 788 | ], 789 | "name":"positionManager", 790 | "outputs":[ 791 | { 792 | "internalType":"address", 793 | "name":"", 794 | "type":"address" 795 | } 796 | ], 797 | "stateMutability":"view", 798 | "type":"function" 799 | }, 800 | { 801 | "inputs":[ 802 | { 803 | "internalType":"address", 804 | "name":"token", 805 | "type":"address" 806 | }, 807 | { 808 | "internalType":"uint256", 809 | "name":"value", 810 | "type":"uint256" 811 | } 812 | ], 813 | "name":"pull", 814 | "outputs":[ 815 | 816 | ], 817 | "stateMutability":"payable", 818 | "type":"function" 819 | }, 820 | { 821 | "inputs":[ 822 | 823 | ], 824 | "name":"refundETH", 825 | "outputs":[ 826 | 827 | ], 828 | "stateMutability":"payable", 829 | "type":"function" 830 | }, 831 | { 832 | "inputs":[ 833 | 834 | ], 835 | "name":"renounceOwnership", 836 | "outputs":[ 837 | 838 | ], 839 | "stateMutability":"nonpayable", 840 | "type":"function" 841 | }, 842 | { 843 | "inputs":[ 844 | { 845 | "internalType":"address", 846 | "name":"token", 847 | "type":"address" 848 | }, 849 | { 850 | "internalType":"uint256", 851 | "name":"value", 852 | "type":"uint256" 853 | }, 854 | { 855 | "internalType":"uint256", 856 | "name":"deadline", 857 | "type":"uint256" 858 | }, 859 | { 860 | "internalType":"uint8", 861 | "name":"v", 862 | "type":"uint8" 863 | }, 864 | { 865 | "internalType":"bytes32", 866 | "name":"r", 867 | "type":"bytes32" 868 | }, 869 | { 870 | "internalType":"bytes32", 871 | "name":"s", 872 | "type":"bytes32" 873 | } 874 | ], 875 | "name":"selfPermit", 876 | "outputs":[ 877 | 878 | ], 879 | "stateMutability":"payable", 880 | "type":"function" 881 | }, 882 | { 883 | "inputs":[ 884 | { 885 | "internalType":"address", 886 | "name":"token", 887 | "type":"address" 888 | }, 889 | { 890 | "internalType":"uint256", 891 | "name":"nonce", 892 | "type":"uint256" 893 | }, 894 | { 895 | "internalType":"uint256", 896 | "name":"expiry", 897 | "type":"uint256" 898 | }, 899 | { 900 | "internalType":"uint8", 901 | "name":"v", 902 | "type":"uint8" 903 | }, 904 | { 905 | "internalType":"bytes32", 906 | "name":"r", 907 | "type":"bytes32" 908 | }, 909 | { 910 | "internalType":"bytes32", 911 | "name":"s", 912 | "type":"bytes32" 913 | } 914 | ], 915 | "name":"selfPermitAllowed", 916 | "outputs":[ 917 | 918 | ], 919 | "stateMutability":"payable", 920 | "type":"function" 921 | }, 922 | { 923 | "inputs":[ 924 | { 925 | "internalType":"address", 926 | "name":"token", 927 | "type":"address" 928 | }, 929 | { 930 | "internalType":"uint256", 931 | "name":"nonce", 932 | "type":"uint256" 933 | }, 934 | { 935 | "internalType":"uint256", 936 | "name":"expiry", 937 | "type":"uint256" 938 | }, 939 | { 940 | "internalType":"uint8", 941 | "name":"v", 942 | "type":"uint8" 943 | }, 944 | { 945 | "internalType":"bytes32", 946 | "name":"r", 947 | "type":"bytes32" 948 | }, 949 | { 950 | "internalType":"bytes32", 951 | "name":"s", 952 | "type":"bytes32" 953 | } 954 | ], 955 | "name":"selfPermitAllowedIfNecessary", 956 | "outputs":[ 957 | 958 | ], 959 | "stateMutability":"payable", 960 | "type":"function" 961 | }, 962 | { 963 | "inputs":[ 964 | { 965 | "internalType":"address", 966 | "name":"token", 967 | "type":"address" 968 | }, 969 | { 970 | "internalType":"uint256", 971 | "name":"value", 972 | "type":"uint256" 973 | }, 974 | { 975 | "internalType":"uint256", 976 | "name":"deadline", 977 | "type":"uint256" 978 | }, 979 | { 980 | "internalType":"uint8", 981 | "name":"v", 982 | "type":"uint8" 983 | }, 984 | { 985 | "internalType":"bytes32", 986 | "name":"r", 987 | "type":"bytes32" 988 | }, 989 | { 990 | "internalType":"bytes32", 991 | "name":"s", 992 | "type":"bytes32" 993 | } 994 | ], 995 | "name":"selfPermitIfNecessary", 996 | "outputs":[ 997 | 998 | ], 999 | "stateMutability":"payable", 1000 | "type":"function" 1001 | }, 1002 | { 1003 | "inputs":[ 1004 | { 1005 | "internalType":"address", 1006 | "name":"_factory", 1007 | "type":"address" 1008 | }, 1009 | { 1010 | "internalType":"address", 1011 | "name":"_info", 1012 | "type":"address" 1013 | } 1014 | ], 1015 | "name":"setStableSwap", 1016 | "outputs":[ 1017 | 1018 | ], 1019 | "stateMutability":"nonpayable", 1020 | "type":"function" 1021 | }, 1022 | { 1023 | "inputs":[ 1024 | 1025 | ], 1026 | "name":"stableSwapFactory", 1027 | "outputs":[ 1028 | { 1029 | "internalType":"address", 1030 | "name":"", 1031 | "type":"address" 1032 | } 1033 | ], 1034 | "stateMutability":"view", 1035 | "type":"function" 1036 | }, 1037 | { 1038 | "inputs":[ 1039 | 1040 | ], 1041 | "name":"stableSwapInfo", 1042 | "outputs":[ 1043 | { 1044 | "internalType":"address", 1045 | "name":"", 1046 | "type":"address" 1047 | } 1048 | ], 1049 | "stateMutability":"view", 1050 | "type":"function" 1051 | }, 1052 | { 1053 | "inputs":[ 1054 | { 1055 | "internalType":"uint256", 1056 | "name":"amountIn", 1057 | "type":"uint256" 1058 | }, 1059 | { 1060 | "internalType":"uint256", 1061 | "name":"amountOutMin", 1062 | "type":"uint256" 1063 | }, 1064 | { 1065 | "internalType":"address[]", 1066 | "name":"path", 1067 | "type":"address[]" 1068 | }, 1069 | { 1070 | "internalType":"address", 1071 | "name":"to", 1072 | "type":"address" 1073 | } 1074 | ], 1075 | "name":"swapExactTokensForTokens", 1076 | "outputs":[ 1077 | { 1078 | "internalType":"uint256", 1079 | "name":"amountOut", 1080 | "type":"uint256" 1081 | } 1082 | ], 1083 | "stateMutability":"payable", 1084 | "type":"function" 1085 | }, 1086 | { 1087 | "inputs":[ 1088 | { 1089 | "internalType":"uint256", 1090 | "name":"amountOut", 1091 | "type":"uint256" 1092 | }, 1093 | { 1094 | "internalType":"uint256", 1095 | "name":"amountInMax", 1096 | "type":"uint256" 1097 | }, 1098 | { 1099 | "internalType":"address[]", 1100 | "name":"path", 1101 | "type":"address[]" 1102 | }, 1103 | { 1104 | "internalType":"address", 1105 | "name":"to", 1106 | "type":"address" 1107 | } 1108 | ], 1109 | "name":"swapTokensForExactTokens", 1110 | "outputs":[ 1111 | { 1112 | "internalType":"uint256", 1113 | "name":"amountIn", 1114 | "type":"uint256" 1115 | } 1116 | ], 1117 | "stateMutability":"payable", 1118 | "type":"function" 1119 | }, 1120 | { 1121 | "inputs":[ 1122 | { 1123 | "internalType":"address", 1124 | "name":"token", 1125 | "type":"address" 1126 | }, 1127 | { 1128 | "internalType":"uint256", 1129 | "name":"amountMinimum", 1130 | "type":"uint256" 1131 | }, 1132 | { 1133 | "internalType":"address", 1134 | "name":"recipient", 1135 | "type":"address" 1136 | } 1137 | ], 1138 | "name":"sweepToken", 1139 | "outputs":[ 1140 | 1141 | ], 1142 | "stateMutability":"payable", 1143 | "type":"function" 1144 | }, 1145 | { 1146 | "inputs":[ 1147 | { 1148 | "internalType":"address", 1149 | "name":"token", 1150 | "type":"address" 1151 | }, 1152 | { 1153 | "internalType":"uint256", 1154 | "name":"amountMinimum", 1155 | "type":"uint256" 1156 | } 1157 | ], 1158 | "name":"sweepToken", 1159 | "outputs":[ 1160 | 1161 | ], 1162 | "stateMutability":"payable", 1163 | "type":"function" 1164 | }, 1165 | { 1166 | "inputs":[ 1167 | { 1168 | "internalType":"address", 1169 | "name":"token", 1170 | "type":"address" 1171 | }, 1172 | { 1173 | "internalType":"uint256", 1174 | "name":"amountMinimum", 1175 | "type":"uint256" 1176 | }, 1177 | { 1178 | "internalType":"uint256", 1179 | "name":"feeBips", 1180 | "type":"uint256" 1181 | }, 1182 | { 1183 | "internalType":"address", 1184 | "name":"feeRecipient", 1185 | "type":"address" 1186 | } 1187 | ], 1188 | "name":"sweepTokenWithFee", 1189 | "outputs":[ 1190 | 1191 | ], 1192 | "stateMutability":"payable", 1193 | "type":"function" 1194 | }, 1195 | { 1196 | "inputs":[ 1197 | { 1198 | "internalType":"address", 1199 | "name":"token", 1200 | "type":"address" 1201 | }, 1202 | { 1203 | "internalType":"uint256", 1204 | "name":"amountMinimum", 1205 | "type":"uint256" 1206 | }, 1207 | { 1208 | "internalType":"address", 1209 | "name":"recipient", 1210 | "type":"address" 1211 | }, 1212 | { 1213 | "internalType":"uint256", 1214 | "name":"feeBips", 1215 | "type":"uint256" 1216 | }, 1217 | { 1218 | "internalType":"address", 1219 | "name":"feeRecipient", 1220 | "type":"address" 1221 | } 1222 | ], 1223 | "name":"sweepTokenWithFee", 1224 | "outputs":[ 1225 | 1226 | ], 1227 | "stateMutability":"payable", 1228 | "type":"function" 1229 | }, 1230 | { 1231 | "inputs":[ 1232 | { 1233 | "internalType":"address", 1234 | "name":"newOwner", 1235 | "type":"address" 1236 | } 1237 | ], 1238 | "name":"transferOwnership", 1239 | "outputs":[ 1240 | 1241 | ], 1242 | "stateMutability":"nonpayable", 1243 | "type":"function" 1244 | }, 1245 | { 1246 | "inputs":[ 1247 | { 1248 | "internalType":"uint256", 1249 | "name":"amountMinimum", 1250 | "type":"uint256" 1251 | }, 1252 | { 1253 | "internalType":"address", 1254 | "name":"recipient", 1255 | "type":"address" 1256 | } 1257 | ], 1258 | "name":"unwrapWETH9", 1259 | "outputs":[ 1260 | 1261 | ], 1262 | "stateMutability":"payable", 1263 | "type":"function" 1264 | }, 1265 | { 1266 | "inputs":[ 1267 | { 1268 | "internalType":"uint256", 1269 | "name":"amountMinimum", 1270 | "type":"uint256" 1271 | }, 1272 | { 1273 | "internalType":"address", 1274 | "name":"recipient", 1275 | "type":"address" 1276 | }, 1277 | { 1278 | "internalType":"uint256", 1279 | "name":"feeBips", 1280 | "type":"uint256" 1281 | }, 1282 | { 1283 | "internalType":"address", 1284 | "name":"feeRecipient", 1285 | "type":"address" 1286 | } 1287 | ], 1288 | "name":"unwrapWETH9WithFee", 1289 | "outputs":[ 1290 | 1291 | ], 1292 | "stateMutability":"payable", 1293 | "type":"function" 1294 | }, 1295 | { 1296 | "inputs":[ 1297 | { 1298 | "internalType":"uint256", 1299 | "name":"amountMinimum", 1300 | "type":"uint256" 1301 | }, 1302 | { 1303 | "internalType":"uint256", 1304 | "name":"feeBips", 1305 | "type":"uint256" 1306 | }, 1307 | { 1308 | "internalType":"address", 1309 | "name":"feeRecipient", 1310 | "type":"address" 1311 | } 1312 | ], 1313 | "name":"unwrapWETH9WithFee", 1314 | "outputs":[ 1315 | 1316 | ], 1317 | "stateMutability":"payable", 1318 | "type":"function" 1319 | }, 1320 | { 1321 | "inputs":[ 1322 | { 1323 | "internalType":"uint256", 1324 | "name":"value", 1325 | "type":"uint256" 1326 | } 1327 | ], 1328 | "name":"wrapETH", 1329 | "outputs":[ 1330 | 1331 | ], 1332 | "stateMutability":"payable", 1333 | "type":"function" 1334 | }, 1335 | { 1336 | "stateMutability":"payable", 1337 | "type":"receive" 1338 | } 1339 | ] --------------------------------------------------------------------------------