├── .gitignore ├── README.md ├── config.ts ├── const ├── erc20.json └── index.ts ├── index.ts ├── package.json ├── pnpm-lock.yaml ├── tasks ├── airswap │ ├── abi.ts │ └── index.ts ├── base.ts ├── cashmere │ └── index.ts ├── compound │ ├── abi.ts │ └── index.ts ├── dforce │ └── index.ts ├── gridex │ ├── abi.ts │ └── index.ts ├── izumi │ ├── abi.ts │ └── index.ts ├── kyberswap │ ├── abi.ts │ └── index.ts ├── mendi │ └── index.ts ├── mes │ └── index.ts ├── noobysswap │ ├── abi.ts │ ├── api.ts │ └── index.ts ├── openocean │ └── index.ts ├── pancake │ ├── abi.ts │ └── index.ts ├── squid │ └── index.ts ├── sushiswap │ ├── abi.ts │ └── index.ts ├── symbiosis │ └── index.ts ├── uniswap │ └── index.ts ├── velocore │ ├── abi.ts │ └── index.ts ├── zkex │ └── index.ts └── zkusd │ └── index.ts ├── tsconfig.json └── utils ├── cli.ts └── utils.ts /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | next-env.d.ts 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | .pnpm-debug.log* 28 | 29 | /public 30 | 31 | # local env files 32 | # do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables 33 | .env 34 | .env*.local 35 | 36 | # vercel 37 | .vercel 38 | 39 | # typescript 40 | *.tsbuildinfo 41 | logs 42 | keys.txt -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Linea 第八周脚本 2 | 3 | - 总共 18 个dapp,可以拿到 295分左右,部分任务银河确认较慢可能要隔天才能verify 4 | - 这一期应该是除kyc外权重最大的一期了,大家加油! 5 | - 目前链上Gas被卡,跑完全部任务,每个钱包需要准备 `30eth` 的测试币 (gas为2500gwei时) 6 | - 遇到一直过不去的任务,不用怀疑肯定是水不够了,随意批量跑的话,一定确保每个钱包水足够,不然来回折腾 7 | - 同样在执行脚本任务时,任务可能一直pending无法成功,可以增加`config.ts`里的`ADD_GAS_PRICE`字段,重新跑即可 8 | 9 | > 确保调整后的Gas比上一次提交的Gas最少要高10%, 否则无法覆盖上一次的交易 10 | 11 | ## 7.3更新 Cashmere任务(25分) 12 | 13 | 需要**一个**钱包里面领了水测试tUSDT水,所有钱包即可完成任务。👉 [领水地址](https://faucet.cashmere.exchange/) 14 | 15 | 领完水后,跑一下下面脚本,然后正常跑任务脚本即可 16 | 17 | ```bash 18 | # cashmere前置任务 19 | pnpm task -a pre_cashmere 20 | ``` 21 | 22 | ## 须知 23 | 24 | **请一定进行代码审计,我开源的代码这么多双眼睛盯着还好,如果私下收到的代码切勿随意运行,很细微的改动都有可能导致私钥丢失.** 25 | 26 | ## 🤲 拜托 27 | 28 | - 关注本人推特 [@0x3lang](https://twitter.com/0x3lang),会不定期开源脚本 29 | 30 | > 请自行检查代码,和项目依赖,风险自担,可以自行修改。 31 | 32 | ## 环境 33 | 34 | - nodejs [lts](https://nodejs.org/en/download) 👉[教程戳这里](https://www.liaoxuefeng.com/wiki/1022910821149312/1023025597810528) 35 | 36 | ## 安装依赖 37 | 38 | ```bash 39 | npm i -g pnpm # 安装pnpm 40 | pnpm install # 安装依赖 41 | ``` 42 | 43 | > 这期使用 pnpm 工具原因是上期部分windows用户反馈使用npm安装依赖失败 44 | 45 | ## 运行 46 | 47 | 根目录新建 `keys.txt` 放私钥,一行一个 48 | 49 | ```bash 50 | pnpm task # 开跑! 51 | ``` 52 | 53 | 支持并发运行,例如: 54 | 55 | ```bash 56 | pnpm task -b 10 # 例如100个私钥,分十份并发跑,节省时间 57 | ``` 58 | -------------------------------------------------------------------------------- /config.ts: -------------------------------------------------------------------------------- 1 | export const config = { 2 | /** 最高运行气价 */ 3 | MAX_GAS_PRICE: 5000, 4 | /** 加价抢跑 */ 5 | ADD_GAS_PRICE: 200, 6 | /** 是否强制执行到成功 */ 7 | loopUtilSuccess: false, 8 | /** 账号多的建议换成收费节点的rpc,公用有速率和流量限制 */ 9 | rpc: "https://rpc.goerli.linea.build" 10 | } -------------------------------------------------------------------------------- /const/erc20.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant": true, 4 | "inputs": [], 5 | "name": "name", 6 | "outputs": [ 7 | { 8 | "name": "", 9 | "type": "string" 10 | } 11 | ], 12 | "payable": false, 13 | "stateMutability": "view", 14 | "type": "function" 15 | }, 16 | { 17 | "constant": false, 18 | "inputs": [ 19 | { 20 | "name": "_spender", 21 | "type": "address" 22 | }, 23 | { 24 | "name": "_value", 25 | "type": "uint256" 26 | } 27 | ], 28 | "name": "approve", 29 | "outputs": [ 30 | { 31 | "name": "", 32 | "type": "bool" 33 | } 34 | ], 35 | "payable": false, 36 | "stateMutability": "nonpayable", 37 | "type": "function" 38 | }, 39 | { 40 | "constant": true, 41 | "inputs": [], 42 | "name": "totalSupply", 43 | "outputs": [ 44 | { 45 | "name": "", 46 | "type": "uint256" 47 | } 48 | ], 49 | "payable": false, 50 | "stateMutability": "view", 51 | "type": "function" 52 | }, 53 | { 54 | "constant": false, 55 | "inputs": [ 56 | { 57 | "name": "_from", 58 | "type": "address" 59 | }, 60 | { 61 | "name": "_to", 62 | "type": "address" 63 | }, 64 | { 65 | "name": "_value", 66 | "type": "uint256" 67 | } 68 | ], 69 | "name": "transferFrom", 70 | "outputs": [ 71 | { 72 | "name": "", 73 | "type": "bool" 74 | } 75 | ], 76 | "payable": false, 77 | "stateMutability": "nonpayable", 78 | "type": "function" 79 | }, 80 | { 81 | "constant": true, 82 | "inputs": [], 83 | "name": "decimals", 84 | "outputs": [ 85 | { 86 | "name": "", 87 | "type": "uint8" 88 | } 89 | ], 90 | "payable": false, 91 | "stateMutability": "view", 92 | "type": "function" 93 | }, 94 | { 95 | "constant": true, 96 | "inputs": [ 97 | { 98 | "name": "_owner", 99 | "type": "address" 100 | } 101 | ], 102 | "name": "balanceOf", 103 | "outputs": [ 104 | { 105 | "name": "balance", 106 | "type": "uint256" 107 | } 108 | ], 109 | "payable": false, 110 | "stateMutability": "view", 111 | "type": "function" 112 | }, 113 | { 114 | "constant": true, 115 | "inputs": [], 116 | "name": "symbol", 117 | "outputs": [ 118 | { 119 | "name": "", 120 | "type": "string" 121 | } 122 | ], 123 | "payable": false, 124 | "stateMutability": "view", 125 | "type": "function" 126 | }, 127 | { 128 | "constant": false, 129 | "inputs": [ 130 | { 131 | "name": "_to", 132 | "type": "address" 133 | }, 134 | { 135 | "name": "_value", 136 | "type": "uint256" 137 | } 138 | ], 139 | "name": "transfer", 140 | "outputs": [ 141 | { 142 | "name": "", 143 | "type": "bool" 144 | } 145 | ], 146 | "payable": false, 147 | "stateMutability": "nonpayable", 148 | "type": "function" 149 | }, 150 | { 151 | "constant": true, 152 | "inputs": [ 153 | { 154 | "name": "_owner", 155 | "type": "address" 156 | }, 157 | { 158 | "name": "_spender", 159 | "type": "address" 160 | } 161 | ], 162 | "name": "allowance", 163 | "outputs": [ 164 | { 165 | "name": "", 166 | "type": "uint256" 167 | } 168 | ], 169 | "payable": false, 170 | "stateMutability": "view", 171 | "type": "function" 172 | }, 173 | { 174 | "payable": true, 175 | "stateMutability": "payable", 176 | "type": "fallback" 177 | }, 178 | { 179 | "anonymous": false, 180 | "inputs": [ 181 | { 182 | "indexed": true, 183 | "name": "owner", 184 | "type": "address" 185 | }, 186 | { 187 | "indexed": true, 188 | "name": "spender", 189 | "type": "address" 190 | }, 191 | { 192 | "indexed": false, 193 | "name": "value", 194 | "type": "uint256" 195 | } 196 | ], 197 | "name": "Approval", 198 | "type": "event" 199 | }, 200 | { 201 | "anonymous": false, 202 | "inputs": [ 203 | { 204 | "indexed": true, 205 | "name": "from", 206 | "type": "address" 207 | }, 208 | { 209 | "indexed": true, 210 | "name": "to", 211 | "type": "address" 212 | }, 213 | { 214 | "indexed": false, 215 | "name": "value", 216 | "type": "uint256" 217 | } 218 | ], 219 | "name": "Transfer", 220 | "type": "event" 221 | } 222 | ] 223 | -------------------------------------------------------------------------------- /const/index.ts: -------------------------------------------------------------------------------- 1 | export const lineasterAbi = [ 2 | { 3 | inputs: [{ 4 | components: [{ 5 | internalType: "address", 6 | name: "to", 7 | type: "address" 8 | }, { 9 | internalType: "string", 10 | name: "handle", 11 | type: "string" 12 | }, { 13 | internalType: "string", 14 | name: "imageURI", 15 | type: "string" 16 | }, { 17 | internalType: "address", 18 | name: "followModule", 19 | type: "address" 20 | }, { 21 | internalType: "bytes", 22 | name: "followModuleInitData", 23 | type: "bytes" 24 | }, { 25 | internalType: "string", 26 | name: "followNFTURI", 27 | type: "string" 28 | }], 29 | internalType: "struct DataTypes.CreateProfileData", 30 | name: "vars", 31 | type: "tuple" 32 | }], 33 | name: "proxyCreateProfile", 34 | outputs: [], 35 | stateMutability: "nonpayable", 36 | type: "function" 37 | }, 38 | { 39 | inputs: [{ 40 | components: [{ 41 | internalType: "uint256", 42 | name: "profileId", 43 | type: "uint256" 44 | }, { 45 | internalType: "string", 46 | name: "contentURI", 47 | type: "string" 48 | }, { 49 | internalType: "address", 50 | name: "collectModule", 51 | type: "address" 52 | }, { 53 | internalType: "bytes", 54 | name: "collectModuleInitData", 55 | type: "bytes" 56 | }, { 57 | internalType: "address", 58 | name: "referenceModule", 59 | type: "address" 60 | }, { 61 | internalType: "bytes", 62 | name: "referenceModuleInitData", 63 | type: "bytes" 64 | }, { 65 | components: [{ 66 | internalType: "uint8", 67 | name: "v", 68 | type: "uint8" 69 | }, { 70 | internalType: "bytes32", 71 | name: "r", 72 | type: "bytes32" 73 | }, { 74 | internalType: "bytes32", 75 | name: "s", 76 | type: "bytes32" 77 | }, { 78 | internalType: "uint256", 79 | name: "deadline", 80 | type: "uint256" 81 | }], 82 | internalType: "struct DataTypes.EIP712Signature", 83 | name: "sig", 84 | type: "tuple" 85 | }], 86 | internalType: "struct DataTypes.PostWithSigData", 87 | name: "vars", 88 | type: "tuple" 89 | }], 90 | name: "postWithSig", 91 | outputs: [{ 92 | internalType: "uint256", 93 | name: "", 94 | type: "uint256" 95 | }], 96 | stateMutability: "nonpayable", 97 | type: "function" 98 | }, 99 | { 100 | inputs: [{ 101 | components: [{ 102 | internalType: "address", 103 | name: "follower", 104 | type: "address" 105 | }, { 106 | internalType: "uint256[]", 107 | name: "profileIds", 108 | type: "uint256[]" 109 | }, { 110 | internalType: "bytes[]", 111 | name: "datas", 112 | type: "bytes[]" 113 | }, { 114 | components: [{ 115 | internalType: "uint8", 116 | name: "v", 117 | type: "uint8" 118 | }, { 119 | internalType: "bytes32", 120 | name: "r", 121 | type: "bytes32" 122 | }, { 123 | internalType: "bytes32", 124 | name: "s", 125 | type: "bytes32" 126 | }, { 127 | internalType: "uint256", 128 | name: "deadline", 129 | type: "uint256" 130 | }], 131 | internalType: "struct DataTypes.EIP712Signature", 132 | name: "sig", 133 | type: "tuple" 134 | }], 135 | internalType: "struct DataTypes.FollowWithSigData", 136 | name: "vars", 137 | type: "tuple" 138 | }], 139 | name: "followWithSig", 140 | outputs: [{ 141 | internalType: "uint256[]", 142 | name: "", 143 | type: "uint256[]" 144 | }], 145 | stateMutability: "nonpayable", 146 | type: "function" 147 | }, 148 | { 149 | inputs: [{ 150 | components: [{ 151 | internalType: "address", 152 | name: "collector", 153 | type: "address" 154 | }, { 155 | internalType: "uint256", 156 | name: "profileId", 157 | type: "uint256" 158 | }, { 159 | internalType: "uint256", 160 | name: "pubId", 161 | type: "uint256" 162 | }, { 163 | internalType: "bytes", 164 | name: "data", 165 | type: "bytes" 166 | }, { 167 | components: [{ 168 | internalType: "uint8", 169 | name: "v", 170 | type: "uint8" 171 | }, { 172 | internalType: "bytes32", 173 | name: "r", 174 | type: "bytes32" 175 | }, { 176 | internalType: "bytes32", 177 | name: "s", 178 | type: "bytes32" 179 | }, { 180 | internalType: "uint256", 181 | name: "deadline", 182 | type: "uint256" 183 | }], 184 | internalType: "struct DataTypes.EIP712Signature", 185 | name: "sig", 186 | type: "tuple" 187 | }], 188 | internalType: "struct DataTypes.CollectWithSigData", 189 | name: "vars", 190 | type: "tuple" 191 | }], 192 | name: "collectWithSig", 193 | outputs: [{ 194 | internalType: "uint256", 195 | name: "", 196 | type: "uint256" 197 | }], 198 | stateMutability: "nonpayable", 199 | type: "function" 200 | } 201 | ] 202 | 203 | export const snapshotXData = (address: string) => { 204 | return '0xf2a40be400000000000000000000000096706138eef4bd871448cf9b842b01b005822aa1bc7e56f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000180000000000000000000000000a95c5f65e8e81fd4abaf3d2bd058a536a88b20e40000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'.replace('a95c5f65e8e81fd4abaf3d2bd058a536a88b20e4', address.toLocaleLowerCase().substring(2)) 205 | } 206 | 207 | export const lineal2DomainAbi = [{ "inputs": [{ "internalType": "contract Oracle", "name": "_oracle", "type": "address" }, { "internalType": "contract UsernameNFT", "name": "_usernameNFT", "type": "address" }], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "FailedWithdrawError", "type": "error" }, { "inputs": [], "name": "InsufficientNativeError", "type": "error" }, { "inputs": [], "name": "NameAlreadyActiveError", "type": "error" }, { "inputs": [], "name": "NotTokenOwnerOrNameTakenError", "type": "error" }, { "inputs": [], "name": "OnlyNFTOwnerError", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "inputs": [], "name": "oracle", "outputs": [{ "internalType": "contract Oracle", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "name", "type": "string" }, { "internalType": "uint96", "name": "duration", "type": "uint96" }], "name": "register", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint96", "name": "duration", "type": "uint96" }], "name": "renew", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "payable", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "contract Oracle", "name": "_oracle", "type": "address" }], "name": "setOracle", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "usernameNFT", "outputs": [{ "internalType": "contract UsernameNFT", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "withdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" }] 208 | 209 | export const tatarotAbi = [ 210 | { 211 | "inputs": [ 212 | { 213 | "components": [ 214 | { "internalType": "address", "name": "to", "type": "address" }, 215 | { "internalType": "uint256", "name": "scryId", "type": "uint256" }, 216 | { "internalType": "uint128", "name": "validityStartTimestamp", "type": "uint128" }, 217 | { "internalType": "uint128", "name": "validityEndTimestamp", "type": "uint128" } 218 | ], 219 | "internalType": "struct Tarot.MintRequest", 220 | "name": "req", 221 | "type": "tuple" 222 | }, 223 | { 224 | "internalType": "bytes", 225 | "name": "signature", 226 | "type": "bytes" 227 | } 228 | ], 229 | "name": "mintWithSignature", 230 | "outputs": [], 231 | "stateMutability": "payable", 232 | "type": "function" 233 | } 234 | ] 235 | 236 | export const meetAbi = [{ "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "inputs": [], "name": "endTime", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_address", "type": "address" }], "name": "getRedeemRecord", "outputs": [{ "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "time", "type": "uint256" }, { "internalType": "address", "name": "owner", "type": "address" }], "internalType": "struct Stake.Record[]", "name": "", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getRedeemRecordAll", "outputs": [{ "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "time", "type": "uint256" }, { "internalType": "address", "name": "owner", "type": "address" }], "internalType": "struct Stake.Record[]", "name": "", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_address", "type": "address" }], "name": "getStakeRecord", "outputs": [{ "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "time", "type": "uint256" }, { "internalType": "address", "name": "owner", "type": "address" }], "internalType": "struct Stake.Record[]", "name": "", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getStakeRecordAll", "outputs": [{ "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "time", "type": "uint256" }, { "internalType": "address", "name": "owner", "type": "address" }], "internalType": "struct Stake.Record[]", "name": "", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "nft", "outputs": [{ "internalType": "contract IERC721", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }, { "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "bytes", "name": "", "type": "bytes" }], "name": "onERC721Received", "outputs": [{ "internalType": "bytes4", "name": "", "type": "bytes4" }], "stateMutability": "pure", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256[]", "name": "_tokenIds", "type": "uint256[]" }], "name": "redeem", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "redeemAddresses", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "redeemAddressesExists", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256[]", "name": "_tokenIds", "type": "uint256[]" }], "name": "redeemFocus", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "name": "redeemRecords", "outputs": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "time", "type": "uint256" }, { "internalType": "address", "name": "owner", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_endTime", "type": "uint256" }], "name": "setEndTime", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "contract IERC721", "name": "_nft", "type": "address" }], "name": "setNftAddress", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_startTime", "type": "uint256" }], "name": "setStartTime", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_tokenId", "type": "uint256" }], "name": "stake", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "stakeAddresses", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "stakeAddressesExists", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256[]", "name": "_tokenIds", "type": "uint256[]" }], "name": "stakeNFTs", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "name": "stakeRecords", "outputs": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "time", "type": "uint256" }, { "internalType": "address", "name": "owner", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "startTime", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "tokenIdAddressMap", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }] 237 | export const meetNftAbi = [{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"burns","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"mintAsOwner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"mintAsPublic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mintBatchAsOwner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mintBatchAsPublic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_amount","type":"uint64"}],"name":"mintPublic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ownerMintIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicActivityTimeEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicActivityTimeStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicMintAmountLimit","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicMintIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicMintOnceLimit","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"publicMintRecord","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recordExpiredTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"buri_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ownerMintIndex","type":"uint256"}],"name":"setOwnerMintIndex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_publicActivityTimeStart","type":"uint256"},{"internalType":"uint256","name":"_publicActivityTimeEnd","type":"uint256"}],"name":"setPublicActivityTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_publicMintAmountLimit","type":"uint64"}],"name":"setPublicMintAmountLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_publicMintIndex","type":"uint256"}],"name":"setPublicMintIndex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_publicMintOnceLimit","type":"uint64"}],"name":"setPublicMintOnceLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_recordExpiredTime","type":"uint64"}],"name":"setRecordExpiredTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_balance","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}] -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Linea Voyage Week8 3 | * 4 | * Author @3lang3 2023-07-01 5 | * Github: https://github.com/3lang3 6 | */ 7 | 8 | import { cli } from './utils/cli'; 9 | import { ethers } from 'ethers'; 10 | 11 | import * as pancake from './tasks/pancake'; 12 | import * as kyberswap from './tasks/kyberswap'; 13 | import * as airswap from './tasks/airswap'; 14 | import * as sushiswap from './tasks/sushiswap'; 15 | import * as uniswap from './tasks/uniswap'; 16 | import * as izumi from './tasks/izumi'; 17 | import * as squid from './tasks/squid'; 18 | import * as mendi from './tasks/mendi'; 19 | import * as dforce from './tasks/dforce'; 20 | import * as velocore from './tasks/velocore'; 21 | import * as zkex from './tasks/zkex'; 22 | import * as mes from './tasks/mes'; 23 | import * as symbiosis from './tasks/symbiosis'; 24 | import * as cashmere from './tasks/cashmere'; 25 | import * as openocean from './tasks/openocean'; 26 | import * as noobysswap from './tasks/noobysswap/api'; 27 | import * as compound from './tasks/compound'; 28 | import * as zkusd from './tasks/zkusd'; 29 | import * as gridex from './tasks/gridex'; 30 | import { config } from './config'; 31 | import { loop } from './utils/utils'; 32 | 33 | const main = async (wallet: ethers.Wallet) => { 34 | await pancake.run(wallet) 35 | await compound.run(wallet); 36 | await kyberswap.run(wallet) 37 | await airswap.run(wallet) 38 | await sushiswap.run(wallet) 39 | await uniswap.run(wallet) 40 | await cashmere.run(wallet) 41 | await izumi.run(wallet) 42 | await zkusd.run(wallet) 43 | await squid.run(wallet) 44 | await mendi.run(wallet) 45 | await dforce.run(wallet) 46 | await velocore.run(wallet) 47 | await gridex.run(wallet) 48 | // await zkex.run(wallet) 49 | await symbiosis.run(wallet) 50 | await openocean.run(wallet); 51 | await noobysswap.run(wallet); 52 | await mes.run(wallet) 53 | } 54 | 55 | cli(async ({ action, pks, startIdx, endIdx }) => { 56 | if (action === 'pre_cashmere') { 57 | await cashmere.airdropTUSDT(); 58 | return; 59 | } 60 | for (let k = startIdx; k <= endIdx; k++) { 61 | const pk = pks[k]; 62 | const wallet = new ethers.Wallet(pk); 63 | try { 64 | if (config.loopUtilSuccess) { 65 | await loop(async () => { 66 | await main(wallet); 67 | }) 68 | } else { 69 | await main(wallet); 70 | } 71 | } catch (error) { 72 | console.log(error?.reason || error?.message) 73 | } 74 | } 75 | }); 76 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "task": "node -r @swc-node/register index.ts" 4 | }, 5 | "dependencies": { 6 | "axios": "^1.4.0", 7 | "crypto-js": "^4.1.1", 8 | "ethers": "^5", 9 | "fs-extra": "^11.1.1", 10 | "websocket": "^1.0.34" 11 | }, 12 | "devDependencies": { 13 | "@swc-node/register": "^1.6.5", 14 | "@types/node": "^20.3.1", 15 | "typescript": "^5.1.3" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: '6.0' 2 | 3 | settings: 4 | autoInstallPeers: true 5 | excludeLinksFromLockfile: false 6 | 7 | dependencies: 8 | axios: 9 | specifier: ^1.4.0 10 | version: 1.4.0 11 | crypto-js: 12 | specifier: ^4.1.1 13 | version: 4.1.1 14 | ethers: 15 | specifier: ^5 16 | version: 5.0.0 17 | fs-extra: 18 | specifier: ^11.1.1 19 | version: 11.1.1 20 | websocket: 21 | specifier: ^1.0.34 22 | version: 1.0.34 23 | 24 | devDependencies: 25 | '@swc-node/register': 26 | specifier: ^1.6.5 27 | version: 1.6.5(@swc/core@1.3.67)(typescript@5.1.3) 28 | '@types/node': 29 | specifier: ^20.3.1 30 | version: 20.3.1 31 | typescript: 32 | specifier: ^5.1.3 33 | version: 5.1.3 34 | 35 | packages: 36 | 37 | /@ethersproject/abi@5.7.0: 38 | resolution: {integrity: sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==} 39 | dependencies: 40 | '@ethersproject/address': 5.7.0 41 | '@ethersproject/bignumber': 5.7.0 42 | '@ethersproject/bytes': 5.7.0 43 | '@ethersproject/constants': 5.7.0 44 | '@ethersproject/hash': 5.7.0 45 | '@ethersproject/keccak256': 5.7.0 46 | '@ethersproject/logger': 5.7.0 47 | '@ethersproject/properties': 5.7.0 48 | '@ethersproject/strings': 5.7.0 49 | dev: false 50 | 51 | /@ethersproject/abstract-provider@5.7.0: 52 | resolution: {integrity: sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==} 53 | dependencies: 54 | '@ethersproject/bignumber': 5.7.0 55 | '@ethersproject/bytes': 5.7.0 56 | '@ethersproject/logger': 5.7.0 57 | '@ethersproject/networks': 5.7.1 58 | '@ethersproject/properties': 5.7.0 59 | '@ethersproject/transactions': 5.7.0 60 | '@ethersproject/web': 5.7.1 61 | dev: false 62 | 63 | /@ethersproject/abstract-signer@5.7.0: 64 | resolution: {integrity: sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==} 65 | dependencies: 66 | '@ethersproject/abstract-provider': 5.7.0 67 | '@ethersproject/bignumber': 5.7.0 68 | '@ethersproject/bytes': 5.7.0 69 | '@ethersproject/logger': 5.7.0 70 | '@ethersproject/properties': 5.7.0 71 | dev: false 72 | 73 | /@ethersproject/address@5.7.0: 74 | resolution: {integrity: sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==} 75 | dependencies: 76 | '@ethersproject/bignumber': 5.7.0 77 | '@ethersproject/bytes': 5.7.0 78 | '@ethersproject/keccak256': 5.7.0 79 | '@ethersproject/logger': 5.7.0 80 | '@ethersproject/rlp': 5.7.0 81 | dev: false 82 | 83 | /@ethersproject/base64@5.7.0: 84 | resolution: {integrity: sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==} 85 | dependencies: 86 | '@ethersproject/bytes': 5.7.0 87 | dev: false 88 | 89 | /@ethersproject/basex@5.7.0: 90 | resolution: {integrity: sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==} 91 | dependencies: 92 | '@ethersproject/bytes': 5.7.0 93 | '@ethersproject/properties': 5.7.0 94 | dev: false 95 | 96 | /@ethersproject/bignumber@5.7.0: 97 | resolution: {integrity: sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==} 98 | dependencies: 99 | '@ethersproject/bytes': 5.7.0 100 | '@ethersproject/logger': 5.7.0 101 | bn.js: 5.2.1 102 | dev: false 103 | 104 | /@ethersproject/bytes@5.7.0: 105 | resolution: {integrity: sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==} 106 | dependencies: 107 | '@ethersproject/logger': 5.7.0 108 | dev: false 109 | 110 | /@ethersproject/constants@5.7.0: 111 | resolution: {integrity: sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==} 112 | dependencies: 113 | '@ethersproject/bignumber': 5.7.0 114 | dev: false 115 | 116 | /@ethersproject/contracts@5.7.0: 117 | resolution: {integrity: sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==} 118 | dependencies: 119 | '@ethersproject/abi': 5.7.0 120 | '@ethersproject/abstract-provider': 5.7.0 121 | '@ethersproject/abstract-signer': 5.7.0 122 | '@ethersproject/address': 5.7.0 123 | '@ethersproject/bignumber': 5.7.0 124 | '@ethersproject/bytes': 5.7.0 125 | '@ethersproject/constants': 5.7.0 126 | '@ethersproject/logger': 5.7.0 127 | '@ethersproject/properties': 5.7.0 128 | '@ethersproject/transactions': 5.7.0 129 | dev: false 130 | 131 | /@ethersproject/hash@5.7.0: 132 | resolution: {integrity: sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==} 133 | dependencies: 134 | '@ethersproject/abstract-signer': 5.7.0 135 | '@ethersproject/address': 5.7.0 136 | '@ethersproject/base64': 5.7.0 137 | '@ethersproject/bignumber': 5.7.0 138 | '@ethersproject/bytes': 5.7.0 139 | '@ethersproject/keccak256': 5.7.0 140 | '@ethersproject/logger': 5.7.0 141 | '@ethersproject/properties': 5.7.0 142 | '@ethersproject/strings': 5.7.0 143 | dev: false 144 | 145 | /@ethersproject/hdnode@5.7.0: 146 | resolution: {integrity: sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==} 147 | dependencies: 148 | '@ethersproject/abstract-signer': 5.7.0 149 | '@ethersproject/basex': 5.7.0 150 | '@ethersproject/bignumber': 5.7.0 151 | '@ethersproject/bytes': 5.7.0 152 | '@ethersproject/logger': 5.7.0 153 | '@ethersproject/pbkdf2': 5.7.0 154 | '@ethersproject/properties': 5.7.0 155 | '@ethersproject/sha2': 5.7.0 156 | '@ethersproject/signing-key': 5.7.0 157 | '@ethersproject/strings': 5.7.0 158 | '@ethersproject/transactions': 5.7.0 159 | '@ethersproject/wordlists': 5.7.0 160 | dev: false 161 | 162 | /@ethersproject/json-wallets@5.7.0: 163 | resolution: {integrity: sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==} 164 | dependencies: 165 | '@ethersproject/abstract-signer': 5.7.0 166 | '@ethersproject/address': 5.7.0 167 | '@ethersproject/bytes': 5.7.0 168 | '@ethersproject/hdnode': 5.7.0 169 | '@ethersproject/keccak256': 5.7.0 170 | '@ethersproject/logger': 5.7.0 171 | '@ethersproject/pbkdf2': 5.7.0 172 | '@ethersproject/properties': 5.7.0 173 | '@ethersproject/random': 5.7.0 174 | '@ethersproject/strings': 5.7.0 175 | '@ethersproject/transactions': 5.7.0 176 | aes-js: 3.0.0 177 | scrypt-js: 3.0.1 178 | dev: false 179 | 180 | /@ethersproject/keccak256@5.7.0: 181 | resolution: {integrity: sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==} 182 | dependencies: 183 | '@ethersproject/bytes': 5.7.0 184 | js-sha3: 0.8.0 185 | dev: false 186 | 187 | /@ethersproject/logger@5.7.0: 188 | resolution: {integrity: sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==} 189 | dev: false 190 | 191 | /@ethersproject/networks@5.7.1: 192 | resolution: {integrity: sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==} 193 | dependencies: 194 | '@ethersproject/logger': 5.7.0 195 | dev: false 196 | 197 | /@ethersproject/pbkdf2@5.7.0: 198 | resolution: {integrity: sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==} 199 | dependencies: 200 | '@ethersproject/bytes': 5.7.0 201 | '@ethersproject/sha2': 5.7.0 202 | dev: false 203 | 204 | /@ethersproject/properties@5.7.0: 205 | resolution: {integrity: sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==} 206 | dependencies: 207 | '@ethersproject/logger': 5.7.0 208 | dev: false 209 | 210 | /@ethersproject/providers@5.7.2: 211 | resolution: {integrity: sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==} 212 | dependencies: 213 | '@ethersproject/abstract-provider': 5.7.0 214 | '@ethersproject/abstract-signer': 5.7.0 215 | '@ethersproject/address': 5.7.0 216 | '@ethersproject/base64': 5.7.0 217 | '@ethersproject/basex': 5.7.0 218 | '@ethersproject/bignumber': 5.7.0 219 | '@ethersproject/bytes': 5.7.0 220 | '@ethersproject/constants': 5.7.0 221 | '@ethersproject/hash': 5.7.0 222 | '@ethersproject/logger': 5.7.0 223 | '@ethersproject/networks': 5.7.1 224 | '@ethersproject/properties': 5.7.0 225 | '@ethersproject/random': 5.7.0 226 | '@ethersproject/rlp': 5.7.0 227 | '@ethersproject/sha2': 5.7.0 228 | '@ethersproject/strings': 5.7.0 229 | '@ethersproject/transactions': 5.7.0 230 | '@ethersproject/web': 5.7.1 231 | bech32: 1.1.4 232 | ws: 7.4.6 233 | transitivePeerDependencies: 234 | - bufferutil 235 | - utf-8-validate 236 | dev: false 237 | 238 | /@ethersproject/random@5.7.0: 239 | resolution: {integrity: sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==} 240 | dependencies: 241 | '@ethersproject/bytes': 5.7.0 242 | '@ethersproject/logger': 5.7.0 243 | dev: false 244 | 245 | /@ethersproject/rlp@5.7.0: 246 | resolution: {integrity: sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==} 247 | dependencies: 248 | '@ethersproject/bytes': 5.7.0 249 | '@ethersproject/logger': 5.7.0 250 | dev: false 251 | 252 | /@ethersproject/sha2@5.7.0: 253 | resolution: {integrity: sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==} 254 | dependencies: 255 | '@ethersproject/bytes': 5.7.0 256 | '@ethersproject/logger': 5.7.0 257 | hash.js: 1.1.7 258 | dev: false 259 | 260 | /@ethersproject/signing-key@5.7.0: 261 | resolution: {integrity: sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==} 262 | dependencies: 263 | '@ethersproject/bytes': 5.7.0 264 | '@ethersproject/logger': 5.7.0 265 | '@ethersproject/properties': 5.7.0 266 | bn.js: 5.2.1 267 | elliptic: 6.5.4 268 | hash.js: 1.1.7 269 | dev: false 270 | 271 | /@ethersproject/solidity@5.7.0: 272 | resolution: {integrity: sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==} 273 | dependencies: 274 | '@ethersproject/bignumber': 5.7.0 275 | '@ethersproject/bytes': 5.7.0 276 | '@ethersproject/keccak256': 5.7.0 277 | '@ethersproject/logger': 5.7.0 278 | '@ethersproject/sha2': 5.7.0 279 | '@ethersproject/strings': 5.7.0 280 | dev: false 281 | 282 | /@ethersproject/strings@5.7.0: 283 | resolution: {integrity: sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==} 284 | dependencies: 285 | '@ethersproject/bytes': 5.7.0 286 | '@ethersproject/constants': 5.7.0 287 | '@ethersproject/logger': 5.7.0 288 | dev: false 289 | 290 | /@ethersproject/transactions@5.7.0: 291 | resolution: {integrity: sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==} 292 | dependencies: 293 | '@ethersproject/address': 5.7.0 294 | '@ethersproject/bignumber': 5.7.0 295 | '@ethersproject/bytes': 5.7.0 296 | '@ethersproject/constants': 5.7.0 297 | '@ethersproject/keccak256': 5.7.0 298 | '@ethersproject/logger': 5.7.0 299 | '@ethersproject/properties': 5.7.0 300 | '@ethersproject/rlp': 5.7.0 301 | '@ethersproject/signing-key': 5.7.0 302 | dev: false 303 | 304 | /@ethersproject/units@5.7.0: 305 | resolution: {integrity: sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==} 306 | dependencies: 307 | '@ethersproject/bignumber': 5.7.0 308 | '@ethersproject/constants': 5.7.0 309 | '@ethersproject/logger': 5.7.0 310 | dev: false 311 | 312 | /@ethersproject/wallet@5.7.0: 313 | resolution: {integrity: sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==} 314 | dependencies: 315 | '@ethersproject/abstract-provider': 5.7.0 316 | '@ethersproject/abstract-signer': 5.7.0 317 | '@ethersproject/address': 5.7.0 318 | '@ethersproject/bignumber': 5.7.0 319 | '@ethersproject/bytes': 5.7.0 320 | '@ethersproject/hash': 5.7.0 321 | '@ethersproject/hdnode': 5.7.0 322 | '@ethersproject/json-wallets': 5.7.0 323 | '@ethersproject/keccak256': 5.7.0 324 | '@ethersproject/logger': 5.7.0 325 | '@ethersproject/properties': 5.7.0 326 | '@ethersproject/random': 5.7.0 327 | '@ethersproject/signing-key': 5.7.0 328 | '@ethersproject/transactions': 5.7.0 329 | '@ethersproject/wordlists': 5.7.0 330 | dev: false 331 | 332 | /@ethersproject/web@5.7.1: 333 | resolution: {integrity: sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==} 334 | dependencies: 335 | '@ethersproject/base64': 5.7.0 336 | '@ethersproject/bytes': 5.7.0 337 | '@ethersproject/logger': 5.7.0 338 | '@ethersproject/properties': 5.7.0 339 | '@ethersproject/strings': 5.7.0 340 | dev: false 341 | 342 | /@ethersproject/wordlists@5.7.0: 343 | resolution: {integrity: sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==} 344 | dependencies: 345 | '@ethersproject/bytes': 5.7.0 346 | '@ethersproject/hash': 5.7.0 347 | '@ethersproject/logger': 5.7.0 348 | '@ethersproject/properties': 5.7.0 349 | '@ethersproject/strings': 5.7.0 350 | dev: false 351 | 352 | /@swc-node/core@1.10.4(@swc/core@1.3.67): 353 | resolution: {integrity: sha512-ixZCb4LsSUPflnOxj4a8T5yTPzKbgvP+tF0N59Rk2+68ikFRt9Qci2qy9xfuDIQbuiONzXersrNpd+p598uH0A==} 354 | engines: {node: '>= 10'} 355 | peerDependencies: 356 | '@swc/core': '>= 1.3' 357 | dependencies: 358 | '@swc/core': 1.3.67 359 | dev: true 360 | 361 | /@swc-node/register@1.6.5(@swc/core@1.3.67)(typescript@5.1.3): 362 | resolution: {integrity: sha512-yMxXlzthI0aMadYYKDhx7xvtjljB1qoD8Tv0djqSJ1ttTkoDxg6MhG5A5pIahiUT2neVrkWb9lCavoUwXAe/zQ==} 363 | peerDependencies: 364 | '@swc/core': '>= 1.3' 365 | typescript: '>= 4.3' 366 | dependencies: 367 | '@swc-node/core': 1.10.4(@swc/core@1.3.67) 368 | '@swc-node/sourcemap-support': 0.3.0 369 | '@swc/core': 1.3.67 370 | colorette: 2.0.20 371 | debug: 4.3.4 372 | pirates: 4.0.6 373 | tslib: 2.6.0 374 | typescript: 5.1.3 375 | transitivePeerDependencies: 376 | - supports-color 377 | dev: true 378 | 379 | /@swc-node/sourcemap-support@0.3.0: 380 | resolution: {integrity: sha512-gqBJSmJMWomZFxlppaKea7NeAqFrDrrS0RMt24No92M3nJWcyI9YKGEQKl+EyJqZ5gh6w1s0cTklMHMzRwA1NA==} 381 | dependencies: 382 | source-map-support: 0.5.21 383 | tslib: 2.6.0 384 | dev: true 385 | 386 | /@swc/core-darwin-arm64@1.3.67: 387 | resolution: {integrity: sha512-zCT2mCkOBVNf5uJDcQ3A9KDoO1OEaGdfjsRTZTo7sejDd9AXLfJg+xgyCBBrK2jNS/uWcT21IvSv3LqKp4K8pA==} 388 | engines: {node: '>=10'} 389 | cpu: [arm64] 390 | os: [darwin] 391 | requiresBuild: true 392 | dev: true 393 | optional: true 394 | 395 | /@swc/core-darwin-x64@1.3.67: 396 | resolution: {integrity: sha512-hXTVsfTatPEec5gFVyjGj3NccKZsYj/OXyHn6XA+l3Q76lZzGm2ISHdku//XNwXu8OmJ0HhS7LPsC4XXwxXQhg==} 397 | engines: {node: '>=10'} 398 | cpu: [x64] 399 | os: [darwin] 400 | requiresBuild: true 401 | dev: true 402 | optional: true 403 | 404 | /@swc/core-linux-arm-gnueabihf@1.3.67: 405 | resolution: {integrity: sha512-l8AKL0RkDL5FRTeWMmjoz9zvAc37amxC+0rheaNwE+gZya7ObyNjnIYz5FwN+3y+z6JFU7LS2x/5f6iwruv6pg==} 406 | engines: {node: '>=10'} 407 | cpu: [arm] 408 | os: [linux] 409 | requiresBuild: true 410 | dev: true 411 | optional: true 412 | 413 | /@swc/core-linux-arm64-gnu@1.3.67: 414 | resolution: {integrity: sha512-S8zOB1AXEpb7kmtgMaFNeLAj01VOky4B0RNZ+uJWigdrDiFT67FeZzNHUNmNSOU0QM79G+Lie/xD/beqEw0vDg==} 415 | engines: {node: '>=10'} 416 | cpu: [arm64] 417 | os: [linux] 418 | requiresBuild: true 419 | dev: true 420 | optional: true 421 | 422 | /@swc/core-linux-arm64-musl@1.3.67: 423 | resolution: {integrity: sha512-Fex8J8ASrt13pmOr2xWh41tEeKWwXYGk3sV8L/aGHiYtIJEUi2f+RtMx3jp7LIdOD8pQptor7i5WBlfR9jhp8A==} 424 | engines: {node: '>=10'} 425 | cpu: [arm64] 426 | os: [linux] 427 | requiresBuild: true 428 | dev: true 429 | optional: true 430 | 431 | /@swc/core-linux-x64-gnu@1.3.67: 432 | resolution: {integrity: sha512-9bz9/bMphrv5vDg0os/d8ve0QgFpDzJgZgHUaHiGwcmfnlgdOSAaYJLIvWdcGTjZuQeV4L0m+iru357D9TXEzA==} 433 | engines: {node: '>=10'} 434 | cpu: [x64] 435 | os: [linux] 436 | requiresBuild: true 437 | dev: true 438 | optional: true 439 | 440 | /@swc/core-linux-x64-musl@1.3.67: 441 | resolution: {integrity: sha512-ED0H6oLvQmhgo9zs8usmEA/lcZPGTu7K9og9K871b7HhHX0h/R+Xg2pb5KD7S/GyUHpfuopxjVROm+h6X1jMUA==} 442 | engines: {node: '>=10'} 443 | cpu: [x64] 444 | os: [linux] 445 | requiresBuild: true 446 | dev: true 447 | optional: true 448 | 449 | /@swc/core-win32-arm64-msvc@1.3.67: 450 | resolution: {integrity: sha512-J1yFDLgPFeRtA8t5E159OXX+ww1gbkFg70yr4OP7EsOkOD1uMkuTf9yK/woHfsaVJlUYjJHzw7MkUIEgQBucqQ==} 451 | engines: {node: '>=10'} 452 | cpu: [arm64] 453 | os: [win32] 454 | requiresBuild: true 455 | dev: true 456 | optional: true 457 | 458 | /@swc/core-win32-ia32-msvc@1.3.67: 459 | resolution: {integrity: sha512-bK11/KtasewqHxzkjKUBXRE9MSAidbZCxrgJUd49bItG2N/DHxkwMYu8Xkh5VDHdTYWv/2idYtf/VM9Yi+53qw==} 460 | engines: {node: '>=10'} 461 | cpu: [ia32] 462 | os: [win32] 463 | requiresBuild: true 464 | dev: true 465 | optional: true 466 | 467 | /@swc/core-win32-x64-msvc@1.3.67: 468 | resolution: {integrity: sha512-GxzUU3+NA3cPcYxCxtfSQIS2ySD7Z8IZmKTVaWA9GOUQbKLyCE8H5js31u39+0op/1gNgxOgYFDoj2lUyvLCqw==} 469 | engines: {node: '>=10'} 470 | cpu: [x64] 471 | os: [win32] 472 | requiresBuild: true 473 | dev: true 474 | optional: true 475 | 476 | /@swc/core@1.3.67: 477 | resolution: {integrity: sha512-9DROjzfAEt0xt0CDkOYsWpkUPyne8fl5ggWGon049678BOM7p0R0dmaalZGAsKatG5vYP1IWSKWsKhJIubDCsQ==} 478 | engines: {node: '>=10'} 479 | requiresBuild: true 480 | peerDependencies: 481 | '@swc/helpers': ^0.5.0 482 | peerDependenciesMeta: 483 | '@swc/helpers': 484 | optional: true 485 | optionalDependencies: 486 | '@swc/core-darwin-arm64': 1.3.67 487 | '@swc/core-darwin-x64': 1.3.67 488 | '@swc/core-linux-arm-gnueabihf': 1.3.67 489 | '@swc/core-linux-arm64-gnu': 1.3.67 490 | '@swc/core-linux-arm64-musl': 1.3.67 491 | '@swc/core-linux-x64-gnu': 1.3.67 492 | '@swc/core-linux-x64-musl': 1.3.67 493 | '@swc/core-win32-arm64-msvc': 1.3.67 494 | '@swc/core-win32-ia32-msvc': 1.3.67 495 | '@swc/core-win32-x64-msvc': 1.3.67 496 | dev: true 497 | 498 | /@types/node@20.3.1: 499 | resolution: {integrity: sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg==} 500 | dev: true 501 | 502 | /aes-js@3.0.0: 503 | resolution: {integrity: sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==} 504 | dev: false 505 | 506 | /asynckit@0.4.0: 507 | resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} 508 | dev: false 509 | 510 | /axios@1.4.0: 511 | resolution: {integrity: sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==} 512 | dependencies: 513 | follow-redirects: 1.15.2 514 | form-data: 4.0.0 515 | proxy-from-env: 1.1.0 516 | transitivePeerDependencies: 517 | - debug 518 | dev: false 519 | 520 | /bech32@1.1.4: 521 | resolution: {integrity: sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==} 522 | dev: false 523 | 524 | /bn.js@4.12.0: 525 | resolution: {integrity: sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==} 526 | dev: false 527 | 528 | /bn.js@5.2.1: 529 | resolution: {integrity: sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==} 530 | dev: false 531 | 532 | /brorand@1.1.0: 533 | resolution: {integrity: sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==} 534 | dev: false 535 | 536 | /buffer-from@1.1.2: 537 | resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} 538 | dev: true 539 | 540 | /bufferutil@4.0.7: 541 | resolution: {integrity: sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==} 542 | engines: {node: '>=6.14.2'} 543 | requiresBuild: true 544 | dependencies: 545 | node-gyp-build: 4.6.0 546 | dev: false 547 | 548 | /colorette@2.0.20: 549 | resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} 550 | dev: true 551 | 552 | /combined-stream@1.0.8: 553 | resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} 554 | engines: {node: '>= 0.8'} 555 | dependencies: 556 | delayed-stream: 1.0.0 557 | dev: false 558 | 559 | /crypto-js@4.1.1: 560 | resolution: {integrity: sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==} 561 | dev: false 562 | 563 | /d@1.0.1: 564 | resolution: {integrity: sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==} 565 | dependencies: 566 | es5-ext: 0.10.62 567 | type: 1.2.0 568 | dev: false 569 | 570 | /debug@2.6.9: 571 | resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} 572 | peerDependencies: 573 | supports-color: '*' 574 | peerDependenciesMeta: 575 | supports-color: 576 | optional: true 577 | dependencies: 578 | ms: 2.0.0 579 | dev: false 580 | 581 | /debug@4.3.4: 582 | resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} 583 | engines: {node: '>=6.0'} 584 | peerDependencies: 585 | supports-color: '*' 586 | peerDependenciesMeta: 587 | supports-color: 588 | optional: true 589 | dependencies: 590 | ms: 2.1.2 591 | dev: true 592 | 593 | /delayed-stream@1.0.0: 594 | resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} 595 | engines: {node: '>=0.4.0'} 596 | dev: false 597 | 598 | /elliptic@6.5.4: 599 | resolution: {integrity: sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==} 600 | dependencies: 601 | bn.js: 4.12.0 602 | brorand: 1.1.0 603 | hash.js: 1.1.7 604 | hmac-drbg: 1.0.1 605 | inherits: 2.0.4 606 | minimalistic-assert: 1.0.1 607 | minimalistic-crypto-utils: 1.0.1 608 | dev: false 609 | 610 | /es5-ext@0.10.62: 611 | resolution: {integrity: sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==} 612 | engines: {node: '>=0.10'} 613 | requiresBuild: true 614 | dependencies: 615 | es6-iterator: 2.0.3 616 | es6-symbol: 3.1.3 617 | next-tick: 1.1.0 618 | dev: false 619 | 620 | /es6-iterator@2.0.3: 621 | resolution: {integrity: sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==} 622 | dependencies: 623 | d: 1.0.1 624 | es5-ext: 0.10.62 625 | es6-symbol: 3.1.3 626 | dev: false 627 | 628 | /es6-symbol@3.1.3: 629 | resolution: {integrity: sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==} 630 | dependencies: 631 | d: 1.0.1 632 | ext: 1.7.0 633 | dev: false 634 | 635 | /ethers@5.0.0: 636 | resolution: {integrity: sha512-uOSACd2E8dg8XuiOewpL42uFH7SvrkA5k0oGkHoqSJl2lflrMPV+7ciWzyuPBjyHnOFvAPPJUpsXrwpFKaLFww==} 637 | dependencies: 638 | '@ethersproject/abi': 5.7.0 639 | '@ethersproject/abstract-provider': 5.7.0 640 | '@ethersproject/abstract-signer': 5.7.0 641 | '@ethersproject/address': 5.7.0 642 | '@ethersproject/base64': 5.7.0 643 | '@ethersproject/bignumber': 5.7.0 644 | '@ethersproject/bytes': 5.7.0 645 | '@ethersproject/constants': 5.7.0 646 | '@ethersproject/contracts': 5.7.0 647 | '@ethersproject/hash': 5.7.0 648 | '@ethersproject/hdnode': 5.7.0 649 | '@ethersproject/json-wallets': 5.7.0 650 | '@ethersproject/keccak256': 5.7.0 651 | '@ethersproject/logger': 5.7.0 652 | '@ethersproject/networks': 5.7.1 653 | '@ethersproject/pbkdf2': 5.7.0 654 | '@ethersproject/properties': 5.7.0 655 | '@ethersproject/providers': 5.7.2 656 | '@ethersproject/random': 5.7.0 657 | '@ethersproject/rlp': 5.7.0 658 | '@ethersproject/sha2': 5.7.0 659 | '@ethersproject/signing-key': 5.7.0 660 | '@ethersproject/solidity': 5.7.0 661 | '@ethersproject/strings': 5.7.0 662 | '@ethersproject/transactions': 5.7.0 663 | '@ethersproject/units': 5.7.0 664 | '@ethersproject/wallet': 5.7.0 665 | '@ethersproject/web': 5.7.1 666 | '@ethersproject/wordlists': 5.7.0 667 | transitivePeerDependencies: 668 | - bufferutil 669 | - utf-8-validate 670 | dev: false 671 | 672 | /ext@1.7.0: 673 | resolution: {integrity: sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==} 674 | dependencies: 675 | type: 2.7.2 676 | dev: false 677 | 678 | /follow-redirects@1.15.2: 679 | resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==} 680 | engines: {node: '>=4.0'} 681 | peerDependencies: 682 | debug: '*' 683 | peerDependenciesMeta: 684 | debug: 685 | optional: true 686 | dev: false 687 | 688 | /form-data@4.0.0: 689 | resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} 690 | engines: {node: '>= 6'} 691 | dependencies: 692 | asynckit: 0.4.0 693 | combined-stream: 1.0.8 694 | mime-types: 2.1.35 695 | dev: false 696 | 697 | /fs-extra@11.1.1: 698 | resolution: {integrity: sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==} 699 | engines: {node: '>=14.14'} 700 | dependencies: 701 | graceful-fs: 4.2.11 702 | jsonfile: 6.1.0 703 | universalify: 2.0.0 704 | dev: false 705 | 706 | /graceful-fs@4.2.11: 707 | resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} 708 | dev: false 709 | 710 | /hash.js@1.1.7: 711 | resolution: {integrity: sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==} 712 | dependencies: 713 | inherits: 2.0.4 714 | minimalistic-assert: 1.0.1 715 | dev: false 716 | 717 | /hmac-drbg@1.0.1: 718 | resolution: {integrity: sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==} 719 | dependencies: 720 | hash.js: 1.1.7 721 | minimalistic-assert: 1.0.1 722 | minimalistic-crypto-utils: 1.0.1 723 | dev: false 724 | 725 | /inherits@2.0.4: 726 | resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} 727 | dev: false 728 | 729 | /is-typedarray@1.0.0: 730 | resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==} 731 | dev: false 732 | 733 | /js-sha3@0.8.0: 734 | resolution: {integrity: sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==} 735 | dev: false 736 | 737 | /jsonfile@6.1.0: 738 | resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} 739 | dependencies: 740 | universalify: 2.0.0 741 | optionalDependencies: 742 | graceful-fs: 4.2.11 743 | dev: false 744 | 745 | /mime-db@1.52.0: 746 | resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} 747 | engines: {node: '>= 0.6'} 748 | dev: false 749 | 750 | /mime-types@2.1.35: 751 | resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} 752 | engines: {node: '>= 0.6'} 753 | dependencies: 754 | mime-db: 1.52.0 755 | dev: false 756 | 757 | /minimalistic-assert@1.0.1: 758 | resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==} 759 | dev: false 760 | 761 | /minimalistic-crypto-utils@1.0.1: 762 | resolution: {integrity: sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==} 763 | dev: false 764 | 765 | /ms@2.0.0: 766 | resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} 767 | dev: false 768 | 769 | /ms@2.1.2: 770 | resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} 771 | dev: true 772 | 773 | /next-tick@1.1.0: 774 | resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==} 775 | dev: false 776 | 777 | /node-gyp-build@4.6.0: 778 | resolution: {integrity: sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==} 779 | hasBin: true 780 | dev: false 781 | 782 | /pirates@4.0.6: 783 | resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==} 784 | engines: {node: '>= 6'} 785 | dev: true 786 | 787 | /proxy-from-env@1.1.0: 788 | resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} 789 | dev: false 790 | 791 | /scrypt-js@3.0.1: 792 | resolution: {integrity: sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==} 793 | dev: false 794 | 795 | /source-map-support@0.5.21: 796 | resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} 797 | dependencies: 798 | buffer-from: 1.1.2 799 | source-map: 0.6.1 800 | dev: true 801 | 802 | /source-map@0.6.1: 803 | resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} 804 | engines: {node: '>=0.10.0'} 805 | dev: true 806 | 807 | /tslib@2.6.0: 808 | resolution: {integrity: sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==} 809 | dev: true 810 | 811 | /type@1.2.0: 812 | resolution: {integrity: sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==} 813 | dev: false 814 | 815 | /type@2.7.2: 816 | resolution: {integrity: sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==} 817 | dev: false 818 | 819 | /typedarray-to-buffer@3.1.5: 820 | resolution: {integrity: sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==} 821 | dependencies: 822 | is-typedarray: 1.0.0 823 | dev: false 824 | 825 | /typescript@5.1.3: 826 | resolution: {integrity: sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==} 827 | engines: {node: '>=14.17'} 828 | hasBin: true 829 | dev: true 830 | 831 | /universalify@2.0.0: 832 | resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} 833 | engines: {node: '>= 10.0.0'} 834 | dev: false 835 | 836 | /utf-8-validate@5.0.10: 837 | resolution: {integrity: sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==} 838 | engines: {node: '>=6.14.2'} 839 | requiresBuild: true 840 | dependencies: 841 | node-gyp-build: 4.6.0 842 | dev: false 843 | 844 | /websocket@1.0.34: 845 | resolution: {integrity: sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==} 846 | engines: {node: '>=4.0.0'} 847 | dependencies: 848 | bufferutil: 4.0.7 849 | debug: 2.6.9 850 | es5-ext: 0.10.62 851 | typedarray-to-buffer: 3.1.5 852 | utf-8-validate: 5.0.10 853 | yaeti: 0.0.6 854 | transitivePeerDependencies: 855 | - supports-color 856 | dev: false 857 | 858 | /ws@7.4.6: 859 | resolution: {integrity: sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==} 860 | engines: {node: '>=8.3.0'} 861 | peerDependencies: 862 | bufferutil: ^4.0.1 863 | utf-8-validate: ^5.0.2 864 | peerDependenciesMeta: 865 | bufferutil: 866 | optional: true 867 | utf-8-validate: 868 | optional: true 869 | dev: false 870 | 871 | /yaeti@0.0.6: 872 | resolution: {integrity: sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==} 873 | engines: {node: '>=0.10.32'} 874 | dev: false 875 | -------------------------------------------------------------------------------- /tasks/airswap/abi.ts: -------------------------------------------------------------------------------- 1 | export const poolAbi = [ 2 | { 3 | type: 'constructor', 4 | stateMutability: 'nonpayable', 5 | inputs: [{ type: 'address', name: '_WETH', internalType: 'address' }], 6 | }, 7 | { 8 | type: 'event', 9 | name: 'ClientData', 10 | inputs: [ 11 | { 12 | type: 'bytes', 13 | name: 'clientData', 14 | internalType: 'bytes', 15 | indexed: false, 16 | }, 17 | ], 18 | anonymous: false, 19 | }, 20 | { 21 | type: 'event', 22 | name: 'Error', 23 | inputs: [ 24 | { 25 | type: 'string', 26 | name: 'reason', 27 | internalType: 'string', 28 | indexed: false, 29 | }, 30 | ], 31 | anonymous: false, 32 | }, 33 | { 34 | type: 'event', 35 | name: 'Exchange', 36 | inputs: [ 37 | { 38 | type: 'address', 39 | name: 'pair', 40 | internalType: 'address', 41 | indexed: false, 42 | }, 43 | { 44 | type: 'uint256', 45 | name: 'amountOut', 46 | internalType: 'uint256', 47 | indexed: false, 48 | }, 49 | { 50 | type: 'address', 51 | name: 'output', 52 | internalType: 'address', 53 | indexed: false, 54 | }, 55 | ], 56 | anonymous: false, 57 | }, 58 | { 59 | type: 'event', 60 | name: 'Fee', 61 | inputs: [ 62 | { 63 | type: 'address', 64 | name: 'token', 65 | internalType: 'address', 66 | indexed: false, 67 | }, 68 | { 69 | type: 'uint256', 70 | name: 'totalAmount', 71 | internalType: 'uint256', 72 | indexed: false, 73 | }, 74 | { 75 | type: 'uint256', 76 | name: 'totalFee', 77 | internalType: 'uint256', 78 | indexed: false, 79 | }, 80 | { 81 | type: 'address[]', 82 | name: 'recipients', 83 | internalType: 'address[]', 84 | indexed: false, 85 | }, 86 | { 87 | type: 'uint256[]', 88 | name: 'amounts', 89 | internalType: 'uint256[]', 90 | indexed: false, 91 | }, 92 | { type: 'bool', name: 'isBps', internalType: 'bool', indexed: false }, 93 | ], 94 | anonymous: false, 95 | }, 96 | { 97 | type: 'event', 98 | name: 'OwnershipTransferred', 99 | inputs: [ 100 | { 101 | type: 'address', 102 | name: 'previousOwner', 103 | internalType: 'address', 104 | indexed: true, 105 | }, 106 | { 107 | type: 'address', 108 | name: 'newOwner', 109 | internalType: 'address', 110 | indexed: true, 111 | }, 112 | ], 113 | anonymous: false, 114 | }, 115 | { 116 | type: 'event', 117 | name: 'Swapped', 118 | inputs: [ 119 | { 120 | type: 'address', 121 | name: 'sender', 122 | internalType: 'address', 123 | indexed: false, 124 | }, 125 | { 126 | type: 'address', 127 | name: 'srcToken', 128 | internalType: 'contract IERC20', 129 | indexed: false, 130 | }, 131 | { 132 | type: 'address', 133 | name: 'dstToken', 134 | internalType: 'contract IERC20', 135 | indexed: false, 136 | }, 137 | { 138 | type: 'address', 139 | name: 'dstReceiver', 140 | internalType: 'address', 141 | indexed: false, 142 | }, 143 | { 144 | type: 'uint256', 145 | name: 'spentAmount', 146 | internalType: 'uint256', 147 | indexed: false, 148 | }, 149 | { 150 | type: 'uint256', 151 | name: 'returnAmount', 152 | internalType: 'uint256', 153 | indexed: false, 154 | }, 155 | ], 156 | anonymous: false, 157 | }, 158 | { 159 | type: 'function', 160 | stateMutability: 'view', 161 | outputs: [{ type: 'address', name: '', internalType: 'address' }], 162 | name: 'WETH', 163 | inputs: [], 164 | }, 165 | { 166 | type: 'function', 167 | stateMutability: 'view', 168 | outputs: [{ type: 'bool', name: '', internalType: 'bool' }], 169 | name: 'isWhitelist', 170 | inputs: [{ type: 'address', name: '', internalType: 'address' }], 171 | }, 172 | { 173 | type: 'function', 174 | stateMutability: 'view', 175 | outputs: [{ type: 'address', name: '', internalType: 'address' }], 176 | name: 'owner', 177 | inputs: [], 178 | }, 179 | { 180 | type: 'function', 181 | stateMutability: 'nonpayable', 182 | outputs: [], 183 | name: 'renounceOwnership', 184 | inputs: [], 185 | }, 186 | { 187 | type: 'function', 188 | stateMutability: 'nonpayable', 189 | outputs: [], 190 | name: 'rescueFunds', 191 | inputs: [ 192 | { type: 'address', name: 'token', internalType: 'address' }, 193 | { type: 'uint256', name: 'amount', internalType: 'uint256' }, 194 | ], 195 | }, 196 | { 197 | type: 'function', 198 | stateMutability: 'payable', 199 | outputs: [ 200 | { type: 'uint256', name: 'returnAmount', internalType: 'uint256' }, 201 | { type: 'uint256', name: 'gasUsed', internalType: 'uint256' }, 202 | ], 203 | name: 'swap', 204 | inputs: [ 205 | { 206 | type: 'tuple', 207 | name: 'execution', 208 | internalType: 'struct MetaAggregationRouterV2.SwapExecutionParams', 209 | components: [ 210 | { type: 'address', name: 'callTarget', internalType: 'address' }, 211 | { type: 'address', name: 'approveTarget', internalType: 'address' }, 212 | { type: 'bytes', name: 'targetData', internalType: 'bytes' }, 213 | { 214 | type: 'tuple', 215 | name: 'desc', 216 | internalType: 'struct MetaAggregationRouterV2.SwapDescriptionV2', 217 | components: [ 218 | { 219 | type: 'address', 220 | name: 'srcToken', 221 | internalType: 'contract IERC20', 222 | }, 223 | { 224 | type: 'address', 225 | name: 'dstToken', 226 | internalType: 'contract IERC20', 227 | }, 228 | { 229 | type: 'address[]', 230 | name: 'srcReceivers', 231 | internalType: 'address[]', 232 | }, 233 | { 234 | type: 'uint256[]', 235 | name: 'srcAmounts', 236 | internalType: 'uint256[]', 237 | }, 238 | { 239 | type: 'address[]', 240 | name: 'feeReceivers', 241 | internalType: 'address[]', 242 | }, 243 | { 244 | type: 'uint256[]', 245 | name: 'feeAmounts', 246 | internalType: 'uint256[]', 247 | }, 248 | { type: 'address', name: 'dstReceiver', internalType: 'address' }, 249 | { type: 'uint256', name: 'amount', internalType: 'uint256' }, 250 | { 251 | type: 'uint256', 252 | name: 'minReturnAmount', 253 | internalType: 'uint256', 254 | }, 255 | { type: 'uint256', name: 'flags', internalType: 'uint256' }, 256 | { type: 'bytes', name: 'permit', internalType: 'bytes' }, 257 | ], 258 | }, 259 | { type: 'bytes', name: 'clientData', internalType: 'bytes' }, 260 | ], 261 | }, 262 | ], 263 | }, 264 | { 265 | type: 'function', 266 | stateMutability: 'payable', 267 | outputs: [ 268 | { type: 'uint256', name: 'returnAmount', internalType: 'uint256' }, 269 | { type: 'uint256', name: 'gasUsed', internalType: 'uint256' }, 270 | ], 271 | name: 'swapGeneric', 272 | inputs: [ 273 | { 274 | type: 'tuple', 275 | name: 'execution', 276 | internalType: 'struct MetaAggregationRouterV2.SwapExecutionParams', 277 | components: [ 278 | { type: 'address', name: 'callTarget', internalType: 'address' }, 279 | { type: 'address', name: 'approveTarget', internalType: 'address' }, 280 | { type: 'bytes', name: 'targetData', internalType: 'bytes' }, 281 | { 282 | type: 'tuple', 283 | name: 'desc', 284 | internalType: 'struct MetaAggregationRouterV2.SwapDescriptionV2', 285 | components: [ 286 | { 287 | type: 'address', 288 | name: 'srcToken', 289 | internalType: 'contract IERC20', 290 | }, 291 | { 292 | type: 'address', 293 | name: 'dstToken', 294 | internalType: 'contract IERC20', 295 | }, 296 | { 297 | type: 'address[]', 298 | name: 'srcReceivers', 299 | internalType: 'address[]', 300 | }, 301 | { 302 | type: 'uint256[]', 303 | name: 'srcAmounts', 304 | internalType: 'uint256[]', 305 | }, 306 | { 307 | type: 'address[]', 308 | name: 'feeReceivers', 309 | internalType: 'address[]', 310 | }, 311 | { 312 | type: 'uint256[]', 313 | name: 'feeAmounts', 314 | internalType: 'uint256[]', 315 | }, 316 | { type: 'address', name: 'dstReceiver', internalType: 'address' }, 317 | { type: 'uint256', name: 'amount', internalType: 'uint256' }, 318 | { 319 | type: 'uint256', 320 | name: 'minReturnAmount', 321 | internalType: 'uint256', 322 | }, 323 | { type: 'uint256', name: 'flags', internalType: 'uint256' }, 324 | { type: 'bytes', name: 'permit', internalType: 'bytes' }, 325 | ], 326 | }, 327 | { type: 'bytes', name: 'clientData', internalType: 'bytes' }, 328 | ], 329 | }, 330 | ], 331 | }, 332 | { 333 | type: 'function', 334 | stateMutability: 'nonpayable', 335 | outputs: [ 336 | { type: 'uint256', name: 'returnAmount', internalType: 'uint256' }, 337 | { type: 'uint256', name: 'gasUsed', internalType: 'uint256' }, 338 | ], 339 | name: 'swapSimpleMode', 340 | inputs: [ 341 | { 342 | type: 'address', 343 | name: 'caller', 344 | internalType: 'contract IAggregationExecutor', 345 | }, 346 | { 347 | type: 'tuple', 348 | name: 'desc', 349 | internalType: 'struct MetaAggregationRouterV2.SwapDescriptionV2', 350 | components: [ 351 | { 352 | type: 'address', 353 | name: 'srcToken', 354 | internalType: 'contract IERC20', 355 | }, 356 | { 357 | type: 'address', 358 | name: 'dstToken', 359 | internalType: 'contract IERC20', 360 | }, 361 | { 362 | type: 'address[]', 363 | name: 'srcReceivers', 364 | internalType: 'address[]', 365 | }, 366 | { type: 'uint256[]', name: 'srcAmounts', internalType: 'uint256[]' }, 367 | { 368 | type: 'address[]', 369 | name: 'feeReceivers', 370 | internalType: 'address[]', 371 | }, 372 | { type: 'uint256[]', name: 'feeAmounts', internalType: 'uint256[]' }, 373 | { type: 'address', name: 'dstReceiver', internalType: 'address' }, 374 | { type: 'uint256', name: 'amount', internalType: 'uint256' }, 375 | { type: 'uint256', name: 'minReturnAmount', internalType: 'uint256' }, 376 | { type: 'uint256', name: 'flags', internalType: 'uint256' }, 377 | { type: 'bytes', name: 'permit', internalType: 'bytes' }, 378 | ], 379 | }, 380 | { type: 'bytes', name: 'executorData', internalType: 'bytes' }, 381 | { type: 'bytes', name: 'clientData', internalType: 'bytes' }, 382 | ], 383 | }, 384 | { 385 | type: 'function', 386 | stateMutability: 'nonpayable', 387 | outputs: [], 388 | name: 'transferOwnership', 389 | inputs: [{ type: 'address', name: 'newOwner', internalType: 'address' }], 390 | }, 391 | { 392 | type: 'function', 393 | stateMutability: 'nonpayable', 394 | outputs: [], 395 | name: 'updateWhitelist', 396 | inputs: [ 397 | { type: 'address[]', name: 'addr', internalType: 'address[]' }, 398 | { type: 'bool[]', name: 'value', internalType: 'bool[]' }, 399 | ], 400 | }, 401 | { type: 'receive', stateMutability: 'payable' }, 402 | ]; 403 | -------------------------------------------------------------------------------- /tasks/airswap/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides, approveErc20, logGasCost } from '../base' 3 | import axios from 'axios'; 4 | import erc20abi from '@/const/erc20.json' 5 | import { randomUUID } from 'node:crypto' 6 | import { task } from '@/utils/utils'; 7 | 8 | export const run = async (wallet: ethers.Wallet) => { 9 | 10 | await task(async () => { 11 | const signer = wallet.connect(provider); 12 | const abi = [ 13 | 'function swap(address recipient, uint256 nonce, uint256 expiry, address signerWallet, address signerToken, uint256 signerAmount, address senderToken, uint256 senderAmount, uint8 v, bytes32 r, bytes32 s)' 14 | ] 15 | const contract = new ethers.Contract('0x1e92ffc1c39a0a982c462f521a135a0407b21b71', abi, signer); 16 | const usdc = new ethers.Contract('0xf56dc6695cF1f5c364eDEbC7Dc7077ac9B586068', erc20abi, signer); 17 | const usdcAmount = ethers.utils.parseUnits('10', 6); 18 | const usdcBalance = await usdc.balanceOf(wallet.address); 19 | 20 | if (usdcBalance.lt(usdcAmount)) { 21 | console.log(`Insufficient USDC balance. Please deposit at least ${usdcAmount.toString()} USDC to ${wallet.address}`) 22 | return 23 | } 24 | await approveErc20(signer, usdc.address, contract.address) 25 | 26 | const uuid = randomUUID(); 27 | const res = await axios.post('https://airswap-linea-http-fd13bb1cf776.herokuapp.com/', { "method": "getSignerSideOrderERC20", "jsonrpc": "2.0", "params": { "chainId": "59140", "swapContract": "0x1E92FFC1c39a0a982c462f521a135a0407b21B71", "senderAmount": ethers.utils.parseUnits('10', 6).toString(), "signerToken": "0x1990bc6dfe2ef605bfc08f5a23564db75642ad73", "senderToken": "0xf56dc6695cf1f5c364edebc7dc7077ac9b586068", "senderWallet": wallet.address }, "id": uuid }) 28 | const { result } = res.data; 29 | const tx = await contract.swap( 30 | result.senderWallet, 31 | result.nonce, 32 | result.expiry, 33 | result.signerWallet, 34 | result.signerToken, 35 | result.signerAmount, 36 | result.senderToken, 37 | result.senderAmount, 38 | result.v, 39 | result.r, 40 | result.s, 41 | await overrides(wallet.address) 42 | ) 43 | logGasCost(await tx.wait()) 44 | }, { 45 | taskName: 'airswap_swap', 46 | walletAddr: wallet.address, 47 | }) 48 | } 49 | 50 | // @todo otc swap 51 | export const otcSwap = async (wallet: ethers.Wallet) => { 52 | const signer = wallet.connect(provider); 53 | const expiry = (Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 7).toString(); 54 | const nonce = Date.now().toString(); 55 | const senderWallet = ethers.constants.AddressZero; 56 | const signerWallet = wallet.address; 57 | const signerToken = '0xf56dc6695cf1f5c364edebc7dc7077ac9b586068'; 58 | const senderToken = '0x2C1b868d6596a18e32E61B901E4060C872647b6C'; 59 | const protocolFee = "7"; 60 | const signerAmount = "10000000" 61 | const senderAmount = "10000000000000"; 62 | const unsignedOrder = { 63 | expiry, 64 | nonce, 65 | protocolFee, 66 | senderAmount, 67 | senderToken, 68 | senderWallet, 69 | signerAmount, 70 | signerToken, 71 | signerWallet 72 | } 73 | const EIP712SwapERC20 = { 74 | EIP712Domain: [ 75 | { name: 'name', type: 'string' }, 76 | { name: 'version', type: 'string' }, 77 | { name: 'chainId', type: 'uint256' }, 78 | { name: 'verifyingContract', type: 'address' }, 79 | ], 80 | OrderERC20: [ 81 | { name: 'nonce', type: 'uint256' }, 82 | { name: 'expiry', type: 'uint256' }, 83 | { name: 'signerWallet', type: 'address' }, 84 | { name: 'signerToken', type: 'address' }, 85 | { name: 'signerAmount', type: 'uint256' }, 86 | { name: 'protocolFee', type: 'uint256' }, 87 | { name: 'senderWallet', type: 'address' }, 88 | { name: 'senderToken', type: 'address' }, 89 | { name: 'senderAmount', type: 'uint256' }, 90 | ], 91 | } 92 | const signature = await signer._signTypedData( 93 | { 94 | verifyingContract: '0x1e92ffc1c39a0a982c462f521a135a0407b21b71', 95 | chainId: 59140, 96 | version: '4', 97 | name: 'SWAP_ERC20', 98 | }, 99 | { OrderERC20: EIP712SwapERC20.OrderERC20 }, 100 | unsignedOrder 101 | ); 102 | const splitSignature = ethers.utils.splitSignature(signature); 103 | const fullOrder = { 104 | ...unsignedOrder, 105 | ...splitSignature, 106 | chainId: 59140, 107 | swapContract: '0x1e92ffc1c39a0a982c462f521a135a0407b21b71' 108 | } 109 | console.log("🚀 ~ file: index.ts:99 ~ otcSwap ~ signature:", signature) 110 | } -------------------------------------------------------------------------------- /tasks/base.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import erc20abi from '@/const/erc20.json' 3 | import { config } from '@/config'; 4 | 5 | export const lineaProvider = new ethers.providers.JsonRpcProvider(config.rpc) 6 | 7 | const GASPRICE_LIMIT = config.MAX_GAS_PRICE || 5000; 8 | 9 | export const overrides = async (addr: string, limit = GASPRICE_LIMIT) => { 10 | const gasPrice = await lineaProvider.getGasPrice(); 11 | const gasGwei = ethers.utils.formatUnits(gasPrice, 'gwei'); 12 | console.log(`⛽️当前气价: ${Math.ceil(+gasGwei)}Gwei`) 13 | if (+gasGwei > limit) throw Error(`❌气价超过 ${GASPRICE_LIMIT}Gwei 限制!`); 14 | const modifyGasPrice = gasPrice.add(ethers.utils.parseUnits(`${config.ADD_GAS_PRICE}`, 'gwei')) 15 | const nonce = await lineaProvider.getTransactionCount(addr); 16 | return ({ 17 | nonce, 18 | maxFeePerGas: modifyGasPrice, 19 | maxPriorityFeePerGas: modifyGasPrice 20 | }) 21 | } 22 | 23 | export const approveErc20 = async (signer: ethers.Wallet, token: string, spender: string) => { 24 | const coin = new ethers.Contract(token, erc20abi, signer); 25 | const allowance = await coin.allowance(signer.address, spender); 26 | if (allowance.isZero()) { 27 | console.log(`⌛️ Token授权\ntoken:${token}\nspender:${spender}`); 28 | const approveTx = await coin.approve(spender, ethers.constants.MaxUint256, await overrides(signer.address)); 29 | await approveTx.wait(); 30 | console.log(`✅授权成功`) 31 | } 32 | return coin 33 | } 34 | 35 | export const logGasCost = async (receipt: ethers.ContractReceipt) => { 36 | const cost = receipt.gasUsed.mul(receipt.effectiveGasPrice); 37 | console.log(`💰[花费Gas] ${ethers.utils.formatEther(cost)}Eth`) 38 | } 39 | 40 | export const getBalanceWithLog = async (wallet: ethers.Wallet) => { 41 | const balance = await wallet.getBalance(); 42 | console.log(`💰[ETH余额] ${ethers.utils.formatEther(balance)}Eth`) 43 | return balance; 44 | } -------------------------------------------------------------------------------- /tasks/cashmere/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides, approveErc20 } from '../base' 3 | import { getTxtContent, loop, task } from '@/utils/utils'; 4 | import path from 'node:path'; 5 | 6 | const tUSDT = '0xf484ca938af7165d0a8d99746939b1b60a26f0af' 7 | const ca = '0x7dea0cdce2dff29d0704ae95852d1bc553e412ff' 8 | const tusdtAbi = ['function balanceOf(address) view returns (uint256)']; 9 | const AIRDROP_OUTER_LINEA_ADDR = '0x975427167FB9ec0Ed468F0EBda16F3C194eEF699'; 10 | 11 | export const airdropTUSDT = async () => { 12 | const keys = getTxtContent(path.join(process.cwd(), './keys.txt')).filter(Boolean) as string[]; 13 | // 检查每个钱包的tUSDT余额 14 | const tUSDTContract = new ethers.Contract(tUSDT, tusdtAbi, provider); 15 | const amounts: { balance: ethers.BigNumber, address: string; pk: string }[] = []; 16 | console.log(`[cashmere前置检查]开始检查${keys.length}个钱包中是否有符合空投tUSDC规则的钱包`) 17 | await Promise.all( 18 | keys.map(async (pk) => { 19 | await loop(async () => { 20 | const w = new ethers.Wallet(pk, provider); 21 | const balance = await tUSDTContract.balanceOf(w.address); 22 | console.log(`[${w.address}: ${ethers.utils.formatEther(balance)}`) 23 | amounts.push({ balance, pk, address: w.address }); 24 | }) 25 | }) 26 | ) 27 | 28 | const hasBalance = amounts.find(({ balance }) => balance.gte(ethers.utils.parseEther('0.001'))); 29 | if (!hasBalance) { 30 | console.log(`[cashmere前置检查]未找到有tUSDC余额的钱包, 将跳过cashmere任务`) 31 | return false 32 | } 33 | console.log(`[cashmere前置检查]找到含有tUSDC余额的钱包, 执行空投tusdc任务`) 34 | const { balance, pk } = hasBalance; 35 | // 开始空投 36 | const airdropSigner = new ethers.Wallet(pk, provider); 37 | 38 | await approveErc20(airdropSigner, tUSDT, AIRDROP_OUTER_LINEA_ADDR); 39 | 40 | const airdropAddresses = amounts.map(({ address }) => address); 41 | const airdropAmount = balance.div(airdropAddresses.length.toString()); 42 | const airdropAbi = ['function multiTransferToken(address, address[], uint256[])']; 43 | const airdropContract = new ethers.Contract(AIRDROP_OUTER_LINEA_ADDR, airdropAbi, airdropSigner); 44 | const slice = 200; 45 | if (airdropAddresses.length > slice) { 46 | console.log(`[cashmere前置检查]空投地址数量超过${slice}个, 将分批空投`) 47 | } 48 | while (airdropAddresses.length) { 49 | // 分批空投 50 | const addrs = airdropAddresses.splice(0, slice); 51 | console.log(`[cashmere前置检查]开始空投tUSDC, 当前批次${addrs.length}个地址, 空投金额${ethers.utils.formatEther(airdropAmount)}`) 52 | const airdropAmounts = Array(addrs.length).fill(airdropAmount); 53 | const gasPrice = await provider.getGasPrice(); 54 | const modifyGasPrice = gasPrice.add(ethers.utils.parseUnits('50', 'gwei')) 55 | const nonce = await provider.getTransactionCount(airdropSigner.address); 56 | const gasLimit = await airdropContract.estimateGas.multiTransferToken( 57 | tUSDT, 58 | addrs, 59 | airdropAmounts, 60 | ) 61 | const estimateGasCost = gasLimit.mul(modifyGasPrice); 62 | const balance = await provider.getBalance(airdropSigner.address); 63 | if (balance.lt(estimateGasCost)) { 64 | console.log(`[cashmere前置检查]空投tUSDC失败, 当前gas ${ethers.utils.formatUnits(gasPrice, 'gwei')}gwei, 预期需要${ethers.utils.formatEther(estimateGasCost)}eth, 余额${ethers.utils.formatEther(balance)}不足以支付gas费用`) 65 | return; 66 | } 67 | const tx = await airdropContract.multiTransferToken( 68 | tUSDT, 69 | addrs, 70 | airdropAmounts, 71 | { 72 | nonce, 73 | maxFeePerGas: modifyGasPrice, 74 | maxPriorityFeePerGas: modifyGasPrice 75 | } 76 | ) 77 | await tx.wait(); 78 | } 79 | console.log(`✅[cashmere前置检查]空投tUSDC完成, cashmere任务将按期执行`) 80 | return true; 81 | } 82 | 83 | export const run = async (wallet: ethers.Wallet) => { 84 | const signer = wallet.connect(provider); 85 | 86 | let abi = ['function deposit(address, uint16, uint256) payable']; 87 | const contract = new ethers.Contract(ca, abi, signer); 88 | 89 | const tUSDTContract = new ethers.Contract(tUSDT, tusdtAbi, signer); 90 | 91 | await task(async () => { 92 | const tUSDTBalance: ethers.BigNumber = await tUSDTContract.balanceOf(wallet.address); 93 | if (tUSDTBalance.isZero()) { 94 | throw Error('tUSDC余额为0, 无法完成任务'); 95 | } 96 | 97 | await approveErc20(signer, tUSDT, ca); 98 | const tx = await contract.deposit( 99 | wallet.address, 100 | 1, 101 | tUSDTBalance.div(2), 102 | { 103 | ...await overrides(wallet.address), 104 | } 105 | ) 106 | await tx.wait(); 107 | }, { 108 | taskName: 'cashmere_deposit', 109 | walletAddr: wallet.address, 110 | }) 111 | } 112 | 113 | -------------------------------------------------------------------------------- /tasks/compound/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides, logGasCost, approveErc20 } from '../base' 3 | import { task } from '@/utils/utils'; 4 | import { supplyAbi } from './abi'; 5 | 6 | export const run = async (wallet: ethers.Wallet) => { 7 | const signer = wallet.connect(provider); 8 | const allowCa = '0xa84b24A43ba1890A165f94Ad13d0196E5fD1023a'; 9 | const ca = '0xad6729C101691A63F7d1e4CcbaD04bC8c6818a22'; 10 | let abi = ['function allow(address, bool)'] as any; 11 | let contract = new ethers.Contract(allowCa, abi, signer); 12 | 13 | await task(async () => { 14 | const tx = await contract.allow( 15 | '0xad6729C101691A63F7d1e4CcbaD04bC8c6818a22', 16 | true, 17 | await overrides(wallet.address) 18 | ) 19 | logGasCost(await tx.wait()); 20 | }, { 21 | taskName: 'compound_borrow_allow', 22 | walletAddr: wallet.address, 23 | }) 24 | 25 | await task(async () => { 26 | const tx = await signer.sendTransaction({ 27 | to: ca, 28 | value: ethers.utils.parseEther('0.01'), 29 | // data: '0x555029a6000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002414354494f4e5f535550504c595f4e41544956455f544f4b454e000000000000414354494f4e5f57495448445241575f415353455400000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a84b24a43ba1890a165f94ad13d0196e5fd1023a000000000000000000000000ec575ab94ea90f368f1ff5b832183845bb23602d000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000a84b24a43ba1890a165f94ad13d0196e5fd1023a000000000000000000000000ec575ab94ea90f368f1ff5b832183845bb23602d000000000000000000000000f56dc6695cf1f5c364edebc7dc7077ac9b58606800000000000000000000000000000000000000000000000000000000000f4240'.replaceAll('ec575ab94ea90f368f1ff5b832183845bb23602d', wallet.address.toLocaleLowerCase().substring(2)), 30 | data: '0x555029a6000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002414354494f4e5f535550504c595f4e41544956455f544f4b454e000000000000414354494f4e5f57495448445241575f415353455400000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a84b24a43ba1890a165f94ad13d0196e5fd1023a000000000000000000000000565e79f526245cae4a8c130ad95c7a2778f3ab4b000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000a84b24a43ba1890a165f94ad13d0196e5fd1023a000000000000000000000000565e79f526245cae4a8c130ad95c7a2778f3ab4b000000000000000000000000f56dc6695cf1f5c364edebc7dc7077ac9b58606800000000000000000000000000000000000000000000000000000000000186a0'.replaceAll('565E79F526245CAE4a8c130aD95c7a2778F3aB4b'.toLocaleLowerCase(), wallet.address.toLocaleLowerCase().substring(2)), 31 | ...await overrides(wallet.address) 32 | }) 33 | logGasCost(await tx.wait()); 34 | }, { 35 | taskName: 'compound_borrow_invoke', 36 | walletAddr: wallet.address, 37 | }) 38 | 39 | await task(async () => { 40 | const ca = '0xa84b24A43ba1890A165f94Ad13d0196E5fD1023a' 41 | const usdcAc = '0xf56dc6695cF1f5c364eDEbC7Dc7077ac9B586068' 42 | await approveErc20(signer, usdcAc, ca) 43 | const contarct = new ethers.Contract(ca, supplyAbi, signer); 44 | const tx = await contarct.supply( 45 | usdcAc, 46 | 1000, 47 | await overrides(wallet.address) 48 | ) 49 | logGasCost(await tx.wait()); 50 | }, { 51 | taskName: 'compound_supply', 52 | walletAddr: wallet.address, 53 | }) 54 | } 55 | -------------------------------------------------------------------------------- /tasks/dforce/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides, logGasCost, getBalanceWithLog } from '../base' 3 | import { task } from '@/utils/utils'; 4 | 5 | export const run = async (wallet: ethers.Wallet) => { 6 | const signer = wallet.connect(provider); 7 | const marketCa = '0x7cb50dcb90F7F98120B18C727556942f25e30F2a' 8 | const supplyEthCa = '0x1FC94B633F5F25171F86B7b4Ac845e762E3233Bd' 9 | let abi = ['function enterMarkets(address[])'] 10 | let contract = new ethers.Contract(marketCa, abi, signer); 11 | 12 | await task(async () => { 13 | const tx = await contract.enterMarkets([supplyEthCa], await overrides(wallet.address)); 14 | logGasCost(await tx.wait()) 15 | }, { 16 | taskName: 'dforce_enterMarkets', 17 | walletAddr: wallet.address, 18 | }) 19 | 20 | abi = ['function mint(address) payable'] 21 | contract = new ethers.Contract(supplyEthCa, abi, signer); 22 | 23 | await task(async () => { 24 | const amount = ethers.utils.parseEther('0.01'); 25 | const inputdata = contract.interface.encodeFunctionData('mint', [wallet.address]) 26 | const tx = await signer.sendTransaction({ 27 | to: supplyEthCa, 28 | data: inputdata, 29 | ...await overrides(wallet.address), 30 | value: amount 31 | }); 32 | logGasCost(await tx.wait()) 33 | }, { 34 | taskName: 'dforce_mint', 35 | walletAddr: wallet.address, 36 | }) 37 | 38 | const borrowCa = '0xC6d76E0706f3F75a13441Fc66A87D76C17BA6E70' 39 | abi = ['function borrow(uint256)'] 40 | contract = new ethers.Contract(borrowCa, abi, signer); 41 | await task(async () => { 42 | const balance = await getBalanceWithLog(signer); 43 | const emitGas = await contract.estimateGas.borrow(1000); 44 | const emitCost = emitGas.mul(await signer.getGasPrice()); 45 | if (emitCost.gt(balance)) { 46 | console.log(`❌余额不足,跳过...`) 47 | return false 48 | } 49 | const tx = await contract.borrow(1000, await overrides(wallet.address)); 50 | logGasCost(await tx.wait()) 51 | }, { 52 | taskName: 'dforce_borrow', 53 | walletAddr: wallet.address, 54 | }) 55 | } -------------------------------------------------------------------------------- /tasks/gridex/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides, logGasCost } from '../base' 3 | import { task } from '@/utils/utils'; 4 | import { makerAbi, swapAbi } from './abi'; 5 | 6 | export const run = async (wallet: ethers.Wallet) => { 7 | const signer = wallet.connect(provider); 8 | const routerCa = '0x426B751AbA5f49914bFbD4A1E45aEE099d757733' 9 | const routerContract = new ethers.Contract(routerCa, swapAbi, signer); 10 | const makerCa = '0x36e56cc52d7a0af506d1656765510cd930ff1595' 11 | const makerContract = new ethers.Contract(makerCa, makerAbi, signer); 12 | 13 | await task(async () => { 14 | const deadline = Math.floor(Date.now() / 1000) + 60 * 2000; 15 | const datas = []; 16 | datas.push( 17 | routerContract.interface.encodeFunctionData('exactInputSingle', [ 18 | [ 19 | "0x2C1b868d6596a18e32E61B901E4060C872647b6C", 20 | "0x1A7b6683348727430863F544dF03a7d196bc17Dc", 21 | 5, 22 | wallet.address, 23 | deadline, 24 | 100000000000000, 25 | Math.floor(Math.random() * 174680) + 1, 26 | 0 27 | ] 28 | ]) 29 | ) 30 | datas.push( 31 | routerContract.interface.encodeFunctionData('refundNativeToken', []) 32 | ) 33 | const tx = await routerContract.multicall(datas, { 34 | ...await overrides(wallet.address), 35 | value: ethers.utils.parseEther('0.0001'), 36 | }) 37 | logGasCost(await tx.wait()) 38 | }, { 39 | taskName: 'gridex_swap', 40 | walletAddr: wallet.address, 41 | }); 42 | 43 | 44 | await task(async () => { 45 | const deadline = Math.floor(Date.now() / 1000) + 60 * 2000; 46 | const params = [ 47 | deadline, 48 | wallet.address, 49 | "0x2C1b868d6596a18e32E61B901E4060C872647b6C", 50 | "0x1A7b6683348727430863F544dF03a7d196bc17Dc", 51 | 5, 52 | false, 53 | 201650, 54 | 100000000000000 55 | ]; 56 | const tx = await makerContract.placeMakerOrder(params, { 57 | ...await overrides(wallet.address), 58 | value: ethers.utils.parseEther('0.0001'), 59 | }) 60 | logGasCost(await tx.wait()) 61 | }, { 62 | taskName: 'gridex_place_makerorder', 63 | walletAddr: wallet.address, 64 | }) 65 | 66 | await task(async () => { 67 | const deadline = Date.now() + 365 * 60 * 60 * 1000; 68 | const amount = ethers.utils.parseEther('0.000001') 69 | const params = [ 70 | deadline, 71 | ethers.constants.AddressZero, 72 | "0x2C1b868d6596a18e32E61B901E4060C872647b6C", 73 | "0x1A7b6683348727430863F544dF03a7d196bc17Dc", 74 | 5, 75 | false, 76 | amount, 77 | ethers.BigNumber.from('-0x19658622b982a1af314c0c0d52d799').add(1), 78 | 0, 79 | '0x1f0db8a557251afaa018b988050615d1', 80 | ]; 81 | const tx = await makerContract.placeRelativeOrder(params, { 82 | ...await overrides(wallet.address), 83 | value: amount, 84 | }) 85 | logGasCost(await tx.wait()) 86 | }, { 87 | taskName: 'gridex_place_relative_makerorder', 88 | walletAddr: wallet.address, 89 | }) 90 | 91 | await task(async () => { 92 | const deadline = Math.floor(Date.now() / 1000) + 60 * 2000; 93 | const params = [ 94 | deadline, 95 | wallet.address, 96 | "0x2C1b868d6596a18e32E61B901E4060C872647b6C", 97 | "0x1A7b6683348727430863F544dF03a7d196bc17Dc", 98 | 5, 99 | false, 100 | [ 101 | [ 102 | 201930, 103 | 5000000000000 104 | ], 105 | [ 106 | 201365, 107 | 5000000000000 108 | ] 109 | ] 110 | 111 | ] 112 | const tx = await makerContract.placeMakerOrderInBatch(params, { 113 | ...await overrides(wallet.address), 114 | value: ethers.utils.parseEther('0.00001'), 115 | }) 116 | logGasCost(await tx.wait()) 117 | }, { 118 | taskName: 'gridex_place_makerorder_batch', 119 | walletAddr: wallet.address, 120 | }) 121 | } -------------------------------------------------------------------------------- /tasks/izumi/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides, logGasCost } from '../base' 3 | import { limitOrderAbi, liquidityAbi, swapAbi } from './abi'; 4 | import { task } from '@/utils/utils'; 5 | 6 | function num2Hex(e) { 7 | if (e < 10) 8 | return String(e); 9 | return "ABCDEF"[e - 10] 10 | } 11 | 12 | function fee2Hex(e) { 13 | const t = e % 16 14 | , n = Math.floor(e / 16) % 16 15 | , i = Math.floor(e / 256) % 16 16 | , a = Math.floor(e / 4096) % 16; 17 | return "0x" + num2Hex(0) + num2Hex(0) + num2Hex(a) + num2Hex(i) + num2Hex(n) + num2Hex(t) 18 | } 19 | 20 | function appendHex(e, t) { 21 | return e + t.slice(2) 22 | } 23 | 24 | function getTokenChainPath(e, t) { 25 | var n; 26 | let i = null !== (n = e[0].wrapTokenAddress) && void 0 !== n ? n : e[0].address; 27 | for (let s = 0; s < t.length; s++) { 28 | var a; 29 | i = appendHex(i, fee2Hex(t[s])), 30 | i = appendHex(i, null !== (a = e[s + 1].wrapTokenAddress) && void 0 !== a ? a : e[s + 1].address) 31 | } 32 | return i 33 | } 34 | 35 | export const swap = async (wallet: ethers.Wallet) => { 36 | const signer = wallet.connect(provider); 37 | const iface = new ethers.utils.Interface(swapAbi); 38 | const calldatas = []; 39 | const amount = ethers.utils.parseEther('0.001') 40 | const deadline = Math.floor(Date.now() / 1000) + 60 * 60 * 20; 41 | calldatas.push( 42 | iface.encodeFunctionData('swapAmount', [{ 43 | recipient: wallet.address, 44 | amount: amount, 45 | path: getTokenChainPath([{ 46 | "address": "0x67A1f4A939b477A6b7c5BF94D97E45dE87E608eF", 47 | }, 48 | { 49 | "address": "0x876508837C162aCedcc5dd7721015E83cbb4e339", 50 | }], [400]), 51 | minAcquired: ethers.constants.Zero, 52 | deadline, 53 | }]) 54 | ) 55 | calldatas.push( 56 | iface.encodeFunctionData('refundETH', []) 57 | ) 58 | 59 | const contract = new ethers.Contract('0xa9754f0D9055d14EB0D2d196E4C51d8B2Ee6f4d3', ['function multicall(bytes[]) payable'], signer) 60 | 61 | await task(async () => { 62 | const tx = await contract.multicall(calldatas, { 63 | ...await overrides(wallet.address), 64 | value: amount 65 | }); 66 | logGasCost(await tx.wait()) 67 | }, { 68 | taskName: 'izumi_swap', 69 | walletAddr: wallet.address, 70 | }) 71 | } 72 | 73 | export const addLimitOrder = async (wallet: ethers.Wallet) => { 74 | const signer = wallet.connect(provider); 75 | const routerContract = new ethers.Contract("0x1eE5eDC5Fe498a2dD82862746D674DB2a5e7fef6", limitOrderAbi, signer) 76 | const slot = await routerContract.getDeactiveSlot(signer.address); 77 | const calldatas = []; 78 | const amount = ethers.utils.parseEther('0.001'); 79 | const deadline = Math.floor(Date.now() / 1000) + 2000 * 60; 80 | calldatas.push( 81 | routerContract.interface.encodeFunctionData('newLimOrder', [ 82 | slot, 83 | { 84 | tokenX: '0x67A1f4A939b477A6b7c5BF94D97E45dE87E608eF', 85 | tokenY: '0x876508837C162aCedcc5dd7721015E83cbb4e339', 86 | fee: 2000, 87 | pt: 173520, 88 | amount, 89 | sellXEarnY: true, 90 | deadline, 91 | } 92 | ]) 93 | ) 94 | 95 | calldatas.push(routerContract.interface.encodeFunctionData('refundETH', [])); 96 | const contract = new ethers.Contract('0x1eE5eDC5Fe498a2dD82862746D674DB2a5e7fef6', ['function multicall(bytes[]) payable'], signer) 97 | 98 | await task(async () => { 99 | const tx = await contract.multicall(calldatas, { 100 | ...await overrides(wallet.address), 101 | value: amount 102 | }); 103 | logGasCost(await tx.wait()) 104 | }, { 105 | taskName: 'izumi_addLimitOrder', 106 | walletAddr: wallet.address, 107 | }) 108 | } 109 | 110 | export const addLq = async (wallet: ethers.Wallet) => { 111 | const signer = wallet.connect(provider); 112 | const iface = new ethers.utils.Interface(liquidityAbi); 113 | const calldatas = []; 114 | const amount = ethers.utils.parseEther('0.0001') 115 | const deadline = Math.floor(Date.now() / 1000) + 360 * 60 * 60 * 20; 116 | calldatas.push( 117 | iface.encodeFunctionData('mint', [{ 118 | tokenX: '0x67A1f4A939b477A6b7c5BF94D97E45dE87E608eF', 119 | tokenY: '0xf56dc6695cF1f5c364eDEbC7Dc7077ac9B586068', 120 | fee: 2000, 121 | pl: -39760, 122 | pr: -35440, 123 | xLim: amount, 124 | yLim: ethers.constants.Zero, 125 | amountXMin: ethers.constants.Zero, 126 | amountYMin: ethers.constants.Zero, 127 | deadline, 128 | miner: wallet.address 129 | }]) 130 | ) 131 | calldatas.push( 132 | iface.encodeFunctionData('refundETH', []) 133 | ) 134 | const contract = new ethers.Contract('0xC6C7c2edF70A3245ad6051E93809162B9758ce08', ['function multicall(bytes[]) payable'], signer) 135 | 136 | await task(async () => { 137 | const tx = await contract.multicall(calldatas, { 138 | ...await overrides(wallet.address), 139 | value: amount 140 | }); 141 | logGasCost(await tx.wait()) 142 | }, { 143 | taskName: 'izumi_addLq', 144 | walletAddr: wallet.address, 145 | }) 146 | } 147 | 148 | export const run = async (wallet: ethers.Wallet) => { 149 | await swap(wallet); 150 | await addLimitOrder(wallet); 151 | await addLq(wallet); 152 | } -------------------------------------------------------------------------------- /tasks/kyberswap/abi.ts: -------------------------------------------------------------------------------- 1 | export const poolAbi = [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "_deployer", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "_factory", 12 | "type": "address" 13 | }, 14 | { 15 | "internalType": "address", 16 | "name": "_WETH9", 17 | "type": "address" 18 | }, 19 | { 20 | "internalType": "address", 21 | "name": "_tokenDescriptor_", 22 | "type": "address" 23 | } 24 | ], 25 | "stateMutability": "nonpayable", 26 | "type": "constructor" 27 | }, 28 | { 29 | "anonymous": false, 30 | "inputs": [ 31 | { 32 | "indexed": true, 33 | "internalType": "address", 34 | "name": "owner", 35 | "type": "address" 36 | }, 37 | { 38 | "indexed": true, 39 | "internalType": "address", 40 | "name": "approved", 41 | "type": "address" 42 | }, 43 | { 44 | "indexed": true, 45 | "internalType": "uint256", 46 | "name": "tokenId", 47 | "type": "uint256" 48 | } 49 | ], 50 | "name": "Approval", 51 | "type": "event" 52 | }, 53 | { 54 | "anonymous": false, 55 | "inputs": [ 56 | { 57 | "indexed": true, 58 | "internalType": "address", 59 | "name": "owner", 60 | "type": "address" 61 | }, 62 | { 63 | "indexed": true, 64 | "internalType": "address", 65 | "name": "operator", 66 | "type": "address" 67 | }, 68 | { 69 | "indexed": false, 70 | "internalType": "bool", 71 | "name": "approved", 72 | "type": "bool" 73 | } 74 | ], 75 | "name": "ApprovalForAll", 76 | "type": "event" 77 | }, 78 | { 79 | "anonymous": false, 80 | "inputs": [ 81 | { 82 | "indexed": true, 83 | "internalType": "uint256", 84 | "name": "tokenId", 85 | "type": "uint256" 86 | }, 87 | { 88 | "indexed": false, 89 | "internalType": "address", 90 | "name": "recipient", 91 | "type": "address" 92 | }, 93 | { 94 | "indexed": false, 95 | "internalType": "uint256", 96 | "name": "amount0", 97 | "type": "uint256" 98 | }, 99 | { 100 | "indexed": false, 101 | "internalType": "uint256", 102 | "name": "amount1", 103 | "type": "uint256" 104 | } 105 | ], 106 | "name": "Collect", 107 | "type": "event" 108 | }, 109 | { 110 | "anonymous": false, 111 | "inputs": [ 112 | { 113 | "indexed": true, 114 | "internalType": "uint256", 115 | "name": "tokenId", 116 | "type": "uint256" 117 | }, 118 | { 119 | "indexed": false, 120 | "internalType": "uint128", 121 | "name": "liquidity", 122 | "type": "uint128" 123 | }, 124 | { 125 | "indexed": false, 126 | "internalType": "uint256", 127 | "name": "amount0", 128 | "type": "uint256" 129 | }, 130 | { 131 | "indexed": false, 132 | "internalType": "uint256", 133 | "name": "amount1", 134 | "type": "uint256" 135 | } 136 | ], 137 | "name": "DecreaseLiquidity", 138 | "type": "event" 139 | }, 140 | { 141 | "anonymous": false, 142 | "inputs": [ 143 | { 144 | "indexed": true, 145 | "internalType": "uint256", 146 | "name": "tokenId", 147 | "type": "uint256" 148 | }, 149 | { 150 | "indexed": false, 151 | "internalType": "uint128", 152 | "name": "liquidity", 153 | "type": "uint128" 154 | }, 155 | { 156 | "indexed": false, 157 | "internalType": "uint256", 158 | "name": "amount0", 159 | "type": "uint256" 160 | }, 161 | { 162 | "indexed": false, 163 | "internalType": "uint256", 164 | "name": "amount1", 165 | "type": "uint256" 166 | } 167 | ], 168 | "name": "IncreaseLiquidity", 169 | "type": "event" 170 | }, 171 | { 172 | "anonymous": false, 173 | "inputs": [ 174 | { 175 | "indexed": true, 176 | "internalType": "address", 177 | "name": "from", 178 | "type": "address" 179 | }, 180 | { 181 | "indexed": true, 182 | "internalType": "address", 183 | "name": "to", 184 | "type": "address" 185 | }, 186 | { 187 | "indexed": true, 188 | "internalType": "uint256", 189 | "name": "tokenId", 190 | "type": "uint256" 191 | } 192 | ], 193 | "name": "Transfer", 194 | "type": "event" 195 | }, 196 | { 197 | "inputs": [], 198 | "name": "DOMAIN_SEPARATOR", 199 | "outputs": [ 200 | { 201 | "internalType": "bytes32", 202 | "name": "", 203 | "type": "bytes32" 204 | } 205 | ], 206 | "stateMutability": "view", 207 | "type": "function" 208 | }, 209 | { 210 | "inputs": [], 211 | "name": "PERMIT_TYPEHASH", 212 | "outputs": [ 213 | { 214 | "internalType": "bytes32", 215 | "name": "", 216 | "type": "bytes32" 217 | } 218 | ], 219 | "stateMutability": "view", 220 | "type": "function" 221 | }, 222 | { 223 | "inputs": [], 224 | "name": "WETH9", 225 | "outputs": [ 226 | { 227 | "internalType": "address", 228 | "name": "", 229 | "type": "address" 230 | } 231 | ], 232 | "stateMutability": "view", 233 | "type": "function" 234 | }, 235 | { 236 | "inputs": [ 237 | { 238 | "internalType": "address", 239 | "name": "to", 240 | "type": "address" 241 | }, 242 | { 243 | "internalType": "uint256", 244 | "name": "tokenId", 245 | "type": "uint256" 246 | } 247 | ], 248 | "name": "approve", 249 | "outputs": [], 250 | "stateMutability": "nonpayable", 251 | "type": "function" 252 | }, 253 | { 254 | "inputs": [ 255 | { 256 | "internalType": "address", 257 | "name": "owner", 258 | "type": "address" 259 | } 260 | ], 261 | "name": "balanceOf", 262 | "outputs": [ 263 | { 264 | "internalType": "uint256", 265 | "name": "", 266 | "type": "uint256" 267 | } 268 | ], 269 | "stateMutability": "view", 270 | "type": "function" 271 | }, 272 | { 273 | "inputs": [], 274 | "name": "baseURI", 275 | "outputs": [ 276 | { 277 | "internalType": "string", 278 | "name": "", 279 | "type": "string" 280 | } 281 | ], 282 | "stateMutability": "pure", 283 | "type": "function" 284 | }, 285 | { 286 | "inputs": [ 287 | { 288 | "internalType": "uint256", 289 | "name": "tokenId", 290 | "type": "uint256" 291 | } 292 | ], 293 | "name": "burn", 294 | "outputs": [], 295 | "stateMutability": "payable", 296 | "type": "function" 297 | }, 298 | { 299 | "inputs": [ 300 | { 301 | "components": [ 302 | { 303 | "internalType": "uint256", 304 | "name": "tokenId", 305 | "type": "uint256" 306 | }, 307 | { 308 | "internalType": "address", 309 | "name": "recipient", 310 | "type": "address" 311 | }, 312 | { 313 | "internalType": "uint128", 314 | "name": "amount0Max", 315 | "type": "uint128" 316 | }, 317 | { 318 | "internalType": "uint128", 319 | "name": "amount1Max", 320 | "type": "uint128" 321 | } 322 | ], 323 | "internalType": "struct INonfungiblePositionManager.CollectParams", 324 | "name": "params", 325 | "type": "tuple" 326 | } 327 | ], 328 | "name": "collect", 329 | "outputs": [ 330 | { 331 | "internalType": "uint256", 332 | "name": "amount0", 333 | "type": "uint256" 334 | }, 335 | { 336 | "internalType": "uint256", 337 | "name": "amount1", 338 | "type": "uint256" 339 | } 340 | ], 341 | "stateMutability": "payable", 342 | "type": "function" 343 | }, 344 | { 345 | "inputs": [ 346 | { 347 | "internalType": "address", 348 | "name": "token0", 349 | "type": "address" 350 | }, 351 | { 352 | "internalType": "address", 353 | "name": "token1", 354 | "type": "address" 355 | }, 356 | { 357 | "internalType": "uint24", 358 | "name": "fee", 359 | "type": "uint24" 360 | }, 361 | { 362 | "internalType": "uint160", 363 | "name": "sqrtPriceX96", 364 | "type": "uint160" 365 | } 366 | ], 367 | "name": "createAndInitializePoolIfNecessary", 368 | "outputs": [ 369 | { 370 | "internalType": "address", 371 | "name": "pool", 372 | "type": "address" 373 | } 374 | ], 375 | "stateMutability": "payable", 376 | "type": "function" 377 | }, 378 | { 379 | "inputs": [ 380 | { 381 | "components": [ 382 | { 383 | "internalType": "uint256", 384 | "name": "tokenId", 385 | "type": "uint256" 386 | }, 387 | { 388 | "internalType": "uint128", 389 | "name": "liquidity", 390 | "type": "uint128" 391 | }, 392 | { 393 | "internalType": "uint256", 394 | "name": "amount0Min", 395 | "type": "uint256" 396 | }, 397 | { 398 | "internalType": "uint256", 399 | "name": "amount1Min", 400 | "type": "uint256" 401 | }, 402 | { 403 | "internalType": "uint256", 404 | "name": "deadline", 405 | "type": "uint256" 406 | } 407 | ], 408 | "internalType": "struct INonfungiblePositionManager.DecreaseLiquidityParams", 409 | "name": "params", 410 | "type": "tuple" 411 | } 412 | ], 413 | "name": "decreaseLiquidity", 414 | "outputs": [ 415 | { 416 | "internalType": "uint256", 417 | "name": "amount0", 418 | "type": "uint256" 419 | }, 420 | { 421 | "internalType": "uint256", 422 | "name": "amount1", 423 | "type": "uint256" 424 | } 425 | ], 426 | "stateMutability": "payable", 427 | "type": "function" 428 | }, 429 | { 430 | "inputs": [], 431 | "name": "deployer", 432 | "outputs": [ 433 | { 434 | "internalType": "address", 435 | "name": "", 436 | "type": "address" 437 | } 438 | ], 439 | "stateMutability": "view", 440 | "type": "function" 441 | }, 442 | { 443 | "inputs": [], 444 | "name": "factory", 445 | "outputs": [ 446 | { 447 | "internalType": "address", 448 | "name": "", 449 | "type": "address" 450 | } 451 | ], 452 | "stateMutability": "view", 453 | "type": "function" 454 | }, 455 | { 456 | "inputs": [ 457 | { 458 | "internalType": "uint256", 459 | "name": "tokenId", 460 | "type": "uint256" 461 | } 462 | ], 463 | "name": "getApproved", 464 | "outputs": [ 465 | { 466 | "internalType": "address", 467 | "name": "", 468 | "type": "address" 469 | } 470 | ], 471 | "stateMutability": "view", 472 | "type": "function" 473 | }, 474 | { 475 | "inputs": [ 476 | { 477 | "components": [ 478 | { 479 | "internalType": "uint256", 480 | "name": "tokenId", 481 | "type": "uint256" 482 | }, 483 | { 484 | "internalType": "uint256", 485 | "name": "amount0Desired", 486 | "type": "uint256" 487 | }, 488 | { 489 | "internalType": "uint256", 490 | "name": "amount1Desired", 491 | "type": "uint256" 492 | }, 493 | { 494 | "internalType": "uint256", 495 | "name": "amount0Min", 496 | "type": "uint256" 497 | }, 498 | { 499 | "internalType": "uint256", 500 | "name": "amount1Min", 501 | "type": "uint256" 502 | }, 503 | { 504 | "internalType": "uint256", 505 | "name": "deadline", 506 | "type": "uint256" 507 | } 508 | ], 509 | "internalType": "struct INonfungiblePositionManager.IncreaseLiquidityParams", 510 | "name": "params", 511 | "type": "tuple" 512 | } 513 | ], 514 | "name": "increaseLiquidity", 515 | "outputs": [ 516 | { 517 | "internalType": "uint128", 518 | "name": "liquidity", 519 | "type": "uint128" 520 | }, 521 | { 522 | "internalType": "uint256", 523 | "name": "amount0", 524 | "type": "uint256" 525 | }, 526 | { 527 | "internalType": "uint256", 528 | "name": "amount1", 529 | "type": "uint256" 530 | } 531 | ], 532 | "stateMutability": "payable", 533 | "type": "function" 534 | }, 535 | { 536 | "inputs": [ 537 | { 538 | "internalType": "address", 539 | "name": "owner", 540 | "type": "address" 541 | }, 542 | { 543 | "internalType": "address", 544 | "name": "operator", 545 | "type": "address" 546 | } 547 | ], 548 | "name": "isApprovedForAll", 549 | "outputs": [ 550 | { 551 | "internalType": "bool", 552 | "name": "", 553 | "type": "bool" 554 | } 555 | ], 556 | "stateMutability": "view", 557 | "type": "function" 558 | }, 559 | { 560 | "inputs": [{ 561 | components: [{ 562 | internalType: "address", 563 | name: "token0", 564 | type: "address" 565 | }, { 566 | internalType: "address", 567 | name: "token1", 568 | type: "address" 569 | }, { 570 | internalType: "uint24", 571 | name: "fee", 572 | type: "uint24" 573 | }, { 574 | internalType: "int24", 575 | name: "tickLower", 576 | type: "int24" 577 | }, { 578 | internalType: "int24", 579 | name: "tickUpper", 580 | type: "int24" 581 | }, { 582 | internalType: "int24[2]", 583 | name: "ticksPrevious", 584 | type: "int24[2]" 585 | }, { 586 | internalType: "uint256", 587 | name: "amount0Desired", 588 | type: "uint256" 589 | }, { 590 | internalType: "uint256", 591 | name: "amount1Desired", 592 | type: "uint256" 593 | }, { 594 | internalType: "uint256", 595 | name: "amount0Min", 596 | type: "uint256" 597 | }, { 598 | internalType: "uint256", 599 | name: "amount1Min", 600 | type: "uint256" 601 | }, { 602 | internalType: "address", 603 | name: "recipient", 604 | type: "address" 605 | }, { 606 | internalType: "uint256", 607 | name: "deadline", 608 | type: "uint256" 609 | }], 610 | internalType: "struct IBasePositionManager.MintParams", 611 | name: "params", 612 | type: "tuple" 613 | }], 614 | "name": "mint", 615 | "outputs": [ 616 | { 617 | "internalType": "uint256", 618 | "name": "tokenId", 619 | "type": "uint256" 620 | }, 621 | { 622 | "internalType": "uint128", 623 | "name": "liquidity", 624 | "type": "uint128" 625 | }, 626 | { 627 | "internalType": "uint256", 628 | "name": "amount0", 629 | "type": "uint256" 630 | }, 631 | { 632 | "internalType": "uint256", 633 | "name": "amount1", 634 | "type": "uint256" 635 | } 636 | ], 637 | "stateMutability": "payable", 638 | "type": "function" 639 | }, 640 | { 641 | "inputs": [ 642 | { 643 | "internalType": "bytes[]", 644 | "name": "data", 645 | "type": "bytes[]" 646 | } 647 | ], 648 | "name": "multicall", 649 | "outputs": [ 650 | { 651 | "internalType": "bytes[]", 652 | "name": "results", 653 | "type": "bytes[]" 654 | } 655 | ], 656 | "stateMutability": "payable", 657 | "type": "function" 658 | }, 659 | { 660 | "inputs": [], 661 | "name": "name", 662 | "outputs": [ 663 | { 664 | "internalType": "string", 665 | "name": "", 666 | "type": "string" 667 | } 668 | ], 669 | "stateMutability": "view", 670 | "type": "function" 671 | }, 672 | { 673 | "inputs": [ 674 | { 675 | "internalType": "uint256", 676 | "name": "tokenId", 677 | "type": "uint256" 678 | } 679 | ], 680 | "name": "ownerOf", 681 | "outputs": [ 682 | { 683 | "internalType": "address", 684 | "name": "", 685 | "type": "address" 686 | } 687 | ], 688 | "stateMutability": "view", 689 | "type": "function" 690 | }, 691 | { 692 | "inputs": [ 693 | { 694 | "internalType": "uint256", 695 | "name": "amount0Owed", 696 | "type": "uint256" 697 | }, 698 | { 699 | "internalType": "uint256", 700 | "name": "amount1Owed", 701 | "type": "uint256" 702 | }, 703 | { 704 | "internalType": "bytes", 705 | "name": "data", 706 | "type": "bytes" 707 | } 708 | ], 709 | "name": "pancakeV3MintCallback", 710 | "outputs": [], 711 | "stateMutability": "nonpayable", 712 | "type": "function" 713 | }, 714 | { 715 | "inputs": [ 716 | { 717 | "internalType": "address", 718 | "name": "spender", 719 | "type": "address" 720 | }, 721 | { 722 | "internalType": "uint256", 723 | "name": "tokenId", 724 | "type": "uint256" 725 | }, 726 | { 727 | "internalType": "uint256", 728 | "name": "deadline", 729 | "type": "uint256" 730 | }, 731 | { 732 | "internalType": "uint8", 733 | "name": "v", 734 | "type": "uint8" 735 | }, 736 | { 737 | "internalType": "bytes32", 738 | "name": "r", 739 | "type": "bytes32" 740 | }, 741 | { 742 | "internalType": "bytes32", 743 | "name": "s", 744 | "type": "bytes32" 745 | } 746 | ], 747 | "name": "permit", 748 | "outputs": [], 749 | "stateMutability": "payable", 750 | "type": "function" 751 | }, 752 | { 753 | "inputs": [ 754 | { 755 | "internalType": "uint256", 756 | "name": "tokenId", 757 | "type": "uint256" 758 | } 759 | ], 760 | "name": "positions", 761 | "outputs": [ 762 | { 763 | "internalType": "uint96", 764 | "name": "nonce", 765 | "type": "uint96" 766 | }, 767 | { 768 | "internalType": "address", 769 | "name": "operator", 770 | "type": "address" 771 | }, 772 | { 773 | "internalType": "address", 774 | "name": "token0", 775 | "type": "address" 776 | }, 777 | { 778 | "internalType": "address", 779 | "name": "token1", 780 | "type": "address" 781 | }, 782 | { 783 | "internalType": "uint24", 784 | "name": "fee", 785 | "type": "uint24" 786 | }, 787 | { 788 | "internalType": "int24", 789 | "name": "tickLower", 790 | "type": "int24" 791 | }, 792 | { 793 | "internalType": "int24", 794 | "name": "tickUpper", 795 | "type": "int24" 796 | }, 797 | { 798 | "internalType": "uint128", 799 | "name": "liquidity", 800 | "type": "uint128" 801 | }, 802 | { 803 | "internalType": "uint256", 804 | "name": "feeGrowthInside0LastX128", 805 | "type": "uint256" 806 | }, 807 | { 808 | "internalType": "uint256", 809 | "name": "feeGrowthInside1LastX128", 810 | "type": "uint256" 811 | }, 812 | { 813 | "internalType": "uint128", 814 | "name": "tokensOwed0", 815 | "type": "uint128" 816 | }, 817 | { 818 | "internalType": "uint128", 819 | "name": "tokensOwed1", 820 | "type": "uint128" 821 | } 822 | ], 823 | "stateMutability": "view", 824 | "type": "function" 825 | }, 826 | { 827 | "inputs": [], 828 | "name": "refundETH", 829 | "outputs": [], 830 | "stateMutability": "payable", 831 | "type": "function" 832 | }, 833 | { 834 | "inputs": [ 835 | { 836 | "internalType": "address", 837 | "name": "from", 838 | "type": "address" 839 | }, 840 | { 841 | "internalType": "address", 842 | "name": "to", 843 | "type": "address" 844 | }, 845 | { 846 | "internalType": "uint256", 847 | "name": "tokenId", 848 | "type": "uint256" 849 | } 850 | ], 851 | "name": "safeTransferFrom", 852 | "outputs": [], 853 | "stateMutability": "nonpayable", 854 | "type": "function" 855 | }, 856 | { 857 | "inputs": [ 858 | { 859 | "internalType": "address", 860 | "name": "from", 861 | "type": "address" 862 | }, 863 | { 864 | "internalType": "address", 865 | "name": "to", 866 | "type": "address" 867 | }, 868 | { 869 | "internalType": "uint256", 870 | "name": "tokenId", 871 | "type": "uint256" 872 | }, 873 | { 874 | "internalType": "bytes", 875 | "name": "_data", 876 | "type": "bytes" 877 | } 878 | ], 879 | "name": "safeTransferFrom", 880 | "outputs": [], 881 | "stateMutability": "nonpayable", 882 | "type": "function" 883 | }, 884 | { 885 | "inputs": [ 886 | { 887 | "internalType": "address", 888 | "name": "token", 889 | "type": "address" 890 | }, 891 | { 892 | "internalType": "uint256", 893 | "name": "value", 894 | "type": "uint256" 895 | }, 896 | { 897 | "internalType": "uint256", 898 | "name": "deadline", 899 | "type": "uint256" 900 | }, 901 | { 902 | "internalType": "uint8", 903 | "name": "v", 904 | "type": "uint8" 905 | }, 906 | { 907 | "internalType": "bytes32", 908 | "name": "r", 909 | "type": "bytes32" 910 | }, 911 | { 912 | "internalType": "bytes32", 913 | "name": "s", 914 | "type": "bytes32" 915 | } 916 | ], 917 | "name": "selfPermit", 918 | "outputs": [], 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": "selfPermitAllowed", 956 | "outputs": [], 957 | "stateMutability": "payable", 958 | "type": "function" 959 | }, 960 | { 961 | "inputs": [ 962 | { 963 | "internalType": "address", 964 | "name": "token", 965 | "type": "address" 966 | }, 967 | { 968 | "internalType": "uint256", 969 | "name": "nonce", 970 | "type": "uint256" 971 | }, 972 | { 973 | "internalType": "uint256", 974 | "name": "expiry", 975 | "type": "uint256" 976 | }, 977 | { 978 | "internalType": "uint8", 979 | "name": "v", 980 | "type": "uint8" 981 | }, 982 | { 983 | "internalType": "bytes32", 984 | "name": "r", 985 | "type": "bytes32" 986 | }, 987 | { 988 | "internalType": "bytes32", 989 | "name": "s", 990 | "type": "bytes32" 991 | } 992 | ], 993 | "name": "selfPermitAllowedIfNecessary", 994 | "outputs": [], 995 | "stateMutability": "payable", 996 | "type": "function" 997 | }, 998 | { 999 | "inputs": [ 1000 | { 1001 | "internalType": "address", 1002 | "name": "token", 1003 | "type": "address" 1004 | }, 1005 | { 1006 | "internalType": "uint256", 1007 | "name": "value", 1008 | "type": "uint256" 1009 | }, 1010 | { 1011 | "internalType": "uint256", 1012 | "name": "deadline", 1013 | "type": "uint256" 1014 | }, 1015 | { 1016 | "internalType": "uint8", 1017 | "name": "v", 1018 | "type": "uint8" 1019 | }, 1020 | { 1021 | "internalType": "bytes32", 1022 | "name": "r", 1023 | "type": "bytes32" 1024 | }, 1025 | { 1026 | "internalType": "bytes32", 1027 | "name": "s", 1028 | "type": "bytes32" 1029 | } 1030 | ], 1031 | "name": "selfPermitIfNecessary", 1032 | "outputs": [], 1033 | "stateMutability": "payable", 1034 | "type": "function" 1035 | }, 1036 | { 1037 | "inputs": [ 1038 | { 1039 | "internalType": "address", 1040 | "name": "operator", 1041 | "type": "address" 1042 | }, 1043 | { 1044 | "internalType": "bool", 1045 | "name": "approved", 1046 | "type": "bool" 1047 | } 1048 | ], 1049 | "name": "setApprovalForAll", 1050 | "outputs": [], 1051 | "stateMutability": "nonpayable", 1052 | "type": "function" 1053 | }, 1054 | { 1055 | "inputs": [ 1056 | { 1057 | "internalType": "bytes4", 1058 | "name": "interfaceId", 1059 | "type": "bytes4" 1060 | } 1061 | ], 1062 | "name": "supportsInterface", 1063 | "outputs": [ 1064 | { 1065 | "internalType": "bool", 1066 | "name": "", 1067 | "type": "bool" 1068 | } 1069 | ], 1070 | "stateMutability": "view", 1071 | "type": "function" 1072 | }, 1073 | { 1074 | "inputs": [ 1075 | { 1076 | "internalType": "address", 1077 | "name": "token", 1078 | "type": "address" 1079 | }, 1080 | { 1081 | "internalType": "uint256", 1082 | "name": "amountMinimum", 1083 | "type": "uint256" 1084 | }, 1085 | { 1086 | "internalType": "address", 1087 | "name": "recipient", 1088 | "type": "address" 1089 | } 1090 | ], 1091 | "name": "sweepToken", 1092 | "outputs": [], 1093 | "stateMutability": "payable", 1094 | "type": "function" 1095 | }, 1096 | { 1097 | "inputs": [], 1098 | "name": "symbol", 1099 | "outputs": [ 1100 | { 1101 | "internalType": "string", 1102 | "name": "", 1103 | "type": "string" 1104 | } 1105 | ], 1106 | "stateMutability": "view", 1107 | "type": "function" 1108 | }, 1109 | { 1110 | "inputs": [ 1111 | { 1112 | "internalType": "uint256", 1113 | "name": "index", 1114 | "type": "uint256" 1115 | } 1116 | ], 1117 | "name": "tokenByIndex", 1118 | "outputs": [ 1119 | { 1120 | "internalType": "uint256", 1121 | "name": "", 1122 | "type": "uint256" 1123 | } 1124 | ], 1125 | "stateMutability": "view", 1126 | "type": "function" 1127 | }, 1128 | { 1129 | "inputs": [ 1130 | { 1131 | "internalType": "address", 1132 | "name": "owner", 1133 | "type": "address" 1134 | }, 1135 | { 1136 | "internalType": "uint256", 1137 | "name": "index", 1138 | "type": "uint256" 1139 | } 1140 | ], 1141 | "name": "tokenOfOwnerByIndex", 1142 | "outputs": [ 1143 | { 1144 | "internalType": "uint256", 1145 | "name": "", 1146 | "type": "uint256" 1147 | } 1148 | ], 1149 | "stateMutability": "view", 1150 | "type": "function" 1151 | }, 1152 | { 1153 | "inputs": [ 1154 | { 1155 | "internalType": "uint256", 1156 | "name": "tokenId", 1157 | "type": "uint256" 1158 | } 1159 | ], 1160 | "name": "tokenURI", 1161 | "outputs": [ 1162 | { 1163 | "internalType": "string", 1164 | "name": "", 1165 | "type": "string" 1166 | } 1167 | ], 1168 | "stateMutability": "view", 1169 | "type": "function" 1170 | }, 1171 | { 1172 | "inputs": [], 1173 | "name": "totalSupply", 1174 | "outputs": [ 1175 | { 1176 | "internalType": "uint256", 1177 | "name": "", 1178 | "type": "uint256" 1179 | } 1180 | ], 1181 | "stateMutability": "view", 1182 | "type": "function" 1183 | }, 1184 | { 1185 | "inputs": [ 1186 | { 1187 | "internalType": "address", 1188 | "name": "from", 1189 | "type": "address" 1190 | }, 1191 | { 1192 | "internalType": "address", 1193 | "name": "to", 1194 | "type": "address" 1195 | }, 1196 | { 1197 | "internalType": "uint256", 1198 | "name": "tokenId", 1199 | "type": "uint256" 1200 | } 1201 | ], 1202 | "name": "transferFrom", 1203 | "outputs": [], 1204 | "stateMutability": "nonpayable", 1205 | "type": "function" 1206 | }, 1207 | { 1208 | "inputs": [ 1209 | { 1210 | "internalType": "uint256", 1211 | "name": "amountMinimum", 1212 | "type": "uint256" 1213 | }, 1214 | { 1215 | "internalType": "address", 1216 | "name": "recipient", 1217 | "type": "address" 1218 | } 1219 | ], 1220 | "name": "unwrapWETH9", 1221 | "outputs": [], 1222 | "stateMutability": "payable", 1223 | "type": "function" 1224 | }, 1225 | { 1226 | "stateMutability": "payable", 1227 | "type": "receive" 1228 | } 1229 | ] -------------------------------------------------------------------------------- /tasks/kyberswap/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { poolAbi } from './abi'; 3 | import { lineaProvider as provider, overrides, logGasCost } from '../base' 4 | import axios from 'axios'; 5 | import { loop, task } from '@/utils/utils'; 6 | 7 | export const swap = async (wallet: ethers.Wallet) => { 8 | const signer = wallet.connect(provider); 9 | const deadline = Math.floor(Date.now() / 1000) + 60 * 20; 10 | const value = ethers.utils.parseEther('0.001'); 11 | 12 | await task(async () => { 13 | let res: any; 14 | await loop(async () => { 15 | res = await axios.get('https://meta-aggregator-api.kyberswap.com/linea-goerli/api/v1/routes', { 16 | params: { 17 | tokenIn: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', 18 | tokenOut: '0xf56dc6695cF1f5c364eDEbC7Dc7077ac9B586068', 19 | amountIn: value.toString(), 20 | saveGas: false, 21 | gasInclude: false 22 | } 23 | }) 24 | res = await axios.post('https://meta-aggregator-api.kyberswap.com/linea-goerli/api/v1/route/build', { 25 | deadline, 26 | recipient: wallet.address, 27 | routeSummary: res.data.data.routeSummary, 28 | sender: wallet.address, 29 | skipSimulateTx: false, 30 | slippageTolerance: 1999, 31 | source: "kyberswap" 32 | }) 33 | }) 34 | const tx = await signer.sendTransaction({ 35 | to: res.data.data.routerAddress, 36 | data: res.data.data.data, 37 | value, 38 | ...await overrides(wallet.address), 39 | }) 40 | logGasCost(await tx.wait()) 41 | }, { 42 | taskName: 'kyberswap_swap', 43 | walletAddr: wallet.address, 44 | }) 45 | } 46 | 47 | export const addLq = async (wallet: ethers.Wallet) => { 48 | const signer = wallet.connect(provider); 49 | const value = ethers.utils.parseEther('0.0001'); 50 | const deadline = Math.floor(Date.now() / 1000) + 2000 * 60; 51 | const calldatas = []; 52 | const iface = new ethers.utils.Interface(poolAbi); 53 | calldatas.push( 54 | iface.encodeFunctionData('mint', [{ 55 | token0: '0x2C1b868d6596a18e32E61B901E4060C872647b6C', 56 | token1: '0xf56dc6695cF1f5c364eDEbC7Dc7077ac9B586068', 57 | fee: 300, 58 | tickLower: -145680, 59 | tickUpper: -145500, 60 | ticksPrevious: [-145740, -145560], 61 | amount0Desired: value, 62 | amount1Desired: ethers.constants.Zero, 63 | amount0Min: ethers.constants.Zero, 64 | amount1Min: ethers.constants.Zero, 65 | recipient: wallet.address, 66 | deadline 67 | }]) 68 | ) 69 | calldatas.push( 70 | '0x1faa4133' 71 | ) 72 | const contract = new ethers.Contract('0x50C11d49a6c4e95e49A6D96FbCE8ee208921Bb47', ['function multicall (bytes[]) payable'], signer); 73 | await task(async () => { 74 | const tx = await contract.multicall(calldatas, 75 | { 76 | ...await overrides(wallet.address), 77 | value 78 | } 79 | ); 80 | logGasCost(await tx.wait()) 81 | 82 | }, { 83 | taskName: 'kyberswap_addLq', 84 | walletAddr: wallet.address, 85 | }) 86 | } 87 | 88 | export const run = async (wallet: ethers.Wallet) => { 89 | await swap(wallet); 90 | await addLq(wallet); 91 | } -------------------------------------------------------------------------------- /tasks/mendi/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides, approveErc20, logGasCost } from '../base' 3 | import { task } from '@/utils/utils'; 4 | 5 | export const supply = async (wallet: ethers.Wallet) => { 6 | const signer = wallet.connect(provider); 7 | const ca = '0x4E4e3EbB5d55787885a871F3D9b23638A68E3681'; 8 | const abi = ['function mint(uint256)'] 9 | const contract = new ethers.Contract(ca, abi, signer); 10 | 11 | 12 | await task(async () => { 13 | // 抵押1usdc 14 | const amount = ethers.utils.parseUnits('1', 6); 15 | const usdc = await approveErc20( 16 | signer, 17 | '0xf56dc6695cf1f5c364edebc7dc7077ac9b586068', 18 | ca 19 | ) 20 | const usdcBalance = await usdc.balanceOf(wallet.address); 21 | if (usdcBalance.lt(amount)) { 22 | throw new Error('USDC 余额不足') 23 | } 24 | const tx = await contract.mint(amount, await overrides(wallet.address)); 25 | logGasCost(await tx.wait()) 26 | }, { 27 | taskName: 'mendi_supply', 28 | walletAddr: wallet.address, 29 | }) 30 | } 31 | 32 | export const borrow = async (wallet: ethers.Wallet) => { 33 | const signer = wallet.connect(provider); 34 | const usdcSupplyAddr = '0x4E4e3EbB5d55787885a871F3D9b23638A68E3681' 35 | let ca = '0x48B9A979aEd1452Df792193Fd6E676605ab324D7'; 36 | let abi = [ 37 | 'function enterMarkets(address[])', 38 | 'function borrowAllowed(address, address, uint256) view returns (uint256)' 39 | ] 40 | let contract = new ethers.Contract(ca, abi, signer); 41 | await task(async () => { 42 | try { 43 | await contract.borrowAllowed(usdcSupplyAddr, wallet.address, ethers.utils.parseUnits('0.01', 6)) 44 | } catch (error) { 45 | const tx = await contract.enterMarkets([usdcSupplyAddr], await overrides(wallet.address)); 46 | logGasCost(await tx.wait()) 47 | } 48 | }, { 49 | taskName: 'mendi_enterMarkets', 50 | walletAddr: wallet.address, 51 | }) 52 | 53 | // 借出usdt 54 | ca = '0x3ED88159612B029a21174250A9DC03366b1119Ae' 55 | abi = ['function borrow(uint256)'] 56 | contract = new ethers.Contract(ca, abi, signer); 57 | await task(async () => { 58 | const tx = await contract.borrow(1000, await overrides(wallet.address)); 59 | logGasCost(await tx.wait()) 60 | }, { 61 | taskName: 'mendi_borrow', 62 | walletAddr: wallet.address, 63 | }) 64 | } 65 | 66 | export const run = async (wallet: ethers.Wallet) => { 67 | await supply(wallet); 68 | await borrow(wallet); 69 | } -------------------------------------------------------------------------------- /tasks/mes/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides } from '../base' 3 | import { task } from '@/utils/utils'; 4 | import websocket from 'websocket'; 5 | 6 | const domain = { 7 | "name": "MES", 8 | "version": "1.0", 9 | "chainId": "59140" 10 | } 11 | 12 | const withdrawTypes = { 13 | "WithdrawRequest": [ 14 | { 15 | "name": "route", 16 | "type": "string" 17 | }, 18 | { 19 | "name": "userAddress", 20 | "type": "address" 21 | }, 22 | { 23 | "name": "symbol", 24 | "type": "string" 25 | }, 26 | { 27 | "name": "destinationChainId", 28 | "type": "string" 29 | }, 30 | { 31 | "name": "withdrawAmount", 32 | "type": "string" 33 | } 34 | ] 35 | } 36 | 37 | const depositTypes = { 38 | "DepositRequest": [ 39 | { 40 | "name": "userAddress", 41 | "type": "address" 42 | }, 43 | { 44 | "name": "symbol", 45 | "type": "string" 46 | }, 47 | { 48 | "name": "originatingChainId", 49 | "type": "string" 50 | }, 51 | { 52 | "name": "depositAmount", 53 | "type": "string" 54 | } 55 | ] 56 | } 57 | 58 | const genWss = async (type: string, message: string) => { 59 | await new Promise((resolve, reject) => { 60 | const ws = new websocket.client() 61 | 62 | ws.connect('wss://backend.mesprotocol.com/socket.io/?EIO=4&transport=websocket', 'echo-protocol'); 63 | 64 | ws.on('connect', connection => { 65 | // connection.on('message', function (message) { 66 | // if (message.type === 'utf8') { 67 | // if (type === 'deposit' && message.utf8Data.includes('depositMined')) { 68 | // connection.close(); 69 | // resolve(true); 70 | // } 71 | // } 72 | // }); 73 | 74 | if (connection.connected) { 75 | connection.send('40'); 76 | connection.send(message); 77 | setTimeout(() => resolve(true)) 78 | } 79 | }) 80 | }) 81 | } 82 | 83 | export const run = async (wallet: ethers.Wallet) => { 84 | const signer = wallet.connect(provider); 85 | const ca = '0x8f3Ddd0FBf3e78CA1D6cd17379eD88E261249B52' 86 | let abi = [ 87 | 'function deposit(address, uint256) payable', 88 | 'function withdraw(address, uint256)', 89 | ]; 90 | const contract = new ethers.Contract(ca, abi, signer); 91 | 92 | await task(async () => { 93 | let amount = '0.01'; 94 | const amountParsed = ethers.utils.parseEther(amount); 95 | const tx = await contract.deposit( 96 | ethers.constants.AddressZero, 97 | amountParsed, 98 | { 99 | ...await overrides(wallet.address), 100 | value: amountParsed 101 | } 102 | ) 103 | await tx.wait(); 104 | const values = { 105 | "userAddress": wallet.address, 106 | "symbol": "ETH", 107 | "originatingChainId": "59140", 108 | "depositAmount": amount, 109 | } 110 | const signature = await wallet._signTypedData(domain, depositTypes, values); 111 | const sendMessage = `42${JSON.stringify(["message", `{\"op\":\"createDepositRequest\",\"args\":[{\"userAddress\":\"${wallet.address}\",\"symbol\":\"ETH\",\"originatingChainId\":\"59140\",\"depositAmount\":\"${amount}\",\"transactionHash\":\"\",\"signature\":\"${signature}\"}]}`])}` 112 | await genWss('deposit', sendMessage); 113 | }, { 114 | taskName: 'mes_deposit', 115 | walletAddr: wallet.address, 116 | }) 117 | 118 | // 提现需要上面deposit到账后才能成功,deposit到账需要很长时间 119 | // https://testnet.mesprotocol.com/transfers 120 | await task(async () => { 121 | const amount = '0.001'; 122 | const amountParsed = ethers.utils.parseEther(amount); 123 | const tx = await contract.withdraw( 124 | ethers.constants.AddressZero, 125 | amountParsed, 126 | { 127 | ...await overrides(wallet.address), 128 | } 129 | ) 130 | await tx.wait(); 131 | const values = { "route": "Single", "userAddress": wallet.address, "symbol": "ETH", "destinationChainId": "59140", "withdrawAmount": amount } 132 | const signature = await wallet._signTypedData(domain, withdrawTypes, values); 133 | const sendMessage = `42${JSON.stringify(["message", 134 | { 135 | "op": "createSingleWithdrawRequest", 136 | "args": [ 137 | { 138 | "userAddress": wallet.address, 139 | "symbol": "ETH", 140 | "destinationChainId": "59140", 141 | "withdrawAmount": amount, 142 | "signature": signature 143 | } 144 | ] 145 | }])}` 146 | await genWss('withdraw', sendMessage); 147 | }, { 148 | taskName: 'mes_withdraw', 149 | walletAddr: wallet.address, 150 | }) 151 | } 152 | 153 | -------------------------------------------------------------------------------- /tasks/noobysswap/abi.ts: -------------------------------------------------------------------------------- 1 | export const swapAbi = [ 2 | { 3 | inputs: [ 4 | { internalType: 'address', name: '_factory', type: 'address' }, 5 | { internalType: 'address', name: '_WETH', type: 'address' }, 6 | ], 7 | stateMutability: 'nonpayable', 8 | type: 'constructor', 9 | }, 10 | { 11 | inputs: [], 12 | name: 'WETH', 13 | outputs: [{ internalType: 'address', name: '', type: 'address' }], 14 | stateMutability: 'view', 15 | type: 'function', 16 | }, 17 | { 18 | inputs: [ 19 | { internalType: 'address', name: 'tokenA', type: 'address' }, 20 | { internalType: 'address', name: 'tokenB', type: 'address' }, 21 | { internalType: 'uint256', name: 'amountADesired', type: 'uint256' }, 22 | { internalType: 'uint256', name: 'amountBDesired', type: 'uint256' }, 23 | { internalType: 'uint256', name: 'amountAMin', type: 'uint256' }, 24 | { internalType: 'uint256', name: 'amountBMin', type: 'uint256' }, 25 | { internalType: 'address', name: 'to', type: 'address' }, 26 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 27 | ], 28 | name: 'addLiquidity', 29 | outputs: [ 30 | { internalType: 'uint256', name: 'amountA', type: 'uint256' }, 31 | { internalType: 'uint256', name: 'amountB', type: 'uint256' }, 32 | { internalType: 'uint256', name: 'liquidity', type: 'uint256' }, 33 | ], 34 | stateMutability: 'nonpayable', 35 | type: 'function', 36 | }, 37 | { 38 | inputs: [ 39 | { internalType: 'address', name: 'token', type: 'address' }, 40 | { internalType: 'uint256', name: 'amountTokenDesired', type: 'uint256' }, 41 | { internalType: 'uint256', name: 'amountTokenMin', type: 'uint256' }, 42 | { internalType: 'uint256', name: 'amountETHMin', type: 'uint256' }, 43 | { internalType: 'address', name: 'to', type: 'address' }, 44 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 45 | ], 46 | name: 'addLiquidityETH', 47 | outputs: [ 48 | { internalType: 'uint256', name: 'amountToken', type: 'uint256' }, 49 | { internalType: 'uint256', name: 'amountETH', type: 'uint256' }, 50 | { internalType: 'uint256', name: 'liquidity', type: 'uint256' }, 51 | ], 52 | stateMutability: 'payable', 53 | type: 'function', 54 | }, 55 | { 56 | inputs: [], 57 | name: 'factory', 58 | outputs: [{ internalType: 'address', name: '', type: 'address' }], 59 | stateMutability: 'view', 60 | type: 'function', 61 | }, 62 | { 63 | inputs: [ 64 | { internalType: 'uint256', name: 'amountOut', type: 'uint256' }, 65 | { internalType: 'uint256', name: 'reserveIn', type: 'uint256' }, 66 | { internalType: 'uint256', name: 'reserveOut', type: 'uint256' }, 67 | ], 68 | name: 'getAmountIn', 69 | outputs: [{ internalType: 'uint256', name: 'amountIn', type: 'uint256' }], 70 | stateMutability: 'pure', 71 | type: 'function', 72 | }, 73 | { 74 | inputs: [ 75 | { internalType: 'uint256', name: 'amountIn', type: 'uint256' }, 76 | { internalType: 'uint256', name: 'reserveIn', type: 'uint256' }, 77 | { internalType: 'uint256', name: 'reserveOut', type: 'uint256' }, 78 | ], 79 | name: 'getAmountOut', 80 | outputs: [{ internalType: 'uint256', name: 'amountOut', type: 'uint256' }], 81 | stateMutability: 'pure', 82 | type: 'function', 83 | }, 84 | { 85 | inputs: [ 86 | { internalType: 'uint256', name: 'amountOut', type: 'uint256' }, 87 | { internalType: 'address[]', name: 'path', type: 'address[]' }, 88 | ], 89 | name: 'getAmountsIn', 90 | outputs: [ 91 | { internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }, 92 | ], 93 | stateMutability: 'view', 94 | type: 'function', 95 | }, 96 | { 97 | inputs: [ 98 | { internalType: 'uint256', name: 'amountIn', type: 'uint256' }, 99 | { internalType: 'address[]', name: 'path', type: 'address[]' }, 100 | ], 101 | name: 'getAmountsOut', 102 | outputs: [ 103 | { internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }, 104 | ], 105 | stateMutability: 'view', 106 | type: 'function', 107 | }, 108 | { 109 | inputs: [ 110 | { internalType: 'uint256', name: 'amountA', type: 'uint256' }, 111 | { internalType: 'uint256', name: 'reserveA', type: 'uint256' }, 112 | { internalType: 'uint256', name: 'reserveB', type: 'uint256' }, 113 | ], 114 | name: 'quote', 115 | outputs: [{ internalType: 'uint256', name: 'amountB', type: 'uint256' }], 116 | stateMutability: 'pure', 117 | type: 'function', 118 | }, 119 | { 120 | inputs: [ 121 | { internalType: 'address', name: 'tokenA', type: 'address' }, 122 | { internalType: 'address', name: 'tokenB', type: 'address' }, 123 | { internalType: 'uint256', name: 'liquidity', type: 'uint256' }, 124 | { internalType: 'uint256', name: 'amountAMin', type: 'uint256' }, 125 | { internalType: 'uint256', name: 'amountBMin', type: 'uint256' }, 126 | { internalType: 'address', name: 'to', type: 'address' }, 127 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 128 | ], 129 | name: 'removeLiquidity', 130 | outputs: [ 131 | { internalType: 'uint256', name: 'amountA', type: 'uint256' }, 132 | { internalType: 'uint256', name: 'amountB', type: 'uint256' }, 133 | ], 134 | stateMutability: 'nonpayable', 135 | type: 'function', 136 | }, 137 | { 138 | inputs: [ 139 | { internalType: 'address', name: 'token', type: 'address' }, 140 | { internalType: 'uint256', name: 'liquidity', type: 'uint256' }, 141 | { internalType: 'uint256', name: 'amountTokenMin', type: 'uint256' }, 142 | { internalType: 'uint256', name: 'amountETHMin', type: 'uint256' }, 143 | { internalType: 'address', name: 'to', type: 'address' }, 144 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 145 | ], 146 | name: 'removeLiquidityETH', 147 | outputs: [ 148 | { internalType: 'uint256', name: 'amountToken', type: 'uint256' }, 149 | { internalType: 'uint256', name: 'amountETH', type: 'uint256' }, 150 | ], 151 | stateMutability: 'nonpayable', 152 | type: 'function', 153 | }, 154 | { 155 | inputs: [ 156 | { internalType: 'address', name: 'token', type: 'address' }, 157 | { internalType: 'uint256', name: 'liquidity', type: 'uint256' }, 158 | { internalType: 'uint256', name: 'amountTokenMin', type: 'uint256' }, 159 | { internalType: 'uint256', name: 'amountETHMin', type: 'uint256' }, 160 | { internalType: 'address', name: 'to', type: 'address' }, 161 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 162 | ], 163 | name: 'removeLiquidityETHSupportingFeeOnTransferTokens', 164 | outputs: [{ internalType: 'uint256', name: 'amountETH', type: 'uint256' }], 165 | stateMutability: 'nonpayable', 166 | type: 'function', 167 | }, 168 | { 169 | inputs: [ 170 | { internalType: 'address', name: 'token', type: 'address' }, 171 | { internalType: 'uint256', name: 'liquidity', type: 'uint256' }, 172 | { internalType: 'uint256', name: 'amountTokenMin', type: 'uint256' }, 173 | { internalType: 'uint256', name: 'amountETHMin', type: 'uint256' }, 174 | { internalType: 'address', name: 'to', type: 'address' }, 175 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 176 | { internalType: 'bool', name: 'approveMax', type: 'bool' }, 177 | { internalType: 'uint8', name: 'v', type: 'uint8' }, 178 | { internalType: 'bytes32', name: 'r', type: 'bytes32' }, 179 | { internalType: 'bytes32', name: 's', type: 'bytes32' }, 180 | ], 181 | name: 'removeLiquidityETHWithPermit', 182 | outputs: [ 183 | { internalType: 'uint256', name: 'amountToken', type: 'uint256' }, 184 | { internalType: 'uint256', name: 'amountETH', type: 'uint256' }, 185 | ], 186 | stateMutability: 'nonpayable', 187 | type: 'function', 188 | }, 189 | { 190 | inputs: [ 191 | { internalType: 'address', name: 'token', type: 'address' }, 192 | { internalType: 'uint256', name: 'liquidity', type: 'uint256' }, 193 | { internalType: 'uint256', name: 'amountTokenMin', type: 'uint256' }, 194 | { internalType: 'uint256', name: 'amountETHMin', type: 'uint256' }, 195 | { internalType: 'address', name: 'to', type: 'address' }, 196 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 197 | { internalType: 'bool', name: 'approveMax', type: 'bool' }, 198 | { internalType: 'uint8', name: 'v', type: 'uint8' }, 199 | { internalType: 'bytes32', name: 'r', type: 'bytes32' }, 200 | { internalType: 'bytes32', name: 's', type: 'bytes32' }, 201 | ], 202 | name: 'removeLiquidityETHWithPermitSupportingFeeOnTransferTokens', 203 | outputs: [{ internalType: 'uint256', name: 'amountETH', type: 'uint256' }], 204 | stateMutability: 'nonpayable', 205 | type: 'function', 206 | }, 207 | { 208 | inputs: [ 209 | { internalType: 'address', name: 'tokenA', type: 'address' }, 210 | { internalType: 'address', name: 'tokenB', type: 'address' }, 211 | { internalType: 'uint256', name: 'liquidity', type: 'uint256' }, 212 | { internalType: 'uint256', name: 'amountAMin', type: 'uint256' }, 213 | { internalType: 'uint256', name: 'amountBMin', type: 'uint256' }, 214 | { internalType: 'address', name: 'to', type: 'address' }, 215 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 216 | { internalType: 'bool', name: 'approveMax', type: 'bool' }, 217 | { internalType: 'uint8', name: 'v', type: 'uint8' }, 218 | { internalType: 'bytes32', name: 'r', type: 'bytes32' }, 219 | { internalType: 'bytes32', name: 's', type: 'bytes32' }, 220 | ], 221 | name: 'removeLiquidityWithPermit', 222 | outputs: [ 223 | { internalType: 'uint256', name: 'amountA', type: 'uint256' }, 224 | { internalType: 'uint256', name: 'amountB', type: 'uint256' }, 225 | ], 226 | stateMutability: 'nonpayable', 227 | type: 'function', 228 | }, 229 | { 230 | inputs: [ 231 | { internalType: 'uint256', name: 'amountOut', type: 'uint256' }, 232 | { internalType: 'address[]', name: 'path', type: 'address[]' }, 233 | { internalType: 'address', name: 'to', type: 'address' }, 234 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 235 | ], 236 | name: 'swapETHForExactTokens', 237 | outputs: [ 238 | { internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }, 239 | ], 240 | stateMutability: 'payable', 241 | type: 'function', 242 | }, 243 | { 244 | inputs: [ 245 | { internalType: 'uint256', name: 'amountOutMin', type: 'uint256' }, 246 | { internalType: 'address[]', name: 'path', type: 'address[]' }, 247 | { internalType: 'address', name: 'to', type: 'address' }, 248 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 249 | ], 250 | name: 'swapExactETHForTokens', 251 | outputs: [ 252 | { internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }, 253 | ], 254 | stateMutability: 'payable', 255 | type: 'function', 256 | }, 257 | { 258 | inputs: [ 259 | { internalType: 'uint256', name: 'amountOutMin', type: 'uint256' }, 260 | { internalType: 'address[]', name: 'path', type: 'address[]' }, 261 | { internalType: 'address', name: 'to', type: 'address' }, 262 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 263 | ], 264 | name: 'swapExactETHForTokensSupportingFeeOnTransferTokens', 265 | outputs: [], 266 | stateMutability: 'payable', 267 | type: 'function', 268 | }, 269 | { 270 | inputs: [ 271 | { internalType: 'uint256', name: 'amountIn', type: 'uint256' }, 272 | { internalType: 'uint256', name: 'amountOutMin', type: 'uint256' }, 273 | { internalType: 'address[]', name: 'path', type: 'address[]' }, 274 | { internalType: 'address', name: 'to', type: 'address' }, 275 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 276 | ], 277 | name: 'swapExactTokensForETH', 278 | outputs: [ 279 | { internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }, 280 | ], 281 | stateMutability: 'nonpayable', 282 | type: 'function', 283 | }, 284 | { 285 | inputs: [ 286 | { internalType: 'uint256', name: 'amountIn', type: 'uint256' }, 287 | { internalType: 'uint256', name: 'amountOutMin', type: 'uint256' }, 288 | { internalType: 'address[]', name: 'path', type: 'address[]' }, 289 | { internalType: 'address', name: 'to', type: 'address' }, 290 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 291 | ], 292 | name: 'swapExactTokensForETHSupportingFeeOnTransferTokens', 293 | outputs: [], 294 | stateMutability: 'nonpayable', 295 | type: 'function', 296 | }, 297 | { 298 | inputs: [ 299 | { internalType: 'uint256', name: 'amountIn', type: 'uint256' }, 300 | { internalType: 'uint256', name: 'amountOutMin', type: 'uint256' }, 301 | { internalType: 'address[]', name: 'path', type: 'address[]' }, 302 | { internalType: 'address', name: 'to', type: 'address' }, 303 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 304 | ], 305 | name: 'swapExactTokensForTokens', 306 | outputs: [ 307 | { internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }, 308 | ], 309 | stateMutability: 'nonpayable', 310 | type: 'function', 311 | }, 312 | { 313 | inputs: [ 314 | { internalType: 'uint256', name: 'amountIn', type: 'uint256' }, 315 | { internalType: 'uint256', name: 'amountOutMin', type: 'uint256' }, 316 | { internalType: 'address[]', name: 'path', type: 'address[]' }, 317 | { internalType: 'address', name: 'to', type: 'address' }, 318 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 319 | ], 320 | name: 'swapExactTokensForTokensSupportingFeeOnTransferTokens', 321 | outputs: [], 322 | stateMutability: 'nonpayable', 323 | type: 'function', 324 | }, 325 | { 326 | inputs: [ 327 | { internalType: 'uint256', name: 'amountOut', type: 'uint256' }, 328 | { internalType: 'uint256', name: 'amountInMax', type: 'uint256' }, 329 | { internalType: 'address[]', name: 'path', type: 'address[]' }, 330 | { internalType: 'address', name: 'to', type: 'address' }, 331 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 332 | ], 333 | name: 'swapTokensForExactETH', 334 | outputs: [ 335 | { internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }, 336 | ], 337 | stateMutability: 'nonpayable', 338 | type: 'function', 339 | }, 340 | { 341 | inputs: [ 342 | { internalType: 'uint256', name: 'amountOut', type: 'uint256' }, 343 | { internalType: 'uint256', name: 'amountInMax', type: 'uint256' }, 344 | { internalType: 'address[]', name: 'path', type: 'address[]' }, 345 | { internalType: 'address', name: 'to', type: 'address' }, 346 | { internalType: 'uint256', name: 'deadline', type: 'uint256' }, 347 | ], 348 | name: 'swapTokensForExactTokens', 349 | outputs: [ 350 | { internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }, 351 | ], 352 | stateMutability: 'nonpayable', 353 | type: 'function', 354 | }, 355 | { stateMutability: 'payable', type: 'receive' }, 356 | ]; 357 | -------------------------------------------------------------------------------- /tasks/noobysswap/api.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { task } from '@/utils/utils'; 3 | 4 | export const swap = async (wallet: ethers.Wallet) => { 5 | 6 | await task(async () => { 7 | console.log(`[noobysswap] swap 参数获取中...`) 8 | let r = await fetch("https://api.noobysswap.io/api/swap", { 9 | "headers": { 10 | "accept": "*/*", 11 | "accept-language": "zh-CN,zh;q=0.9", 12 | "content-type": "application/json", 13 | "sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"", 14 | "sec-ch-ua-mobile": "?0", 15 | "sec-ch-ua-platform": "\"macOS\"", 16 | "sec-fetch-dest": "empty", 17 | "sec-fetch-mode": "cors", 18 | "sec-fetch-site": "same-origin" 19 | }, 20 | "referrer": "https://noobysswap.io/", 21 | "referrerPolicy": "strict-origin-when-cross-origin", 22 | "body": `{\"address\":\"${wallet.address}\"}`, 23 | "method": "POST", 24 | "mode": "cors", 25 | "credentials": "include" 26 | }); 27 | await r.json() 28 | }, { 29 | taskName: 'noobysswap_swap', 30 | walletAddr: wallet.address, 31 | }) 32 | } 33 | 34 | export const addLq = async (wallet: ethers.Wallet) => { 35 | await task(async () => { 36 | console.log(`[noobysswap] addLq 参数获取中...`) 37 | let r = await fetch("https://api.noobysswap.io/api/liquidity", { 38 | "headers": { 39 | "accept": "*/*", 40 | "accept-language": "zh-CN,zh;q=0.9", 41 | "content-type": "application/json", 42 | "sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"", 43 | "sec-ch-ua-mobile": "?0", 44 | "sec-ch-ua-platform": "\"macOS\"", 45 | "sec-fetch-dest": "empty", 46 | "sec-fetch-mode": "cors", 47 | "sec-fetch-site": "same-origin" 48 | }, 49 | "referrer": "https://noobysswap.io/", 50 | "referrerPolicy": "strict-origin-when-cross-origin", 51 | "body": `{\"address\":\"${wallet.address}\"}`, 52 | "method": "POST", 53 | "mode": "cors", 54 | "credentials": "include" 55 | }); 56 | await r.json() 57 | }, { 58 | taskName: 'noobysswap_addLq', 59 | walletAddr: wallet.address, 60 | }) 61 | } 62 | 63 | export const run = async (wallet: ethers.Wallet) => { 64 | await swap(wallet); 65 | await addLq(wallet); 66 | } -------------------------------------------------------------------------------- /tasks/noobysswap/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides, approveErc20, logGasCost } from '../base' 3 | import { swapAbi } from './abi'; 4 | import erc20abi from '@/const/erc20.json'; 5 | import { task } from '@/utils/utils'; 6 | 7 | const usdtCa = '0xF7C13fEFf0b098eE55A58683a54509fDe40eCbaa' 8 | const nbsCa = '0xb6f7E3e51053CD7Be555696aF0a136Bdf58Aa56a' 9 | 10 | export const swap = async (wallet: ethers.Wallet) => { 11 | const signer = wallet.connect(provider); 12 | const usdt = new ethers.Contract(usdtCa, erc20abi, signer); 13 | const usdtBalance = await usdt.balanceOf(wallet.address); 14 | 15 | if (usdtBalance.isZero()) { 16 | const abi = ['function claimTokens()'] 17 | const usdtClaimCa = '0x87b9e734A59571f1Ec3F60e1C1722d371D2D59c7' 18 | const contract = new ethers.Contract(usdtClaimCa, abi, signer); 19 | await task(async () => { 20 | const tx = await contract.claimTokens(await overrides(wallet.address)); 21 | logGasCost(await tx.wait()) 22 | }, { 23 | taskName: 'noobysswap_claim_usdt', 24 | walletAddr: wallet.address, 25 | }) 26 | } 27 | 28 | const ca = '0x0913482dccc4ccf7219897e0976d3a2727f4316c' 29 | await approveErc20(signer, usdtCa, ca) 30 | const contract = new ethers.Contract(ca, swapAbi, signer); 31 | const deadline = Math.floor(Date.now() / 1000) + 60 * 2000 32 | await task(async () => { 33 | const tx = await contract.swapExactTokensForTokens( 34 | ethers.utils.parseEther('100'), 35 | ethers.constants.Zero, 36 | [usdtCa, nbsCa], 37 | wallet.address, 38 | deadline, 39 | await overrides(wallet.address) 40 | ) 41 | logGasCost(await tx.wait()) 42 | }, { 43 | taskName: 'noobysswap_swap', 44 | walletAddr: wallet.address, 45 | }) 46 | } 47 | 48 | export const addLq = async (wallet: ethers.Wallet) => { 49 | const signer = wallet.connect(provider); 50 | const ca = '0x0913482dccc4ccf7219897e0976d3a2727f4316c'; 51 | 52 | const contract = new ethers.Contract(ca, swapAbi, signer); 53 | 54 | await task(async () => { 55 | await approveErc20(signer, nbsCa, ca); 56 | const tx = await contract.addLiquidity( 57 | usdtCa, 58 | nbsCa, 59 | ethers.utils.parseEther('10'), 60 | ethers.utils.parseEther('10'), 61 | ethers.constants.Zero, 62 | ethers.constants.Zero, 63 | wallet.address, 64 | '0x09184e729fff', 65 | await overrides(wallet.address) 66 | ) 67 | logGasCost(await tx.wait()) 68 | }, { 69 | taskName: 'noobysswap_addLq', 70 | walletAddr: wallet.address, 71 | }) 72 | } 73 | 74 | export const run = async (wallet: ethers.Wallet) => { 75 | await swap(wallet); 76 | await addLq(wallet); 77 | } -------------------------------------------------------------------------------- /tasks/openocean/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides, logGasCost } from '../base' 3 | import { loop, task } from '@/utils/utils'; 4 | 5 | export const run = async (wallet: ethers.Wallet) => { 6 | const signer = wallet.connect(provider); 7 | const value = ethers.utils.parseEther('0.001'); 8 | let r: any; 9 | await task(async () => { 10 | console.log(`[openocean] swap 参数获取中...`) 11 | r = await fetch(`https://ethapi.openocean.finance/v2/59140/swap?inTokenSymbol=ETH&inTokenAddress=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&outTokenSymbol=WETH&outTokenAddress=0x2C1b868d6596a18e32E61B901E4060C872647b6C&amount=${value.toString()}&gasPrice=1500000011&disabledDexIds=&slippage=100&account=${wallet.address}&referrer=0x3487ef9f9b36547e43268b8f0e2349a226c70b53`, { 12 | "headers": { 13 | "accept": "application/json, text/plain, */*", 14 | "accept-language": "zh-CN,zh;q=0.9", 15 | "if-none-match": "W/\"c9d-j79pBeCBOnIi8+ZMq0YCpQE28E4\"", 16 | "sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"", 17 | "sec-ch-ua-mobile": "?0", 18 | "sec-ch-ua-platform": "\"macOS\"", 19 | "sec-fetch-dest": "empty", 20 | "sec-fetch-mode": "cors", 21 | "sec-fetch-site": "same-site", 22 | "token": "" 23 | }, 24 | "referrer": "https://app.openocean.finance/", 25 | "referrerPolicy": "strict-origin-when-cross-origin", 26 | "body": null, 27 | "method": "GET", 28 | "mode": "cors", 29 | "credentials": "omit" 30 | }); 31 | r = await r.json(); 32 | const tx = await signer.sendTransaction({ 33 | to: '0x6352a56caadC4F1E25CD6c75970Fa768A3304e64', 34 | data: r.data, 35 | ...await overrides(wallet.address), 36 | value 37 | }); 38 | logGasCost(await tx.wait()) 39 | }, { 40 | taskName: 'openocean_swap', 41 | walletAddr: wallet.address, 42 | }) 43 | } -------------------------------------------------------------------------------- /tasks/pancake/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { poolAbi } from './abi'; 3 | import { lineaProvider as provider, overrides, logGasCost, approveErc20 } from '../base' 4 | import { task } from '@/utils/utils'; 5 | 6 | export const swap = async (wallet: ethers.Wallet) => { 7 | const signer = wallet.connect(provider); 8 | const iface = new ethers.utils.Interface([{ 9 | "inputs": [ 10 | { 11 | "components": [ 12 | { 13 | "internalType": "address", 14 | "name": "tokenIn", 15 | "type": "address" 16 | }, 17 | { 18 | "internalType": "address", 19 | "name": "tokenOut", 20 | "type": "address" 21 | }, 22 | { 23 | "internalType": "uint24", 24 | "name": "fee", 25 | "type": "uint24" 26 | }, 27 | { 28 | "internalType": "address", 29 | "name": "recipient", 30 | "type": "address" 31 | }, 32 | { 33 | "internalType": "uint256", 34 | "name": "amountIn", 35 | "type": "uint256" 36 | }, 37 | { 38 | "internalType": "uint256", 39 | "name": "amountOutMinimum", 40 | "type": "uint256" 41 | }, 42 | { 43 | "internalType": "uint160", 44 | "name": "sqrtPriceLimitX96", 45 | "type": "uint160" 46 | } 47 | ], 48 | "internalType": "struct IV3SwapRouter.ExactInputSingleParams", 49 | "name": "params", 50 | "type": "tuple" 51 | } 52 | ], 53 | "name": "exactInputSingle", 54 | "outputs": [ 55 | { 56 | "internalType": "uint256", 57 | "name": "amountOut", 58 | "type": "uint256" 59 | } 60 | ], 61 | "stateMutability": "payable", 62 | "type": "function" 63 | }]); 64 | const deadline = Math.floor(Date.now() / 1000) + 60 * 20; 65 | const data = iface.encodeFunctionData('exactInputSingle', [{ 66 | tokenIn: '0x2C1b868d6596a18e32E61B901E4060C872647b6C', 67 | tokenOut: '0xf56dc6695cF1f5c364eDEbC7Dc7077ac9B586068', 68 | fee: 2500, 69 | recipient: wallet.address, 70 | amountIn: ethers.utils.parseEther('0.01'), 71 | amountOutMinimum: ethers.constants.Zero, 72 | sqrtPriceLimitX96: 0, 73 | }]); 74 | const contract = new ethers.Contract('0x21d809FB4052bb1807cfe2418bA638d72F4aEf87', ['function multicall(uint256, bytes[]) payable'], signer) 75 | 76 | await task(async () => { 77 | const tx = await contract.multicall(deadline, [data], { 78 | ...await overrides(wallet.address), 79 | value: ethers.utils.parseEther('0.01') 80 | }); 81 | logGasCost(await tx.wait()); 82 | }, { 83 | taskName: 'pancake_swap', 84 | walletAddr: wallet.address, 85 | }) 86 | } 87 | 88 | export const addLq = async (wallet: ethers.Wallet) => { 89 | const signer = wallet.connect(provider); 90 | const iface = new ethers.utils.Interface([{ 91 | "inputs": [ 92 | { 93 | "components": [ 94 | { 95 | "internalType": "address", 96 | "name": "token0", 97 | "type": "address" 98 | }, 99 | { 100 | "internalType": "address", 101 | "name": "token1", 102 | "type": "address" 103 | }, 104 | { 105 | "internalType": "uint24", 106 | "name": "fee", 107 | "type": "uint24" 108 | }, 109 | { 110 | "internalType": "int24", 111 | "name": "tickLower", 112 | "type": "int24" 113 | }, 114 | { 115 | "internalType": "int24", 116 | "name": "tickUpper", 117 | "type": "int24" 118 | }, 119 | { 120 | "internalType": "uint256", 121 | "name": "amount0Desired", 122 | "type": "uint256" 123 | }, 124 | { 125 | "internalType": "uint256", 126 | "name": "amount1Desired", 127 | "type": "uint256" 128 | }, 129 | { 130 | "internalType": "uint256", 131 | "name": "amount0Min", 132 | "type": "uint256" 133 | }, 134 | { 135 | "internalType": "uint256", 136 | "name": "amount1Min", 137 | "type": "uint256" 138 | }, 139 | { 140 | "internalType": "address", 141 | "name": "recipient", 142 | "type": "address" 143 | }, 144 | { 145 | "internalType": "uint256", 146 | "name": "deadline", 147 | "type": "uint256" 148 | } 149 | ], 150 | "internalType": "struct INonfungiblePositionManager.MintParams", 151 | "name": "params", 152 | "type": "tuple" 153 | } 154 | ], 155 | "name": "mint", 156 | "outputs": [ 157 | { 158 | "internalType": "uint256", 159 | "name": "tokenId", 160 | "type": "uint256" 161 | }, 162 | { 163 | "internalType": "uint128", 164 | "name": "liquidity", 165 | "type": "uint128" 166 | }, 167 | { 168 | "internalType": "uint256", 169 | "name": "amount0", 170 | "type": "uint256" 171 | }, 172 | { 173 | "internalType": "uint256", 174 | "name": "amount1", 175 | "type": "uint256" 176 | } 177 | ], 178 | "stateMutability": "payable", 179 | "type": "function" 180 | }]); 181 | let deadline = Math.floor(Date.now() / 1000) + 60 * 2000; 182 | let data = iface.encodeFunctionData('mint', [{ 183 | token0: '0x2C1b868d6596a18e32E61B901E4060C872647b6C', 184 | token1: '0xf56dc6695cF1f5c364eDEbC7Dc7077ac9B586068', 185 | tickLower: -152700, 186 | tickUpper: -138850, 187 | fee: 2500, 188 | amount0Desired: ethers.utils.parseEther('0.001'), 189 | amount1Desired: ethers.utils.parseUnits('1', 6), 190 | amount0Min: ethers.constants.Zero, 191 | amount1Min: ethers.constants.Zero, 192 | recipient: wallet.address, 193 | deadline, 194 | }]); 195 | const refundETH = new ethers.utils.Interface(['function refundETH() payable']).encodeFunctionData('refundETH', []); 196 | const contract = new ethers.Contract('0xacFa791C833120c769Fd3066c940B7D30Cd8BC73', ['function multicall(bytes[]) payable'], signer); 197 | await task(async () => { 198 | await approveErc20(signer, '0xf56dc6695cF1f5c364eDEbC7Dc7077ac9B586068', contract.address) 199 | const tx = await contract.multicall([data, refundETH], { 200 | ...await overrides(wallet.address), 201 | value: ethers.utils.parseEther('0.01') 202 | }); 203 | logGasCost(await tx.wait()); 204 | }, { 205 | taskName: 'pancake_addLq', 206 | walletAddr: wallet.address, 207 | }) 208 | } 209 | 210 | const MAX_UINT128 = 2n ** 128n - 1n; 211 | 212 | export const rmLq = async (wallet: ethers.Wallet) => { 213 | const signer = wallet.connect(provider); 214 | const contract = new ethers.Contract('0xacFa791C833120c769Fd3066c940B7D30Cd8BC73', poolAbi, signer); 215 | await task(async () => { 216 | let position: any; 217 | let tokenId: any 218 | let tokenIndex = 0; 219 | while (!position) { 220 | try { 221 | tokenId = await contract.tokenOfOwnerByIndex(wallet.address, tokenIndex); 222 | } catch (error) { 223 | throw Error('未找到可移除的池子,请重新添加流动性') 224 | } 225 | position = await contract.positions(tokenId); 226 | if ((position.liquidity as ethers.BigNumber).isZero()) { 227 | tokenIndex++; 228 | position = null; 229 | } else { 230 | break; 231 | } 232 | 233 | } 234 | const collectParams = { 235 | tokenId: Number(tokenId), 236 | recipient: wallet.address, 237 | amount0Max: MAX_UINT128, 238 | amount1Max: MAX_UINT128 239 | } 240 | 241 | const iface = new ethers.utils.Interface(poolAbi); 242 | const calldatas = []; 243 | let deadline = Math.floor(Date.now() / 1000) + 60 * 2000; 244 | calldatas.push(iface.encodeFunctionData('decreaseLiquidity', [{ 245 | tokenId: tokenId, 246 | liquidity: (position.liquidity as ethers.BigNumber).div(2), 247 | amount0Min: ethers.constants.Zero, 248 | amount1Min: ethers.constants.Zero, 249 | deadline, 250 | }])); 251 | calldatas.push(iface.encodeFunctionData('collect', [collectParams])) 252 | calldatas.push(iface.encodeFunctionData('unwrapWETH9', [ethers.constants.Zero, wallet.address,])); 253 | calldatas.push(iface.encodeFunctionData('sweepToken', [position.token1, ethers.constants.Zero, wallet.address])); 254 | const tx = await contract.multicall(calldatas, await overrides(wallet.address)); 255 | logGasCost(await tx.wait()); 256 | }, { 257 | taskName: 'pancake_rmLq', 258 | walletAddr: wallet.address, 259 | }) 260 | } 261 | 262 | export const run = async (wallet: ethers.Wallet) => { 263 | await swap(wallet); 264 | await addLq(wallet); 265 | await rmLq(wallet); 266 | } -------------------------------------------------------------------------------- /tasks/squid/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides, approveErc20, logGasCost } from '../base' 3 | import axios from 'axios'; 4 | import { loop, task } from '@/utils/utils'; 5 | 6 | export const run = async (wallet: ethers.Wallet) => { 7 | const signer = wallet.connect(provider); 8 | const params = { 9 | fromChain: 59140, 10 | fromToken: '0xf56dc6695cf1f5c364edebc7dc7077ac9b586068', 11 | fromAmount: '10000', 12 | toChain: '43113', 13 | toToken: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', 14 | toAddress: wallet.address, 15 | quoteOnly: false, 16 | slippage: 1.5, 17 | enableExpress: true, 18 | } as any; 19 | 20 | await task(async () => { 21 | let res = await axios.get('https://squid-api-git-linea-quests-0xsquid.vercel.app/v1/route', { 22 | params 23 | }) 24 | await approveErc20( 25 | signer, 26 | '0xf56dc6695cf1f5c364edebc7dc7077ac9b586068', 27 | '0x9bEb991eDdF92528E6342Ec5f7B0846C24cbaB58' 28 | ) 29 | let tx = await signer.sendTransaction({ 30 | to: res.data.route.transactionRequest.targetAddress, 31 | data: res.data.route.transactionRequest.data, 32 | value: res.data.route.transactionRequest.value, 33 | ...await overrides(wallet.address), 34 | }); 35 | logGasCost(await tx.wait()) 36 | }, { 37 | taskName: 'squid_swap', 38 | walletAddr: wallet.address, 39 | }) 40 | 41 | params.toToken = '0x57f1c63497aee0be305b8852b354cec793da43bb' 42 | params.receiveGasOnDestination = true 43 | 44 | await task(async () => { 45 | let res = await axios.get('https://squid-api-git-linea-quests-0xsquid.vercel.app/v1/route', { 46 | params 47 | }) 48 | const tx = await signer.sendTransaction({ 49 | to: res.data.route.transactionRequest.targetAddress, 50 | data: res.data.route.transactionRequest.data, 51 | value: res.data.route.transactionRequest.value, 52 | ...await overrides(wallet.address), 53 | }); 54 | logGasCost(await tx.wait()) 55 | }, { 56 | taskName: 'squid_swap_gas', 57 | walletAddr: wallet.address, 58 | }) 59 | } 60 | -------------------------------------------------------------------------------- /tasks/sushiswap/abi.ts: -------------------------------------------------------------------------------- 1 | export const swapAbi = [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "_bentoBox", 7 | "type": "address" 8 | } 9 | ], 10 | "stateMutability": "nonpayable", 11 | "type": "constructor" 12 | }, 13 | { 14 | "inputs": [ 15 | 16 | ], 17 | "name": "bentoBox", 18 | "outputs": [ 19 | { 20 | "internalType": "contract IBentoBoxMinimal", 21 | "name": "", 22 | "type": "address" 23 | } 24 | ], 25 | "stateMutability": "view", 26 | "type": "function" 27 | }, 28 | { 29 | "inputs": [ 30 | { 31 | "internalType": "address", 32 | "name": "tokenIn", 33 | "type": "address" 34 | }, 35 | { 36 | "internalType": "uint256", 37 | "name": "amountIn", 38 | "type": "uint256" 39 | }, 40 | { 41 | "internalType": "address", 42 | "name": "tokenOut", 43 | "type": "address" 44 | }, 45 | { 46 | "internalType": "uint256", 47 | "name": "amountOutMin", 48 | "type": "uint256" 49 | }, 50 | { 51 | "internalType": "address", 52 | "name": "to", 53 | "type": "address" 54 | }, 55 | { 56 | "internalType": "bytes", 57 | "name": "route", 58 | "type": "bytes" 59 | } 60 | ], 61 | "name": "processRoute", 62 | "outputs": [ 63 | { 64 | "internalType": "uint256", 65 | "name": "amountOut", 66 | "type": "uint256" 67 | } 68 | ], 69 | "stateMutability": "payable", 70 | "type": "function" 71 | }, 72 | { 73 | "inputs": [ 74 | { 75 | "internalType": "address payable", 76 | "name": "transferValueTo", 77 | "type": "address" 78 | }, 79 | { 80 | "internalType": "uint256", 81 | "name": "amountValueTransfer", 82 | "type": "uint256" 83 | }, 84 | { 85 | "internalType": "address", 86 | "name": "tokenIn", 87 | "type": "address" 88 | }, 89 | { 90 | "internalType": "uint256", 91 | "name": "amountIn", 92 | "type": "uint256" 93 | }, 94 | { 95 | "internalType": "address", 96 | "name": "tokenOut", 97 | "type": "address" 98 | }, 99 | { 100 | "internalType": "uint256", 101 | "name": "amountOutMin", 102 | "type": "uint256" 103 | }, 104 | { 105 | "internalType": "address", 106 | "name": "to", 107 | "type": "address" 108 | }, 109 | { 110 | "internalType": "bytes", 111 | "name": "route", 112 | "type": "bytes" 113 | } 114 | ], 115 | "name": "transferValueAndprocessRoute", 116 | "outputs": [ 117 | { 118 | "internalType": "uint256", 119 | "name": "amountOut", 120 | "type": "uint256" 121 | } 122 | ], 123 | "stateMutability": "payable", 124 | "type": "function" 125 | }, 126 | { 127 | "stateMutability": "payable", 128 | "type": "receive" 129 | } 130 | ] -------------------------------------------------------------------------------- /tasks/sushiswap/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides, logGasCost, approveErc20 } from '../base' 3 | import { task } from '@/utils/utils'; 4 | import { swapAbi } from './abi'; 5 | 6 | export const run = async (wallet: ethers.Wallet) => { 7 | const signer = wallet.connect(provider); 8 | const uniMintAddr = '0xb2A334FE6e360DE8F2BDDFc336EdD6C70aF1acD8' 9 | const uniMintAbi = [ 10 | 'function mint(address _to, uint256 _amount) payable', 11 | 'function balanceOf(address) view returns (uint256)', 12 | ] 13 | const uni = new ethers.Contract(uniMintAddr, uniMintAbi, signer); 14 | 15 | await task(async () => { 16 | const tx = await uni.mint(wallet.address, ethers.BigNumber.from('1890000000000000100'), { 17 | ...await overrides(wallet.address), 18 | value: ethers.utils.parseEther('0.005') 19 | }) 20 | logGasCost(await tx.wait()); 21 | }, { 22 | taskName: 'sushiswap_mint_uni', 23 | walletAddr: wallet.address, 24 | }) 25 | const uniTokenAddr = '0x7823E8DCC8bfc23EA3AC899EB86921f90e80F499'; 26 | const ca = '0xd40f1b2dfe81b471c4cab2953e24fda9353b1cac'; 27 | 28 | 29 | const contract = new ethers.Contract(ca, swapAbi, signer); 30 | 31 | const amountIn = ethers.utils.parseEther('0.005') 32 | const route = `0x03010238aee712b3245f163ccfcde86af26dd40ad8eb000000000000000000000000000000000000000000000000016345785d8a00000a0238aee712b3245f163ccfcde86af26dd40ad8eb7823e8dcc8bfc23ea3ac899eb86921f90e80f49900${wallet.address.toLocaleLowerCase().substring(2)}`; 33 | await task(async () => { 34 | await approveErc20(signer, uniTokenAddr, ca); 35 | 36 | const tx = await contract.processRoute( 37 | uniTokenAddr, 38 | ethers.BigNumber.from('100000000000000000'), 39 | "0x1990BC6dfe2ef605Bfc08f5A23564dB75642Ad73", 40 | 356808, 41 | wallet.address, 42 | route, 43 | { 44 | ...await overrides(wallet.address), 45 | value: amountIn 46 | } 47 | ); 48 | logGasCost(await tx.wait()); 49 | }, { 50 | taskName: 'sushiswap_swap', 51 | walletAddr: wallet.address, 52 | }) 53 | } -------------------------------------------------------------------------------- /tasks/symbiosis/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides, logGasCost, getBalanceWithLog } from '../base' 3 | import { task } from '@/utils/utils'; 4 | 5 | const WETH = '0x2c1b868d6596a18e32e61b901e4060c872647b6c' 6 | const USDT = '0xAED47A51AeFa6f95A388aDA3c459d94FF46fC4BB' 7 | 8 | export const run = async (wallet: ethers.Wallet) => { 9 | const signer = wallet.connect(provider); 10 | let ca = '0x106c6743C1f8ED9c5c824887AadAc8215294f8b6' 11 | let abi = ['function swapExactETHForTokens(uint256, address[], address, uint256) payable'] as any; 12 | let contract = new ethers.Contract(ca, abi, signer); 13 | let amount = ethers.utils.parseEther('0.02'); 14 | let deadline = Math.floor(Date.now() / 1000) + 120 * 60 * 60; 15 | await task(async () => { 16 | const balance = await getBalanceWithLog(signer); 17 | const overridesValue = await overrides(wallet.address) 18 | const emitGas = await contract.estimateGas.swapExactETHForTokens( 19 | ethers.constants.Zero, 20 | [WETH, USDT], 21 | wallet.address, 22 | deadline, 23 | { 24 | ...overridesValue, 25 | value: amount, 26 | } 27 | ) 28 | const emitCost = emitGas.mul(overridesValue.maxFeePerGas); 29 | if (emitCost.gt(balance)) { 30 | console.log(`❌余额不足,跳过...`) 31 | return false 32 | } 33 | const tx = await contract.swapExactETHForTokens( 34 | ethers.constants.Zero, 35 | [WETH, USDT], 36 | wallet.address, 37 | deadline, 38 | { 39 | ...overridesValue, 40 | value: amount, 41 | } 42 | ) 43 | logGasCost(await tx.wait()); 44 | }, { 45 | taskName: 'symbiosis_swap', 46 | walletAddr: wallet.address, 47 | }) 48 | 49 | await task(async () => { 50 | await fetch("https://api-v2.symbiosis.finance/crosschain/v1/testnet-swap-to-linea", { 51 | "headers": { 52 | "accept": "*/*", 53 | "accept-language": "zh-CN,zh;q=0.9", 54 | "content-type": "application/json", 55 | "sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"", 56 | "sec-ch-ua-mobile": "?0", 57 | "sec-ch-ua-platform": "\"macOS\"", 58 | "sec-fetch-dest": "empty", 59 | "sec-fetch-mode": "cors", 60 | "sec-fetch-site": "same-site" 61 | }, 62 | "referrerPolicy": "no-referrer", 63 | "body": `{\"item\":\"${wallet.address}\"}`, 64 | "method": "POST", 65 | "mode": "cors", 66 | "credentials": "omit" 67 | }); 68 | }, { 69 | taskName: 'symbiosis_swap_api', 70 | walletAddr: wallet.address, 71 | }) 72 | } -------------------------------------------------------------------------------- /tasks/uniswap/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides } from '../base' 3 | import { task } from '@/utils/utils'; 4 | 5 | export const run = async (wallet: ethers.Wallet) => { 6 | const signer = wallet.connect(provider); 7 | const iface = new ethers.utils.Interface([{ 8 | "inputs": [ 9 | { 10 | "components": [ 11 | { 12 | "internalType": "address", 13 | "name": "tokenIn", 14 | "type": "address" 15 | }, 16 | { 17 | "internalType": "address", 18 | "name": "tokenOut", 19 | "type": "address" 20 | }, 21 | { 22 | "internalType": "uint24", 23 | "name": "fee", 24 | "type": "uint24" 25 | }, 26 | { 27 | "internalType": "address", 28 | "name": "recipient", 29 | "type": "address" 30 | }, 31 | { 32 | "internalType": "uint256", 33 | "name": "amountIn", 34 | "type": "uint256" 35 | }, 36 | { 37 | "internalType": "uint256", 38 | "name": "amountOutMinimum", 39 | "type": "uint256" 40 | }, 41 | { 42 | "internalType": "uint160", 43 | "name": "sqrtPriceLimitX96", 44 | "type": "uint160" 45 | } 46 | ], 47 | "internalType": "struct IV3SwapRouter.ExactInputSingleParams", 48 | "name": "params", 49 | "type": "tuple" 50 | } 51 | ], 52 | "name": "exactInputSingle", 53 | "outputs": [ 54 | { 55 | "internalType": "uint256", 56 | "name": "amountOut", 57 | "type": "uint256" 58 | } 59 | ], 60 | "stateMutability": "payable", 61 | "type": "function" 62 | }]); 63 | const amountIn = ethers.utils.parseEther('0.005') 64 | const deadline = Math.floor(Date.now() / 1000) + 60 * 60 * 20; 65 | const data = iface.encodeFunctionData('exactInputSingle', [{ 66 | tokenIn: "0x2C1b868d6596a18e32E61B901E4060C872647b6C", 67 | tokenOut: "0xD2340c4ec834bf43c05B9EcCd60EeD3a20892Dcc", 68 | fee: 3000, 69 | recipient: wallet.address, 70 | amountIn, 71 | amountOutMinimum: ethers.constants.Zero, 72 | sqrtPriceLimitX96: 0, 73 | }]); 74 | const contract = new ethers.Contract('0x6aa397CAB00a2A40025Dbf839a83f16D5EC7c1eB', ['function multicall(uint256, bytes[]) payable'], signer) 75 | await task(async () => { 76 | const tx = await contract.multicall(deadline, [data], { 77 | ...await overrides(wallet.address), 78 | value: amountIn 79 | }); 80 | await tx.wait(); 81 | }, { 82 | taskName: 'uniswap_swap', 83 | walletAddr: wallet.address, 84 | }) 85 | } -------------------------------------------------------------------------------- /tasks/velocore/abi.ts: -------------------------------------------------------------------------------- 1 | export const swapAbi = [{ 2 | stateMutability: "nonpayable", 3 | inputs: [{ 4 | name: "implementation", 5 | type: "address", 6 | internalType: "contract IFacet" 7 | }], 8 | outputs: [], 9 | type: "function", 10 | name: "admin_addFacet" 11 | }, { 12 | name: "admin_setAuthorizer", 13 | outputs: [], 14 | stateMutability: "nonpayable", 15 | type: "function", 16 | inputs: [{ 17 | internalType: "contract IAuthorizer", 18 | type: "address", 19 | name: "auth_" 20 | }] 21 | }, { 22 | stateMutability: "nonpayable", 23 | inputs: [{ 24 | name: "implementation", 25 | type: "address", 26 | internalType: "address" 27 | }, { 28 | type: "bytes4[]", 29 | name: "sigs", 30 | internalType: "bytes4[]" 31 | }], 32 | outputs: [], 33 | name: "admin_setFunctions", 34 | type: "function" 35 | }, { 36 | inputs: [{ 37 | type: "address", 38 | name: "gauge", 39 | internalType: "contract IGauge" 40 | }, { 41 | internalType: "contract IBribe", 42 | name: "bribe", 43 | type: "address" 44 | }], 45 | stateMutability: "nonpayable", 46 | type: "function", 47 | outputs: [], 48 | name: "attachBribe" 49 | }, { 50 | outputs: [{ 51 | name: "", 52 | type: "bytes32", 53 | internalType: "Token" 54 | }], 55 | type: "function", 56 | name: "ballotToken", 57 | stateMutability: "nonpayable", 58 | inputs: [] 59 | }, { 60 | type: "function", 61 | outputs: [{ 62 | name: "", 63 | internalType: "Token", 64 | type: "bytes32" 65 | }], 66 | inputs: [], 67 | stateMutability: "nonpayable", 68 | name: "emissionToken" 69 | }, { 70 | type: "function", 71 | outputs: [], 72 | inputs: [{ 73 | type: "bytes32[]", 74 | internalType: "Token[]", 75 | name: "tokenRef" 76 | }, { 77 | name: "deposit", 78 | type: "int128[]", 79 | internalType: "int128[]" 80 | }, { 81 | components: [{ 82 | type: "bytes32", 83 | internalType: "bytes32", 84 | name: "poolId" 85 | }, { 86 | name: "tokenInformations", 87 | type: "bytes32[]", 88 | internalType: "bytes32[]" 89 | }, { 90 | type: "bytes", 91 | name: "data", 92 | internalType: "bytes" 93 | }], 94 | name: "ops", 95 | type: "tuple[]", 96 | internalType: "struct VelocoreOperation[]" 97 | }], 98 | name: "execute", 99 | stateMutability: "payable" 100 | }, { 101 | name: "inspect", 102 | type: "function", 103 | outputs: [], 104 | stateMutability: "nonpayable", 105 | inputs: [{ 106 | type: "address", 107 | internalType: "address", 108 | name: "lens" 109 | }, { 110 | type: "bytes", 111 | internalType: "bytes", 112 | name: "data" 113 | }] 114 | }, { 115 | name: "notifyInitialSupply", 116 | outputs: [], 117 | inputs: [{ 118 | internalType: "Token", 119 | type: "bytes32", 120 | name: "" 121 | }, { 122 | internalType: "uint128", 123 | type: "uint128", 124 | name: "" 125 | }, { 126 | internalType: "uint128", 127 | type: "uint128", 128 | name: "" 129 | }], 130 | type: "function", 131 | stateMutability: "nonpayable" 132 | }, { 133 | name: "query", 134 | stateMutability: "nonpayable", 135 | inputs: [{ 136 | name: "user", 137 | internalType: "address", 138 | type: "address" 139 | }, { 140 | internalType: "Token[]", 141 | name: "tokenRef", 142 | type: "bytes32[]" 143 | }, { 144 | type: "int128[]", 145 | name: "deposit", 146 | internalType: "int128[]" 147 | }, { 148 | type: "tuple[]", 149 | internalType: "struct VelocoreOperation[]", 150 | name: "ops", 151 | components: [{ 152 | name: "poolId", 153 | internalType: "bytes32", 154 | type: "bytes32" 155 | }, { 156 | name: "tokenInformations", 157 | internalType: "bytes32[]", 158 | type: "bytes32[]" 159 | }, { 160 | name: "data", 161 | internalType: "bytes", 162 | type: "bytes" 163 | }] 164 | }], 165 | type: "function", 166 | outputs: [{ 167 | internalType: "int128[]", 168 | type: "int128[]", 169 | name: "" 170 | }] 171 | }] -------------------------------------------------------------------------------- /tasks/velocore/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides, logGasCost } from '../base' 3 | import { swapAbi } from './abi'; 4 | import { task } from '@/utils/utils'; 5 | 6 | export const run = async (wallet: ethers.Wallet) => { 7 | const signer = wallet.connect(provider); 8 | const ca = '0x0D0AC722d0f1Ec62F2E62Dd28fac0b514c71cC92' 9 | const contract = new ethers.Contract(ca, swapAbi, signer); 10 | const amount = ethers.utils.parseEther('0.001'); 11 | 12 | await task(async () => { 13 | const tx = await contract.execute( 14 | [ 15 | "0x000000000000000000000000f56dc6695cf1f5c364edebc7dc7077ac9b586068", 16 | "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" 17 | ], 18 | [ 19 | "0", 20 | "0" 21 | ], 22 | [ 23 | { 24 | "poolId": "0x000000000000000000000000dbc33d6bc191403d938fd9e69197c614663efcbb", 25 | "tokenInformations": [ 26 | "0x0001000000000000000000000000000000000000000000000000000000000000", 27 | "0x01020000000000000000000000000000000000000000000000038d7ea4c68000" 28 | ], 29 | "data": [] 30 | } 31 | ], 32 | { 33 | ...await overrides(wallet.address), 34 | value: amount 35 | } 36 | ) 37 | logGasCost(await tx.wait()) 38 | 39 | }, { 40 | taskName: 'velocore_swap', 41 | walletAddr: wallet.address, 42 | }) 43 | 44 | const addLiquidInputData = '0xd3115a8a000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000030000000000000000000000001da851ca5c2b4a79049f4d967725b69f67b52f7f000000000000000000000000dbc33d6bc191403d938fd9e69197c614663efcbbeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000dbc33d6bc191403d938fd9e69197c614663efcbb000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000020101000000000000000000000000000000000000000000000000000000000000020200000000000000000000000000007fffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000010000000000000000000000dbc33d6bc191403d938fd9e69197c614663efcbb000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000020001000000000000000000000000000000000000000000000000000000000000010200000000000000000000000000007fffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000' 45 | await task(async () => { 46 | const tx = await signer.sendTransaction({ 47 | to: ca, 48 | data: addLiquidInputData, 49 | value: amount, 50 | gasLimit: 362089, 51 | ...await overrides(wallet.address), 52 | }) 53 | logGasCost(await tx.wait()) 54 | }, { 55 | taskName: 'velocore_add_liquid', 56 | walletAddr: wallet.address, 57 | }) 58 | } 59 | -------------------------------------------------------------------------------- /tasks/zkex/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides, approveErc20, logGasCost } from '../base' 3 | import { task } from '@/utils/utils'; 4 | import axios from 'axios'; 5 | 6 | // @todo withdraw 7 | export const run = async (wallet: ethers.Wallet) => { 8 | const signer = wallet.connect(provider); 9 | const signature = await signer.signMessage(`Sign this message to connect with ZKEX services.\nNOTE: Please check this website ends with \"app.zkex.com\".`) 10 | 11 | let res: any = await fetch("https://aws-test-1.zkex.com/api-v1/api/users", { 12 | "headers": { 13 | "accept": "application/json, text/plain, */*", 14 | "accept-language": "zh-CN,zh;q=0.9", 15 | "content-type": "application/json", 16 | "sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"", 17 | "sec-ch-ua-mobile": "?0", 18 | "sec-ch-ua-platform": "\"macOS\"", 19 | "sec-fetch-dest": "empty", 20 | "sec-fetch-mode": "cors", 21 | "sec-fetch-site": "same-site" 22 | }, 23 | "referrer": "https://testnet.app.zkex.com/", 24 | "referrerPolicy": "strict-origin-when-cross-origin", 25 | "body": `{\"verifyType\":0,\"chainId\":7,\"address\":\"${wallet.address.toLocaleLowerCase()}\",\"message\":\"Sign this message to connect with ZKEX services.\\nNOTE: Please check this website ends with \\\"app.zkex.com\\\".\",\"signature\":\"${signature}\"}`, 26 | "method": "POST", 27 | "mode": "cors", 28 | "credentials": "include" 29 | }); 30 | const token = res.headers.get('access-token'); 31 | 32 | // res = await fetch("https://aws-test-1.zkex.com/api-v1/api/layer2/users/nonce", { 33 | // "headers": { 34 | // "accept": "application/json, text/plain, */*", 35 | // "accept-language": "zh-CN,zh;q=0.9", 36 | // "access-token": token, 37 | // "sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"", 38 | // "sec-ch-ua-mobile": "?0", 39 | // "sec-ch-ua-platform": "\"macOS\"", 40 | // "sec-fetch-dest": "empty", 41 | // "sec-fetch-mode": "cors", 42 | // "sec-fetch-site": "same-site" 43 | // }, 44 | // "referrer": "https://testnet.app.zkex.com/", 45 | // "referrerPolicy": "strict-origin-when-cross-origin", 46 | // "body": null, 47 | // "method": "GET", 48 | // "mode": "cors", 49 | // "credentials": "include" 50 | // }); 51 | 52 | const pepeCa = '0x1f524c32bb57107eed4a9383287fb008a5b10e1c'; 53 | let abi = ['function mint()'] as any; 54 | let contract = new ethers.Contract(pepeCa, abi, signer); 55 | await task(async () => { 56 | const tx = await contract.mint(await overrides(wallet.address),) 57 | logGasCost(await tx.wait()) 58 | }, { 59 | taskName: 'zkex_mint_pepe', 60 | walletAddr: wallet.address, 61 | }) 62 | 63 | // deposit 64 | const ca = '0x4931Cb9e5Fc58Be00C5Fd133D0961347f3406B86' 65 | abi = ['function depositERC20(address, uint104, address, uint8, bool)'] 66 | contract = new ethers.Contract(ca, abi, signer); 67 | await task(async () => { 68 | // approve 69 | const coin = await approveErc20(signer, pepeCa, '0x4931cb9e5fc58be00c5fd133d0961347f3406b86') 70 | const balance = await coin.balanceOf(wallet.address); 71 | const tx = await contract.depositERC20( 72 | '0x1f524C32Bb57107Eed4a9383287fb008a5B10e1c', 73 | balance, 74 | wallet.address, 75 | 1, 76 | false, 77 | await overrides(wallet.address), 78 | ) 79 | logGasCost(await tx.wait()) 80 | }, { 81 | taskName: 'zkex_deposit_pepe', 82 | walletAddr: wallet.address, 83 | }) 84 | } -------------------------------------------------------------------------------- /tasks/zkusd/index.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers'; 2 | import { lineaProvider as provider, overrides, logGasCost } from '../base'; 3 | import erc20abi from '@/const/erc20.json'; 4 | import { task } from '@/utils/utils'; 5 | 6 | export const run = async (wallet: ethers.Wallet) => { 7 | const signer = wallet.connect(provider); 8 | const abi = ['function deposit(uint) payable']; 9 | const contract = new ethers.Contract( 10 | '0xF242C576aa766712C431D7eE0B1b686A6C0bE7fD', 11 | abi, 12 | signer, 13 | ); 14 | const amount = ethers.utils.parseEther('0.001'); 15 | 16 | await task(async () => { 17 | const tx = await contract.deposit(amount, { 18 | ...(await overrides(wallet.address)), 19 | value: amount, 20 | }); 21 | logGasCost(await tx.wait()) 22 | 23 | }, { 24 | taskName: 'zkusd_deposit', 25 | walletAddr: wallet.address, 26 | }) 27 | 28 | const zkUSD = new ethers.Contract( 29 | '0x89f350931C8A0B81620c95cf8F1999e2d0Ce640F', 30 | erc20abi, 31 | signer, 32 | ); 33 | 34 | await task(async () => { 35 | const zkUSDAmount = await zkUSD.balanceOf(wallet.address); 36 | const transferAmount = ethers.utils.parseEther('1'); 37 | if (zkUSDAmount.lt(transferAmount)) { 38 | console.log(`zkUSD balance is not enough`); 39 | return; 40 | } 41 | const tx = await zkUSD.transfer( 42 | '0x00000000043DD264ca5E68e6853790E818e9Edb8', 43 | transferAmount, 44 | await overrides(wallet.address), 45 | ); 46 | logGasCost(await tx.wait()) 47 | }, { 48 | taskName: 'zkusd_transfer', 49 | walletAddr: wallet.address, 50 | }) 51 | }; 52 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "ts-node": { 3 | "swc": true 4 | }, 5 | "compilerOptions": { 6 | "target": "ESNext", 7 | "esModuleInterop": true, 8 | "resolveJsonModule": true, 9 | "moduleResolution": "node", 10 | "baseUrl": ".", 11 | "paths": { 12 | "@/*": ["./*"] 13 | } 14 | }, 15 | "include": ["**/*.ts", "**/*.cjs", "**/*.mjs", "global.d.ts"], 16 | "exclude": ["node_modules"] 17 | } 18 | -------------------------------------------------------------------------------- /utils/cli.ts: -------------------------------------------------------------------------------- 1 | import { parseArgs } from "node:util"; 2 | import { getTxtContent } from "./utils"; 3 | import path from "node:path"; 4 | 5 | type CallbackFn = (p: { 6 | action: string, 7 | startIdx: number, 8 | endIdx: number, 9 | pks: string[], 10 | }) => Promise; 11 | 12 | export const cli = async (cb: CallbackFn, run = true) => { 13 | if (!run) return; 14 | const { 15 | values: { action, batch }, 16 | } = parseArgs({ 17 | options: { 18 | /** 执行动作 */ 19 | action: { 20 | type: "string", 21 | short: "a", 22 | default: '', 23 | }, 24 | /** 任务并行切割分组 */ 25 | batch: { 26 | type: "string", 27 | short: "b", 28 | default: '', 29 | }, 30 | }, 31 | }); 32 | 33 | const keys = getTxtContent(path.resolve(__dirname, '../keys.txt')).filter(Boolean) as string[]; 34 | const [startIdx, endIdx] = [0, keys.length - 1]; 35 | // 将startIdx和endIdx的区间分成slice份 36 | const s = batch || 1; 37 | const sliceSize = Math.ceil((endIdx - startIdx + 1) / +s); 38 | const fns = []; 39 | for (let i = 0; i < +s; i++) { 40 | const start = startIdx + i * sliceSize; 41 | let end = startIdx + (i + 1) * sliceSize - 1; 42 | end = end >= endIdx ? endIdx : end; 43 | fns.push(async () => { 44 | await cb?.({ 45 | action, pks: keys, startIdx: start, endIdx: end 46 | }); 47 | }) 48 | } 49 | console.time('total'); 50 | await Promise.all(fns.map(fn => fn())); 51 | console.timeEnd('total'); 52 | } -------------------------------------------------------------------------------- /utils/utils.ts: -------------------------------------------------------------------------------- 1 | import { config } from "@/config"; 2 | import { readFileSync } from "fs"; 3 | import fse from 'fs-extra'; 4 | export { setTimeout as sleep } from 'node:timers/promises'; 5 | import path from "path"; 6 | 7 | /** 生成固定长度的字符串 */ 8 | export const randomString = (len: number) => { 9 | const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 10 | const maxPos = chars.length; 11 | let str = ''; 12 | for (let i = 0; i < len; i++) { 13 | str += chars.charAt(Math.floor(Math.random() * maxPos)); 14 | } 15 | return str; 16 | } 17 | 18 | export const randomLetterString = (len: number) => { 19 | const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 20 | const maxPos = chars.length; 21 | let str = ''; 22 | for (let i = 0; i < len; i++) { 23 | str += chars.charAt(Math.floor(Math.random() * maxPos)); 24 | } 25 | return str; 26 | } 27 | 28 | // 获取txt文件内容,移除空行和制表符并转换为数组 29 | export function getTxtContent(path: string) { 30 | const str = readFileSync(path, 'utf-8'); 31 | return str.split(/[(\r\n)\r\n]+/).filter(el => el); 32 | } 33 | 34 | /** 循环执行直到任务成功 */ 35 | export function loop(task) { 36 | return new Promise(async (resolve) => { 37 | while (true) { 38 | try { 39 | const r = await task(); 40 | resolve(r) 41 | break; 42 | } catch (error) { 43 | const msg = error?.reason || error?.message; 44 | if (msg === 'insufficient funds for intrinsic transaction cost') { 45 | console.log(`❌余额不足,跳过...`) 46 | resolve(false) 47 | break; 48 | } 49 | console.log(`[loop] ${msg}`) 50 | } 51 | } 52 | }) 53 | } 54 | 55 | 56 | /** 57 | * 任务执行模块 58 | * @param taskName 任务名称 59 | * @param walletAddr 钱包地址 60 | * @param cb 任务回调 61 | * @returns 62 | */ 63 | export async function task(cb, opts: { 64 | taskName: string, 65 | walletAddr: string, 66 | runCount?: number 67 | withLoop?: boolean 68 | force?: boolean 69 | }) { 70 | const { taskName, walletAddr, withLoop = config.loopUtilSuccess, force, runCount = 1 } = opts 71 | // 获取根目录logs文件下的task+walletAddr的json文件 72 | const logPath = path.join(process.cwd(), 'logs', walletAddr); 73 | const isExsit = await fse.pathExists(logPath) 74 | const text = `\n👽[任务:${taskName}]\n钱包:${walletAddr}\n`; 75 | let log = {}; 76 | // 确保log文件存在 77 | await loop(async () => { 78 | log = isExsit 79 | ? fse.readJSONSync(logPath) || {} 80 | : fse.writeJSONSync(logPath, {}); 81 | }) 82 | if (log?.[taskName] >= runCount && !force) { 83 | // return console.log(`👽[任务:${taskName}] 📝已执行,跳过...`) 84 | return 85 | } 86 | console.log(`${text}⌛️执行中...`) 87 | try { 88 | (withLoop ? await loop(cb) : await cb()); 89 | const count = (log?.[taskName] || 0) + 1; 90 | // 确保文件写入成功 91 | await loop(() => { 92 | fse.writeJSONSync(logPath, { ...log, [taskName]: count }); 93 | console.log(`✅[${taskName}]执行成功!`) 94 | }) 95 | } catch (error) { 96 | console.log(`❌[${taskName}]执行失败: ${error?.reason || error?.message}`) 97 | } 98 | } --------------------------------------------------------------------------------