├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .npmignore ├── .prettierignore ├── .prettierrc.js ├── .solcover.js ├── .solhint.json ├── .solhintignore ├── LICENSE ├── contracts ├── BoringRebase.sol ├── Greeter.sol ├── IBentoBox.sol ├── IERC20.sol ├── IGnosisSafe.sol ├── IMasterChef.sol ├── IMasterChefV2.sol ├── IStrategy.sol ├── IUniswapV2Factory.sol ├── IUniswapV2Pair.sol ├── IUniswapV2Router01.sol ├── IWethMaker.sol └── Multicall2.sol ├── hardhat.config.ts ├── package.json ├── scripts └── deploy.ts ├── test └── index.ts ├── tsconfig.json ├── web3 ├── App.vue ├── assets │ └── logo.png ├── classes │ ├── Account.ts │ ├── CoinGeckoAPI.ts │ ├── GnosisSafe.ts │ ├── Network.ts │ ├── NetworkConnector.ts │ ├── NetworkConnectors.ts │ ├── TokenManager.ts │ ├── Web3.ts │ └── types │ │ ├── IERC20.ts │ │ ├── IGnosisSafe.ts │ │ ├── IUniswapV2Factory.ts │ │ ├── IUniswapV2Pair.ts │ │ ├── IUniswapV2Router01.ts │ │ ├── Multicall2.ts │ │ ├── common.ts │ │ ├── factories │ │ ├── IERC20__factory.ts │ │ ├── IGnosisSafe__factory.ts │ │ ├── IUniswapV2Factory__factory.ts │ │ ├── IUniswapV2Pair__factory.ts │ │ ├── IUniswapV2Router01__factory.ts │ │ └── Multicall2__factory.ts │ │ └── index.ts ├── components │ ├── ExplorerAddress.vue │ ├── Menu.vue │ ├── SmartAddress.vue │ ├── TokenAmount.vue │ ├── USDAmount.vue │ └── Web3Button.vue ├── data.ts ├── dist │ ├── assets │ │ ├── index.46393096.css │ │ ├── index.ca3e8b12.js │ │ └── vendor.5efd37f7.js │ ├── favicon.ico │ ├── index.html │ └── manifest.json ├── env.d.ts ├── index.html ├── main.ts ├── pages │ ├── BentoBox.vue │ ├── BentoBoxes.vue │ ├── Chefs.vue │ ├── Factories.vue │ ├── Home.vue │ ├── KashiMasters.vue │ ├── Makers.vue │ ├── MultiSig.vue │ ├── MultiSigs.vue │ ├── Routers.vue │ └── WethMaker.vue ├── public │ ├── favicon.ico │ └── manifest.json ├── tsconfig.json ├── tsconfig.node.json └── vite.config.ts └── yarn.lock /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | artifacts 3 | cache 4 | coverage 5 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | browser: false, 4 | es2021: true, 5 | mocha: true, 6 | node: true, 7 | }, 8 | plugins: ["@typescript-eslint"], 9 | extends: ["standard", "plugin:prettier/recommended", "plugin:node/recommended"], 10 | parser: "@typescript-eslint/parser", 11 | parserOptions: { 12 | ecmaVersion: 12, 13 | }, 14 | rules: { 15 | "node/no-unsupported-features/es-syntax": ["error", { ignores: ["modules"] }], 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env 3 | coverage 4 | coverage.json 5 | typechain 6 | .husky 7 | .vscode 8 | gas_report.txt 9 | flat 10 | 11 | #Hardhat files 12 | cache 13 | artifacts 14 | typechain-types 15 | 16 | # Logs 17 | logs 18 | *.log 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | pnpm-debug.log* 23 | lerna-debug.log* 24 | 25 | node_modules 26 | dist-ssr 27 | *.local 28 | 29 | # Editor directories and files 30 | .vscode/* 31 | !.vscode/extensions.json 32 | .idea 33 | .DS_Store 34 | *.suo 35 | *.ntvs* 36 | *.njsproj 37 | *.sln 38 | *.sw? -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | hardhat.config.ts 2 | scripts 3 | test 4 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | artifacts 3 | cache 4 | coverage* 5 | gasReporterOutput.json 6 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | printWidth: 145, 3 | semi: false, 4 | trailingComma: "es5", 5 | tabWidth: 4, 6 | endOfLine: "lf", 7 | singleQuote: false, 8 | bracketSpacing: true, 9 | overrides: [ 10 | { 11 | files: "*.vue", 12 | options: { 13 | bracketSpacing: true, 14 | printWidth: 145, 15 | tabWidth: 4, 16 | useTabs: false, 17 | singleQuote: false, 18 | explicitTypes: "always", 19 | endOfLine: "lf", 20 | semi: false, 21 | }, 22 | }, 23 | { 24 | files: "*.sol", 25 | options: { 26 | bracketSpacing: true, 27 | printWidth: 145, 28 | tabWidth: 4, 29 | useTabs: false, 30 | singleQuote: false, 31 | explicitTypes: "always", 32 | endOfLine: "lf", 33 | }, 34 | }, 35 | { 36 | files: "*.js", 37 | options: { 38 | printWidth: 145, 39 | semi: false, 40 | trailingComma: "es5", 41 | tabWidth: 4, 42 | endOfLine: "lf", 43 | }, 44 | }, 45 | { 46 | files: "*.ts", 47 | options: { 48 | printWidth: 145, 49 | semi: false, 50 | trailingComma: "es5", 51 | tabWidth: 4, 52 | endOfLine: "lf", 53 | }, 54 | }, 55 | { 56 | files: "*.json", 57 | options: { 58 | printWidth: 145, 59 | semi: false, 60 | trailingComma: "es5", 61 | tabWidth: 4, 62 | endOfLine: "lf", 63 | }, 64 | }, 65 | ], 66 | } 67 | -------------------------------------------------------------------------------- /.solcover.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | skipFiles: ["mocks/", "interfaces/"], 3 | } 4 | -------------------------------------------------------------------------------- /.solhint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "solhint:recommended", 3 | "rules": { 4 | "compiler-version": ["error", "^0.8.0"], 5 | "func-visibility": ["warn", { "ignoreConstructors": true }] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.solhintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 BoringCrypto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /contracts/BoringRebase.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.9; 3 | 4 | struct Rebase { 5 | uint128 elastic; 6 | uint128 base; 7 | } 8 | -------------------------------------------------------------------------------- /contracts/Greeter.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | contract Greeter { 5 | string private greeting; 6 | 7 | constructor(string memory _greeting) { 8 | greeting = _greeting; 9 | } 10 | 11 | function greet() public view returns (string memory) { 12 | return greeting; 13 | } 14 | 15 | function setGreeting(string memory _greeting) public { 16 | greeting = _greeting; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /contracts/IBentoBox.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.9; 3 | pragma experimental ABIEncoderV2; 4 | 5 | import "./IERC20.sol"; 6 | import "./IStrategy.sol"; 7 | import "./BoringRebase.sol"; 8 | 9 | interface IBentoBoxV1 { 10 | event LogDeploy(address indexed masterContract, bytes data, address indexed cloneAddress); 11 | event LogDeposit(address indexed token, address indexed from, address indexed to, uint256 amount, uint256 share); 12 | event LogFlashLoan(address indexed borrower, address indexed token, uint256 amount, uint256 feeAmount, address indexed receiver); 13 | event LogRegisterProtocol(address indexed protocol); 14 | event LogSetMasterContractApproval(address indexed masterContract, address indexed user, bool approved); 15 | event LogStrategyDivest(address indexed token, uint256 amount); 16 | event LogStrategyInvest(address indexed token, uint256 amount); 17 | event LogStrategyLoss(address indexed token, uint256 amount); 18 | event LogStrategyProfit(address indexed token, uint256 amount); 19 | event LogStrategyQueued(address indexed token, address indexed strategy); 20 | event LogStrategySet(address indexed token, address indexed strategy); 21 | event LogStrategyTargetPercentage(address indexed token, uint256 targetPercentage); 22 | event LogTransfer(address indexed token, address indexed from, address indexed to, uint256 share); 23 | event LogWhiteListMasterContract(address indexed masterContract, bool approved); 24 | event LogWithdraw(address indexed token, address indexed from, address indexed to, uint256 amount, uint256 share); 25 | event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); 26 | 27 | function balanceOf(IERC20, address) external view returns (uint256); 28 | 29 | function batch(bytes[] calldata calls, bool revertOnFail) external payable returns (bool[] memory successes, bytes[] memory results); 30 | 31 | //function batchFlashLoan(IBatchFlashBorrower borrower, address[] calldata receivers, IERC20[] calldata tokens, uint256[] calldata amounts, bytes calldata data) external; 32 | function claimOwnership() external; 33 | 34 | function deploy( 35 | address masterContract, 36 | bytes calldata data, 37 | bool useCreate2 38 | ) external payable; 39 | 40 | function deposit( 41 | IERC20 token_, 42 | address from, 43 | address to, 44 | uint256 amount, 45 | uint256 share 46 | ) external payable returns (uint256 amountOut, uint256 shareOut); 47 | 48 | //function flashLoan(IFlashBorrower borrower, address receiver, IERC20 token, uint256 amount, bytes calldata data) external; 49 | function harvest( 50 | IERC20 token, 51 | bool balance, 52 | uint256 maxChangeAmount 53 | ) external; 54 | 55 | function masterContractApproved(address, address) external view returns (bool); 56 | 57 | function masterContractOf(address) external view returns (address); 58 | 59 | function nonces(address) external view returns (uint256); 60 | 61 | function owner() external view returns (address); 62 | 63 | function pendingOwner() external view returns (address); 64 | 65 | function pendingStrategy(IERC20) external view returns (IStrategy); 66 | 67 | function permitToken( 68 | IERC20 token, 69 | address from, 70 | address to, 71 | uint256 amount, 72 | uint256 deadline, 73 | uint8 v, 74 | bytes32 r, 75 | bytes32 s 76 | ) external; 77 | 78 | function registerProtocol() external; 79 | 80 | function setMasterContractApproval( 81 | address user, 82 | address masterContract, 83 | bool approved, 84 | uint8 v, 85 | bytes32 r, 86 | bytes32 s 87 | ) external; 88 | 89 | function setStrategy(IERC20 token, IStrategy newStrategy) external; 90 | 91 | function setStrategyTargetPercentage(IERC20 token, uint64 targetPercentage_) external; 92 | 93 | function strategy(IERC20) external view returns (IStrategy); 94 | 95 | function strategyData(IERC20) 96 | external 97 | view 98 | returns ( 99 | uint64 strategyStartDate, 100 | uint64 targetPercentage, 101 | uint128 balance 102 | ); 103 | 104 | function toAmount( 105 | IERC20 token, 106 | uint256 share, 107 | bool roundUp 108 | ) external view returns (uint256 amount); 109 | 110 | function toShare( 111 | IERC20 token, 112 | uint256 amount, 113 | bool roundUp 114 | ) external view returns (uint256 share); 115 | 116 | function totals(IERC20) external view returns (Rebase memory totals_); 117 | 118 | function transfer( 119 | IERC20 token, 120 | address from, 121 | address to, 122 | uint256 share 123 | ) external; 124 | 125 | function transferMultiple( 126 | IERC20 token, 127 | address from, 128 | address[] calldata tos, 129 | uint256[] calldata shares 130 | ) external; 131 | 132 | function transferOwnership( 133 | address newOwner, 134 | bool direct, 135 | bool renounce 136 | ) external; 137 | 138 | function whitelistMasterContract(address masterContract, bool approved) external; 139 | 140 | function whitelistedMasterContracts(address) external view returns (bool); 141 | 142 | function withdraw( 143 | IERC20 token_, 144 | address from, 145 | address to, 146 | uint256 amount, 147 | uint256 share 148 | ) external returns (uint256 amountOut, uint256 shareOut); 149 | } 150 | -------------------------------------------------------------------------------- /contracts/IERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.9; 3 | 4 | interface IERC20 { 5 | function name() external view returns (string memory); 6 | function symbol() external view returns (string memory); 7 | function decimals() external view returns (uint8); 8 | 9 | function totalSupply() external view returns (uint256); 10 | function balanceOf(address account) external view returns (uint256); 11 | function allowance(address owner, address spender) external view returns (uint256); 12 | function approve(address spender, uint256 amount) external returns (bool); 13 | 14 | event Transfer(address indexed from, address indexed to, uint256 value); 15 | event Approval(address indexed owner, address indexed spender, uint256 value); 16 | 17 | /// @notice EIP 2612 18 | function permit( 19 | address owner, 20 | address spender, 21 | uint256 value, 22 | uint256 deadline, 23 | uint8 v, 24 | bytes32 r, 25 | bytes32 s 26 | ) external; 27 | } 28 | -------------------------------------------------------------------------------- /contracts/IGnosisSafe.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.9; 3 | 4 | interface IGnosisSafe { 5 | function getOwners() external view returns (address[] memory); 6 | 7 | function getThreshold() external view returns (uint256); 8 | } 9 | -------------------------------------------------------------------------------- /contracts/IMasterChef.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.8.9; 2 | 3 | import "./IERC20.sol"; 4 | 5 | interface IOwnable { 6 | event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); 7 | 8 | function owner() external view returns (address); 9 | 10 | function renounceOwnership() external; 11 | 12 | function transferOwnership(address newOwner) external; 13 | } 14 | 15 | interface IMasterChef is IOwnable { 16 | struct UserInfo { 17 | uint256 amount; // How many LP tokens the user has provided. 18 | uint256 rewardDebt; // Reward debt. See explanation below. 19 | } 20 | 21 | struct PoolInfo { 22 | IERC20 lpToken; // Address of LP token contract. 23 | uint256 allocPoint; // How many allocation points assigned to this pool. SUSHIs to distribute per block. 24 | uint256 lastRewardBlock; // Last block number that SUSHIs distribution occurs. 25 | uint256 accSushiPerShare; // Accumulated SUSHIs per share, times 1e12. See below. 26 | } 27 | 28 | function sushi() external view returns (IERC20); 29 | 30 | function devaddr() external view returns (address); 31 | 32 | function bonusEndBlock() external view returns (uint256); 33 | 34 | function sushiPerBlock() external view returns (uint256); 35 | 36 | function sushiPerSecond() external view returns (uint256); // for MiniChef 37 | 38 | function BONUS_MULTIPLIER() external view returns (uint256); 39 | 40 | function migrator() external view returns (address); 41 | 42 | function poolInfo(uint256 poolId) external view returns (PoolInfo memory); 43 | 44 | function userInfo(uint256 poolId, address user) external view returns (UserInfo memory); 45 | 46 | function totalAllocPoint() external view returns (uint256); 47 | 48 | function startBlock() external view returns (uint256); 49 | 50 | event Deposit(address indexed user, uint256 indexed pid, uint256 amount); 51 | event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); 52 | event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); 53 | 54 | function poolLength() external view returns (uint256); 55 | 56 | function add( 57 | uint256 _allocPoint, 58 | IERC20 _lpToken, 59 | bool _withUpdate 60 | ) external; 61 | 62 | function set( 63 | uint256 _pid, 64 | uint256 _allocPoint, 65 | bool _withUpdate 66 | ) external; 67 | 68 | function setMigrator(address _migrator) external; 69 | 70 | function migrate(uint256 _pid) external; 71 | 72 | function getMultiplier(uint256 _from, uint256 _to) external view returns (uint256); 73 | 74 | function pendingSushi(uint256 _pid, address _user) external view returns (uint256); 75 | 76 | function massUpdatePools() external; 77 | 78 | function updatePool(uint256 _pid) external; 79 | 80 | function deposit(uint256 _pid, uint256 _amount) external; 81 | 82 | function withdraw(uint256 _pid, uint256 _amount) external; 83 | 84 | function emergencyWithdraw(uint256 _pid) external; 85 | 86 | function dev(address _devaddr) external; 87 | } 88 | -------------------------------------------------------------------------------- /contracts/IMasterChefV2.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.8.9; 2 | 3 | interface IMasterChefV2 { 4 | struct PoolInfo { 5 | uint128 accSushiPerShare; // Accumulated SUSHIs per share, times 1e12. See below. 6 | uint64 lastRewardBlock; // Last block number that SUSHIs distribution occurs. 7 | uint64 allocPoint; // How many allocation points assigned to this pool. SUSHIs to distribute per block. 8 | } 9 | 10 | function lpToken(uint256 poolId) external view returns (address); 11 | 12 | function poolInfo(uint256 poolId) external view returns (PoolInfo memory); 13 | } 14 | -------------------------------------------------------------------------------- /contracts/IStrategy.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.9; 3 | 4 | interface IStrategy { 5 | // Send the assets to the Strategy and call skim to invest them 6 | function skim(uint256 amount) external; 7 | 8 | // Harvest any profits made converted to the asset and pass them to the caller 9 | function harvest(uint256 balance, address sender) external returns (int256 amountAdded); 10 | 11 | // Withdraw assets. The returned amount can differ from the requested amount due to rounding. 12 | // The actualAmount should be very close to the amount. The difference should NOT be used to report a loss. That's what harvest is for. 13 | function withdraw(uint256 amount) external returns (uint256 actualAmount); 14 | 15 | // Withdraw all assets in the safest way possible. This shouldn't fail. 16 | function exit(uint256 balance) external returns (int256 amountAdded); 17 | } 18 | -------------------------------------------------------------------------------- /contracts/IUniswapV2Factory.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity 0.8.9; 4 | 5 | interface IUniswapV2Factory { 6 | event PairCreated(address indexed token0, address indexed token1, address pair, uint256); 7 | 8 | function feeTo() external view returns (address); 9 | 10 | function feeToSetter() external view returns (address); 11 | 12 | function migrator() external view returns (address); 13 | 14 | function getPair(address tokenA, address tokenB) external view returns (address pair); 15 | 16 | function allPairs(uint256) external view returns (address pair); 17 | 18 | function allPairsLength() external view returns (uint256); 19 | 20 | function createPair(address tokenA, address tokenB) external returns (address pair); 21 | 22 | function setFeeTo(address) external; 23 | 24 | function setFeeToSetter(address) external; 25 | 26 | function setMigrator(address) external; 27 | } 28 | -------------------------------------------------------------------------------- /contracts/IUniswapV2Pair.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.5.0; 2 | 3 | interface IUniswapV2Pair { 4 | event Approval(address indexed owner, address indexed spender, uint256 value); 5 | event Transfer(address indexed from, address indexed to, uint256 value); 6 | 7 | function name() external pure returns (string memory); 8 | 9 | function symbol() external pure returns (string memory); 10 | 11 | function decimals() external pure returns (uint8); 12 | 13 | function totalSupply() external view returns (uint256); 14 | 15 | function balanceOf(address owner) external view returns (uint256); 16 | 17 | function allowance(address owner, address spender) external view returns (uint256); 18 | 19 | function approve(address spender, uint256 value) external returns (bool); 20 | 21 | function transfer(address to, uint256 value) external returns (bool); 22 | 23 | function transferFrom( 24 | address from, 25 | address to, 26 | uint256 value 27 | ) external returns (bool); 28 | 29 | function DOMAIN_SEPARATOR() external view returns (bytes32); 30 | 31 | function PERMIT_TYPEHASH() external pure returns (bytes32); 32 | 33 | function nonces(address owner) external view returns (uint256); 34 | 35 | function permit( 36 | address owner, 37 | address spender, 38 | uint256 value, 39 | uint256 deadline, 40 | uint8 v, 41 | bytes32 r, 42 | bytes32 s 43 | ) external; 44 | 45 | event Mint(address indexed sender, uint256 amount0, uint256 amount1); 46 | event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to); 47 | event Swap(address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to); 48 | event Sync(uint112 reserve0, uint112 reserve1); 49 | 50 | function MINIMUM_LIQUIDITY() external pure returns (uint256); 51 | 52 | function factory() external view returns (address); 53 | 54 | function token0() external view returns (address); 55 | 56 | function token1() external view returns (address); 57 | 58 | function getReserves() 59 | external 60 | view 61 | returns ( 62 | uint112 reserve0, 63 | uint112 reserve1, 64 | uint32 blockTimestampLast 65 | ); 66 | 67 | function price0CumulativeLast() external view returns (uint256); 68 | 69 | function price1CumulativeLast() external view returns (uint256); 70 | 71 | function kLast() external view returns (uint256); 72 | 73 | function mint(address to) external returns (uint256 liquidity); 74 | 75 | function burn(address to) external returns (uint256 amount0, uint256 amount1); 76 | 77 | function swap( 78 | uint256 amount0Out, 79 | uint256 amount1Out, 80 | address to, 81 | bytes calldata data 82 | ) external; 83 | 84 | function skim(address to) external; 85 | 86 | function sync() external; 87 | 88 | function initialize(address, address) external; 89 | } 90 | -------------------------------------------------------------------------------- /contracts/IUniswapV2Router01.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity 0.8.9; 4 | 5 | interface IUniswapV2Router01 { 6 | function factory() external pure returns (address); 7 | 8 | function WETH() external pure returns (address); 9 | 10 | function addLiquidity( 11 | address tokenA, 12 | address tokenB, 13 | uint256 amountADesired, 14 | uint256 amountBDesired, 15 | uint256 amountAMin, 16 | uint256 amountBMin, 17 | address to, 18 | uint256 deadline 19 | ) 20 | external 21 | returns ( 22 | uint256 amountA, 23 | uint256 amountB, 24 | uint256 liquidity 25 | ); 26 | 27 | function addLiquidityETH( 28 | address token, 29 | uint256 amountTokenDesired, 30 | uint256 amountTokenMin, 31 | uint256 amountETHMin, 32 | address to, 33 | uint256 deadline 34 | ) 35 | external 36 | payable 37 | returns ( 38 | uint256 amountToken, 39 | uint256 amountETH, 40 | uint256 liquidity 41 | ); 42 | 43 | function removeLiquidity( 44 | address tokenA, 45 | address tokenB, 46 | uint256 liquidity, 47 | uint256 amountAMin, 48 | uint256 amountBMin, 49 | address to, 50 | uint256 deadline 51 | ) external returns (uint256 amountA, uint256 amountB); 52 | 53 | function removeLiquidityETH( 54 | address token, 55 | uint256 liquidity, 56 | uint256 amountTokenMin, 57 | uint256 amountETHMin, 58 | address to, 59 | uint256 deadline 60 | ) external returns (uint256 amountToken, uint256 amountETH); 61 | 62 | function removeLiquidityWithPermit( 63 | address tokenA, 64 | address tokenB, 65 | uint256 liquidity, 66 | uint256 amountAMin, 67 | uint256 amountBMin, 68 | address to, 69 | uint256 deadline, 70 | bool approveMax, 71 | uint8 v, 72 | bytes32 r, 73 | bytes32 s 74 | ) external returns (uint256 amountA, uint256 amountB); 75 | 76 | function removeLiquidityETHWithPermit( 77 | address token, 78 | uint256 liquidity, 79 | uint256 amountTokenMin, 80 | uint256 amountETHMin, 81 | address to, 82 | uint256 deadline, 83 | bool approveMax, 84 | uint8 v, 85 | bytes32 r, 86 | bytes32 s 87 | ) external returns (uint256 amountToken, uint256 amountETH); 88 | 89 | function swapExactTokensForTokens( 90 | uint256 amountIn, 91 | uint256 amountOutMin, 92 | address[] calldata path, 93 | address to, 94 | uint256 deadline 95 | ) external returns (uint256[] memory amounts); 96 | 97 | function swapTokensForExactTokens( 98 | uint256 amountOut, 99 | uint256 amountInMax, 100 | address[] calldata path, 101 | address to, 102 | uint256 deadline 103 | ) external returns (uint256[] memory amounts); 104 | 105 | function swapExactETHForTokens( 106 | uint256 amountOutMin, 107 | address[] calldata path, 108 | address to, 109 | uint256 deadline 110 | ) external payable returns (uint256[] memory amounts); 111 | 112 | function swapTokensForExactETH( 113 | uint256 amountOut, 114 | uint256 amountInMax, 115 | address[] calldata path, 116 | address to, 117 | uint256 deadline 118 | ) external returns (uint256[] memory amounts); 119 | 120 | function swapExactTokensForETH( 121 | uint256 amountIn, 122 | uint256 amountOutMin, 123 | address[] calldata path, 124 | address to, 125 | uint256 deadline 126 | ) external returns (uint256[] memory amounts); 127 | 128 | function swapETHForExactTokens( 129 | uint256 amountOut, 130 | address[] calldata path, 131 | address to, 132 | uint256 deadline 133 | ) external payable returns (uint256[] memory amounts); 134 | 135 | function quote( 136 | uint256 amountA, 137 | uint256 reserveA, 138 | uint256 reserveB 139 | ) external pure returns (uint256 amountB); 140 | 141 | function getAmountOut( 142 | uint256 amountIn, 143 | uint256 reserveIn, 144 | uint256 reserveOut 145 | ) external pure returns (uint256 amountOut); 146 | 147 | function getAmountIn( 148 | uint256 amountOut, 149 | uint256 reserveIn, 150 | uint256 reserveOut 151 | ) external pure returns (uint256 amountIn); 152 | 153 | function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); 154 | 155 | function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); 156 | } 157 | -------------------------------------------------------------------------------- /contracts/IWethMaker.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.9; 3 | 4 | interface IWethMaker { 5 | event SetTrusted(address indexed user, bool isTrusted); 6 | 7 | function bridges(address) external view returns (address); 8 | 9 | function owner() external view returns (address); 10 | 11 | function withdraw( 12 | address token, 13 | address to, 14 | uint256 _value 15 | ) external; 16 | 17 | function burnPairs( 18 | address[] calldata lpTokens, 19 | uint256[] calldata amounts, 20 | uint256[] calldata minimumOut0, 21 | uint256[] calldata minimumOut1 22 | ) external; 23 | } 24 | -------------------------------------------------------------------------------- /contracts/Multicall2.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: None 2 | pragma solidity 0.8.9; 3 | pragma experimental ABIEncoderV2; 4 | 5 | /// @title Multicall2 - Aggregate results from multiple read-only function calls 6 | /// @author Michael Elliot 7 | /// @author Joshua Levine 8 | /// @author Nick Johnson 9 | 10 | contract Multicall2 { 11 | struct Call { 12 | address target; 13 | bytes callData; 14 | } 15 | struct Result { 16 | bool success; 17 | bytes returnData; 18 | } 19 | 20 | function aggregate(Call[] memory calls) public returns (uint256 blockNumber, bytes[] memory returnData) { 21 | blockNumber = block.number; 22 | returnData = new bytes[](calls.length); 23 | for (uint256 i = 0; i < calls.length; i++) { 24 | (bool success, bytes memory ret) = calls[i].target.call(calls[i].callData); 25 | require(success, "Multicall aggregate: call failed"); 26 | returnData[i] = ret; 27 | } 28 | } 29 | 30 | function blockAndAggregate(Call[] memory calls) 31 | public 32 | returns ( 33 | uint256 blockNumber, 34 | bytes32 blockHash, 35 | Result[] memory returnData 36 | ) 37 | { 38 | (blockNumber, blockHash, returnData) = tryBlockAndAggregate(true, calls); 39 | } 40 | 41 | function getBlockHash(uint256 blockNumber) public view returns (bytes32 blockHash) { 42 | blockHash = blockhash(blockNumber); 43 | } 44 | 45 | function getBlockNumber() public view returns (uint256 blockNumber) { 46 | blockNumber = block.number; 47 | } 48 | 49 | function getCurrentBlockCoinbase() public view returns (address coinbase) { 50 | coinbase = block.coinbase; 51 | } 52 | 53 | function getCurrentBlockDifficulty() public view returns (uint256 difficulty) { 54 | difficulty = block.difficulty; 55 | } 56 | 57 | function getCurrentBlockGasLimit() public view returns (uint256 gaslimit) { 58 | gaslimit = block.gaslimit; 59 | } 60 | 61 | function getCurrentBlockTimestamp() public view returns (uint256 timestamp) { 62 | timestamp = block.timestamp; 63 | } 64 | 65 | function getEthBalance(address addr) public view returns (uint256 balance) { 66 | balance = addr.balance; 67 | } 68 | 69 | function getLastBlockHash() public view returns (bytes32 blockHash) { 70 | blockHash = blockhash(block.number - 1); 71 | } 72 | 73 | function tryAggregate(bool requireSuccess, Call[] memory calls) public returns (Result[] memory returnData) { 74 | returnData = new Result[](calls.length); 75 | for (uint256 i = 0; i < calls.length; i++) { 76 | (bool success, bytes memory ret) = calls[i].target.call(calls[i].callData); 77 | 78 | if (requireSuccess) { 79 | require(success, "Multicall2 aggregate: call failed"); 80 | } 81 | 82 | returnData[i] = Result(success, ret); 83 | } 84 | } 85 | 86 | function tryBlockAndAggregate(bool requireSuccess, Call[] memory calls) 87 | public 88 | returns ( 89 | uint256 blockNumber, 90 | bytes32 blockHash, 91 | Result[] memory returnData 92 | ) 93 | { 94 | blockNumber = block.number; 95 | blockHash = blockhash(block.number); 96 | returnData = tryAggregate(requireSuccess, calls); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /hardhat.config.ts: -------------------------------------------------------------------------------- 1 | if (process.env.DOTENV_PATH) { 2 | console.log("Using custom .env path:", process.env.DOTENV_PATH) 3 | require("dotenv").config({ path: process.env.DOTENV_PATH }) 4 | } else { 5 | require("dotenv") 6 | } 7 | 8 | import { HardhatUserConfig, task } from "hardhat/config" 9 | import "@nomiclabs/hardhat-etherscan" 10 | import "@nomiclabs/hardhat-waffle" 11 | import "@typechain/hardhat" 12 | import "hardhat-gas-reporter" 13 | import "hardhat-deploy" 14 | import "solidity-coverage" 15 | import "@boringcrypto/hardhat-framework" 16 | import { ethers, BigNumber } from "ethers" 17 | import requestSync from "sync-request" 18 | 19 | // This is a sample Hardhat task. To learn how to create your own go to 20 | // https://hardhat.org/guides/create-task.html 21 | task("accounts", "Prints the list of accounts", async (taskArgs, hre) => { 22 | const accounts = await hre.ethers.getSigners() 23 | 24 | for (const account of accounts) { 25 | console.log(account.address) 26 | } 27 | 28 | console.log(await hre.getNamedAccounts()) 29 | }) 30 | 31 | // You need to export an object to set up your config 32 | // Go to https://hardhat.org/config/ to learn more 33 | 34 | const last_block = process.env.ALCHEMY_API_KEY 35 | ? BigNumber.from( 36 | JSON.parse( 37 | requestSync("GET", "https://api.etherscan.io/api?module=proxy&action=eth_blockNumber&apikey=YourApiKeyToken").body as string 38 | ).result 39 | ) 40 | : BigNumber.from(0) 41 | 42 | const config: HardhatUserConfig = { 43 | solidity: "0.8.9", 44 | networks: { 45 | hardhat: Object.assign( 46 | { 47 | live: false, 48 | blockGasLimit: 30_000_000, 49 | }, 50 | process.env.ALCHEMY_API_KEY 51 | ? { 52 | forking: { 53 | url: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_API_KEY}`, 54 | blockNumber: last_block.toNumber() - 6, 55 | }, 56 | } 57 | : {} 58 | ), 59 | }, 60 | namedAccounts: { 61 | deployer: { default: 0 }, 62 | alice: { default: 1 }, 63 | bob: { default: 2 }, 64 | dave: { default: 3 }, 65 | eve: { default: 4 }, 66 | frank: { default: 5 }, 67 | grace: { default: 6 }, 68 | }, 69 | gasReporter: { 70 | enabled: true, 71 | currency: "USD", 72 | outputFile: "gas_report.txt", 73 | noColors: true, 74 | showMethodSig: true, 75 | coinmarketcap: process.env.COINMARKETCAP_API_KEY, 76 | }, 77 | etherscan: { 78 | apiKey: process.env.ETHERSCAN_API_KEY, 79 | }, 80 | } 81 | 82 | export default config 83 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "@boringcrypto/hardhat-framework": "file:../hardhat-framework", 4 | "@gnosis.pm/safe-apps-provider": "^0.10.1", 5 | "@gnosis.pm/safe-apps-sdk": "^7.0.0", 6 | "@popperjs/core": "2.10.2", 7 | "@walletconnect/web3-provider": "^1.7.3", 8 | "bootstrap": "^5.0.2", 9 | "bootstrap-icons": "^1.7.2", 10 | "bootstrap-vue-3": "^0.1.6", 11 | "bootswatch": "^5.1.0", 12 | "decimal.js-light": "^2.5.1", 13 | "vue-router": "^4.0.12", 14 | "web3": "^1.7.0" 15 | }, 16 | "scripts": { 17 | "compile": "hardhat compile", 18 | "test": "hardhat test", 19 | "coverage": "hardhat coverage && open-cli ./coverage/index.html", 20 | "prettier": "prettier --write *.js *.ts *.json test/**/*.ts web3/**/*.ts contracts/**/*.sol web3/**/*.vue", 21 | "flat": "hardhat run scripts/flat.ts Greeter.sol", 22 | "dev": "vite --config web3/vite.config.ts", 23 | "build": "vue-tsc --noEmit && vite build --config web3/vite.config.ts", 24 | "preview": "vite preview", 25 | "prepare": "husky install", 26 | "deploy": "git subtree push --prefix web3/dist origin gh-pages" 27 | }, 28 | "devDependencies": { 29 | "husky": "^7.0.0" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /scripts/deploy.ts: -------------------------------------------------------------------------------- 1 | // We require the Hardhat Runtime Environment explicitly here. This is optional 2 | // but useful for running the script in a standalone fashion through `node 4 | 5 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /web3/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boringcrypto/DAOView/4a269feb681e75ae8192fad2b0c5587f52e653d1/web3/assets/logo.png -------------------------------------------------------------------------------- /web3/classes/Account.ts: -------------------------------------------------------------------------------- 1 | import { Network } from "./Network" 2 | import { reactive, computed, ComputedRef } from "vue" 3 | import { ethers, BigNumber } from "ethers" 4 | import Web3 from "./Web3" 5 | import { connectors } from "./NetworkConnectors" 6 | import { IERC20__factory, IUniswapV2Pair__factory } from "./types" 7 | import { NetworkConnector } from "./NetworkConnector" 8 | import Decimal from "decimal.js-light" 9 | import { SLPToken, Token, tokens } from "./TokenManager" 10 | 11 | export class Account { 12 | address: string 13 | balances: { [tokenAddress: string]: BigNumber } = {} 14 | tokens: Token[] = [] 15 | 16 | constructor(address: string) { 17 | this.address = address 18 | } 19 | 20 | balance(token: Token) { 21 | return this.balances[token.address] || BigNumber.from(0) 22 | } 23 | 24 | value(token: Token) { 25 | return token.value(this.balances[token.address]) 26 | } 27 | 28 | get SLPTokens(): Token[] { 29 | return this.tokens.filter((token) => token.details instanceof SLPToken) 30 | } 31 | 32 | async loadNetworkBalances(network: Network) { 33 | console.log("Getting token balances", network, tokens.tokens[network]) 34 | const connector = new connectors[network]() 35 | const IERC20 = IERC20__factory.createInterface() 36 | Object.values(tokens.tokens[network] || []).forEach((token) => { 37 | connector.queue( 38 | IERC20__factory.connect(token.address, connector.provider).populateTransaction.balanceOf(this.address), 39 | IERC20, 40 | (result) => { 41 | const balance = result as BigNumber 42 | if (!balance.isZero() && !this.balances[token.address]) { 43 | this.tokens.push(token) 44 | this.balances[token.address] = balance 45 | } 46 | } 47 | ) 48 | }) 49 | await connector.call(100) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /web3/classes/CoinGeckoAPI.ts: -------------------------------------------------------------------------------- 1 | import Decimal from "decimal.js-light" 2 | import { NetworkConnector } from "./NetworkConnector" 3 | import { ERC20Token, SLPToken, Token, tokens } from "./TokenManager" 4 | 5 | export class CoinGecko { 6 | async getPrices(connector: NetworkConnector, _tokens: Token[]) { 7 | const addresses = _tokens.filter((token) => token.constructor === Token).map((token) => token.address) 8 | while (addresses.length) { 9 | try { 10 | const url = 11 | "https://api.coingecko.com/api/v3/simple/token_price/" + 12 | connector.coinGeckoId + 13 | "?contract_addresses=" + 14 | addresses.splice(0, 100).join(",") + 15 | "&vs_currencies=usd&include_market_cap=false&include_24hr_vol=false&include_24hr_change=false&include_last_updated_at=false" 16 | 17 | const result = await (await fetch(url)).json() 18 | for (const price of Object.entries(result)) { 19 | const token = tokens.get(connector.chainId, price[0]) 20 | ;(token.details as ERC20Token).price = new Decimal((price[1] as any).usd as string) 21 | } 22 | } catch (e) { 23 | console.log(e) 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /web3/classes/GnosisSafe.ts: -------------------------------------------------------------------------------- 1 | import { Network, NetworkConnector } from "./Web3" 2 | import { IGnosisSafe__factory, IGnosisSafe } from "./types" 3 | import { connectors } from "./NetworkConnectors" 4 | import { markRaw } from "vue" 5 | 6 | export type GnosisTokenBalances = { 7 | total: number 8 | tokens: { 9 | balance: string 10 | fiatBalance: string 11 | fiatConversion: string 12 | tokenInfo: { 13 | address: string 14 | decimals: number 15 | logoUri: string 16 | name: string 17 | symbol: string 18 | type: string 19 | } 20 | }[] 21 | } 22 | 23 | export class GnosisSafe { 24 | connector: NetworkConnector 25 | address: string 26 | safe: IGnosisSafe 27 | 28 | constructor(network: Network, address: string) { 29 | this.connector = markRaw(new connectors[network]()) 30 | this.address = address 31 | this.safe = markRaw(IGnosisSafe__factory.connect(address, this.connector.provider)) 32 | } 33 | 34 | get chainID() { 35 | const map = { 36 | [Network.ETHEREUM]: "eth", 37 | [Network.XDAI]: "gno", 38 | [Network.POLYGON]: "matic", 39 | [Network.BINANCE]: "bnb", 40 | [Network.ARBITRUM]: "arb1", 41 | [Network.AVALANCHE]: "avax", 42 | } 43 | return map[this.connector.chainId as keyof typeof map] 44 | } 45 | 46 | get transactionHistoryUrl() { 47 | if ( 48 | [Network.ETHEREUM, Network.XDAI, Network.POLYGON, Network.BINANCE, Network.ARBITRUM, Network.AVALANCHE].includes( 49 | this.connector.chainId 50 | ) 51 | ) { 52 | return "https://gnosis-safe.io/app/" + this.chainID + ":" + this.address + "/transactions/history" 53 | } 54 | if (this.connector.chainId == Network.HARMONY) { 55 | return "https://multisig.harmony.one/#/safes/" + this.address + "/transactions" 56 | } 57 | if (this.connector.chainId == Network.FANTOM) { 58 | return "https://safe.fantom.network/#/safes/" + this.address + "/transactions" 59 | } 60 | if (this.connector.chainId == Network.CELO) { 61 | return "https://ui.celo-safe.io/#/safes/" + this.address + "/transactions" 62 | } 63 | if (this.connector.chainId == Network.MOONBEAM) { 64 | return "https://multisig.moonbeam.network/moonbeam:" + this.address + "/transactions/history" 65 | } 66 | if (this.connector.chainId == Network.MOONBEAM_KUSAMA) { 67 | return "https://multisig.moonbeam.network/mriver:" + this.address + "/transactions/history" 68 | } 69 | if (this.connector.chainId == Network.FUSE) { 70 | return "https://safe.fuse.io/fuse:" + this.address + "/transactions/history" 71 | } 72 | } 73 | 74 | async getOwners() { 75 | return await this.safe.getOwners() 76 | } 77 | 78 | async getThreshold() { 79 | return (await this.safe.getThreshold()).toNumber() 80 | } 81 | 82 | async getTokenBalances(): Promise { 83 | if ( 84 | [ 85 | Network.ETHEREUM, 86 | Network.BINANCE, 87 | Network.ARBITRUM, 88 | Network.POLYGON, 89 | Network.XDAI, 90 | Network.FUSE, 91 | Network.CELO, 92 | Network.FANTOM, 93 | ].indexOf(this.connector.chainId) !== -1 94 | ) { 95 | let gnosis_balances_url = 96 | "https://safe-client.gnosis.io/v1/chains/" + 97 | this.connector.chainId + 98 | "/safes/" + 99 | this.address + 100 | "/balances/USD?exclude_spam=true&trusted=false" 101 | if (this.connector.chainId === Network.FUSE) { 102 | gnosis_balances_url = 103 | "https://safe-service.fuse.io/cgw/v1/chains/122/safes/" + this.address + "/balances/USD/?exclude_spam=true&trusted=false" 104 | } 105 | if (this.connector.chainId === Network.CELO) { 106 | gnosis_balances_url = 107 | "https://client-gateway.celo-safe.io/v1/chains/" + 108 | this.connector.chainId + 109 | "/safes/" + 110 | this.address + 111 | "/balances/USD?exclude_spam=true&trusted=false" 112 | } 113 | if (this.connector.chainId === Network.FANTOM) { 114 | gnosis_balances_url = 115 | "https://safe.fantom.network/v1/chains/" + 116 | this.connector.chainId + 117 | "/safes/" + 118 | this.address + 119 | "/balances/USD?exclude_spam=true&trusted=false" 120 | } 121 | const result = await (await fetch(gnosis_balances_url)).json() 122 | return { 123 | total: parseFloat(result.fiatTotal), 124 | tokens: result.items, 125 | } 126 | } 127 | 128 | if (this.connector.chainId === Network.HARMONY) { 129 | // API not working, get token list and scan 130 | return { 131 | total: 0, 132 | tokens: [], 133 | } 134 | } 135 | 136 | console.log("TODO:", this.connector.chainName) 137 | return { 138 | total: 0, 139 | tokens: [], 140 | } 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /web3/classes/Network.ts: -------------------------------------------------------------------------------- 1 | export enum Network { 2 | NONE = 0, 3 | ETHEREUM = 1, 4 | ROPSTEN = 3, 5 | KOVAN = 42, 6 | RINKEBY = 4, 7 | GOERLI = 5, 8 | OPTIMISM = 10, 9 | BINANCE = 56, 10 | OKEX_TEST = 65, 11 | OKEX = 66, 12 | BINANCE_TEST = 98, 13 | FUSE = 122, 14 | POLYGON = 137, 15 | POLYGON_TEST = 80001, 16 | XDAI = 100, 17 | HUOBI = 128, 18 | HUOBI_TEST = 256, 19 | ENERGY_WEB_CHAIN = 246, 20 | ENERGY_WEB_CHAIN_TEST = 73799, 21 | ARBITRUM = 42161, 22 | ARBITRUM_TEST = 421611, 23 | AVALANCHE = 43114, 24 | AVALANCHE_TEST = 43113, 25 | TOMO = 88, 26 | TOMO_TEST = 89, 27 | FANTOM = 250, 28 | FANTOM_TEST = 4002, 29 | MOONBEAM = 1284, 30 | MOONBEAM_KUSAMA = 1285, 31 | MOONBEAM_TEST = 1287, 32 | HARDHAT = 31337, 33 | CELO = 42220, 34 | HARMONY = 1666600000, 35 | HARMONY_TEST = 1666700000, 36 | PALM = 11297108109, 37 | TELOS = 40, 38 | BOBA = 288, 39 | AURORA = 1313161554, 40 | AURORA_TEST = 1313161555, 41 | AURORA_BETA = 1313161556, 42 | UBIQ = 8, 43 | UBIQ_TEST = 9, 44 | CRONOS = 25, 45 | KLAYTN = 8217, 46 | METIS = 1088, 47 | METIS_TEST = 588, 48 | } 49 | -------------------------------------------------------------------------------- /web3/classes/NetworkConnector.ts: -------------------------------------------------------------------------------- 1 | import { ethers, PopulatedTransaction, providers, ContractInterface, utils } from "ethers" 2 | import { Multicall2__factory } from "./types/factories/Multicall2__factory" 3 | import { Multicall2 } from "../../typechain-types" 4 | import { Network } from "./Network" 5 | 6 | interface AddEthereumChainParameter { 7 | chainId: string // A 0x-prefixed hexadecimal string 8 | chainName: string 9 | nativeCurrency: { 10 | name: string 11 | symbol: string // 2-6 characters long 12 | decimals: number 13 | } 14 | rpcUrls: string[] 15 | blockExplorerUrls?: string[] 16 | iconUrls?: string[] // Currently ignored. 17 | } 18 | 19 | type MulticallCallback = (result: any, transaction: PopulatedTransaction) => void 20 | type MulticallFailCallback = (transaction: PopulatedTransaction) => void 21 | 22 | type MulticallItem = { 23 | transactionPromise: Promise 24 | transaction?: PopulatedTransaction 25 | callback?: MulticallCallback 26 | failcallback?: MulticallFailCallback 27 | contractInterface?: utils.Interface 28 | } 29 | 30 | export class NetworkConnector { 31 | provider: providers.Provider 32 | static get chainId(): Network { 33 | return Network.NONE 34 | } 35 | static get chainName(): string { 36 | return "None" 37 | } 38 | static get nativeCurrency(): { name: string; symbol: string; decimals: number } { 39 | return { name: "None", symbol: "NONE", decimals: 18 } 40 | } 41 | static get rpcUrls(): string[] { 42 | return [] 43 | } 44 | static get blockExplorerUrls(): string[] { 45 | return [] 46 | } 47 | static get multiCallAddress(): string { 48 | return "" 49 | } 50 | static get chainParams(): AddEthereumChainParameter { 51 | return { 52 | chainId: ethers.utils.hexStripZeros(ethers.utils.hexlify(this.chainId)), 53 | chainName: this.chainName, 54 | nativeCurrency: this.nativeCurrency, 55 | rpcUrls: this.rpcUrls, 56 | blockExplorerUrls: this.blockExplorerUrls, 57 | } 58 | } 59 | 60 | static get coinGeckoId(): string { 61 | return "" 62 | } 63 | 64 | // Add the static values to each instance 65 | get type() { 66 | return this.constructor as typeof NetworkConnector 67 | } 68 | get chainId() { 69 | return this.type.chainId 70 | } 71 | get chainName() { 72 | return this.type.chainName 73 | } 74 | get nativeCurrency() { 75 | return this.type.nativeCurrency 76 | } 77 | get rpcUrls() { 78 | return this.type.rpcUrls 79 | } 80 | get blockExplorerUrls() { 81 | return this.type.blockExplorerUrls 82 | } 83 | get multiCallAddress() { 84 | return this.type.multiCallAddress 85 | } 86 | get coinGeckoId() { 87 | return this.type.coinGeckoId 88 | } 89 | 90 | constructor(provider?: providers.Provider | null) { 91 | if (provider) { 92 | // Use provided provider (for instance injected MetaMask web3) 93 | this.provider = provider 94 | } else { 95 | // or create one using the RPC Url 96 | this.provider = new providers.StaticJsonRpcProvider({ 97 | url: this.rpcUrls[0], 98 | }) 99 | } 100 | } 101 | 102 | items: MulticallItem[] = [] 103 | 104 | queue( 105 | transactionPromise: Promise, 106 | contractInterface?: utils.Interface, 107 | callback?: MulticallCallback, 108 | failcallback?: MulticallFailCallback 109 | ) { 110 | this.items.push({ transactionPromise, contractInterface, callback, failcallback }) 111 | } 112 | 113 | async call(batchSize: number = 0) { 114 | const results: any[] = [] 115 | 116 | while (this.items.length) { 117 | const contract = Multicall2__factory.connect(this.multiCallAddress, this.provider) 118 | 119 | const batch = this.items.splice(0, batchSize || this.items.length) 120 | for (let i in batch) { 121 | batch[i].transaction = await batch[i].transactionPromise 122 | } 123 | 124 | const calls: Multicall2.CallStruct[] = batch.map((item) => { 125 | return { 126 | target: item.transaction!.to!, 127 | callData: item.transaction!.data!, 128 | } 129 | }) 130 | const callResult = await contract.callStatic.tryAggregate(false, calls) 131 | batch.forEach((item, i) => { 132 | if (callResult[i].success) { 133 | let result: any = callResult[i].returnData 134 | if (item.contractInterface) { 135 | try { 136 | result = item.contractInterface.decodeFunctionResult( 137 | item.contractInterface.parseTransaction({ data: item.transaction?.data || "" }).name, 138 | callResult[i].returnData 139 | ) 140 | } catch {} 141 | } 142 | 143 | if (item.callback) { 144 | item.callback(result.length === 1 ? result[0] : result, item.transaction!) 145 | } 146 | results.push(result.length === 1 ? result[0] : result) 147 | } else { 148 | if (item.failcallback) { 149 | item.failcallback(item.transaction!) 150 | } 151 | console.log("Fail") 152 | results.push(new Error("Failed")) 153 | } 154 | }) 155 | } 156 | return results 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /web3/classes/TokenManager.ts: -------------------------------------------------------------------------------- 1 | import { Network } from "./Network" 2 | import { reactive, computed, ComputedRef } from "vue" 3 | import { ethers, BigNumber } from "ethers" 4 | import Web3 from "./Web3" 5 | import { connectors } from "./NetworkConnectors" 6 | import { IERC20__factory, IUniswapV2Pair__factory } from "./types" 7 | import { NetworkConnector } from "./NetworkConnector" 8 | import Decimal from "decimal.js-light" 9 | 10 | export class Token { 11 | network: Network 12 | address: string 13 | loaded = false 14 | 15 | details: BaseToken 16 | 17 | constructor(network: Network, address: string) { 18 | this.network = network 19 | this.address = address 20 | this.details = new ERC20Token(this) 21 | } 22 | 23 | get type() { 24 | return this.details.type 25 | } 26 | 27 | get name() { 28 | return this.details.name 29 | } 30 | 31 | get symbol() { 32 | return this.details.symbol 33 | } 34 | 35 | get decimals() { 36 | return this.details.decimals 37 | } 38 | 39 | get price() { 40 | return this.details.price 41 | } 42 | 43 | value(balance: BigNumber) { 44 | return this.details.value(balance) 45 | } 46 | } 47 | 48 | class BaseToken { 49 | token: Token 50 | type = "" 51 | 52 | constructor(token: Token) { 53 | this.token = token 54 | } 55 | 56 | get name() { 57 | return "" 58 | } 59 | 60 | get symbol() { 61 | return "" 62 | } 63 | 64 | get decimals() { 65 | return 0 66 | } 67 | 68 | get price() { 69 | return new Decimal(0) 70 | } 71 | 72 | value(balance: BigNumber) { 73 | return new Decimal(0) 74 | } 75 | } 76 | 77 | export class ERC20Token extends BaseToken { 78 | type = "ERC20" 79 | _name = "" 80 | _symbol = "" 81 | _decimals = 0 82 | _price = new Decimal(0) 83 | 84 | get name() { 85 | return this._name 86 | } 87 | 88 | set name(value) { 89 | this._name = value 90 | } 91 | 92 | get symbol() { 93 | return this._symbol 94 | } 95 | 96 | set symbol(value) { 97 | this._symbol = value 98 | } 99 | 100 | get decimals() { 101 | return this._decimals 102 | } 103 | 104 | set decimals(value) { 105 | this._decimals = value 106 | } 107 | 108 | get price() { 109 | return this._price 110 | } 111 | 112 | set price(value) { 113 | this._price = value 114 | } 115 | 116 | value(balance: BigNumber) { 117 | if (this.price) { 118 | return balance.toDec(this.decimals).mul(this.price) 119 | } else { 120 | return new Decimal(0) 121 | } 122 | } 123 | } 124 | 125 | export class SLPToken extends BaseToken { 126 | type = "SLP" 127 | token0?: Token 128 | token1?: Token 129 | totalSupply?: BigNumber 130 | reserve0?: BigNumber 131 | reserve1?: BigNumber 132 | 133 | get name() { 134 | return this.token0 && this.token1 ? "SushiSwap " + this.token0.symbol + "/" + this.token1.symbol + " LP (SLP)" : "Sushiswap LP Token" 135 | } 136 | 137 | get symbol() { 138 | return this.token0 && this.token1 ? this.token0.symbol + "-" + this.token1.symbol + " SLP" : "SLP" 139 | } 140 | 141 | get decimals() { 142 | return 18 143 | } 144 | 145 | balance0(balance: BigNumber) { 146 | if (this.token0 && this.totalSupply && !this.totalSupply.isZero() && balance && this.reserve0) { 147 | return balance.mul(this.reserve0).div(this.totalSupply) 148 | } else { 149 | return BigNumber.from(0) 150 | } 151 | } 152 | 153 | balance1(balance: BigNumber) { 154 | if (this.token1 && this.totalSupply && !this.totalSupply.isZero() && balance && this.reserve1) { 155 | return balance.mul(this.reserve1).div(this.totalSupply) 156 | } else { 157 | return BigNumber.from(0) 158 | } 159 | } 160 | 161 | value0(balance: BigNumber) { 162 | if (this.token0 && this.token0.price) { 163 | return this.balance0(balance).toDec(this.token0.decimals).mul(this.token0.price) 164 | } else { 165 | return new Decimal(0) 166 | } 167 | } 168 | 169 | value1(balance: BigNumber) { 170 | if (this.token1 && this.token1.price) { 171 | return this.balance1(balance).toDec(this.token1.decimals).mul(this.token1.price) 172 | } else { 173 | return new Decimal(0) 174 | } 175 | } 176 | 177 | value(balance: BigNumber) { 178 | return this.value0(balance).isZero() 179 | ? this.value1(balance).mul(2) 180 | : this.value1(balance).isZero() 181 | ? this.value0(balance).mul(2) 182 | : this.value0(balance).add(this.value1(balance)) 183 | } 184 | } 185 | 186 | class TokenManager { 187 | tokenList: Token[] = reactive([]) 188 | tokens: { [network in Network]?: { [address: string]: Token } } = reactive({}) 189 | web3?: Web3 190 | 191 | constructor() { 192 | this.load() 193 | } 194 | 195 | get(network: Network, address: string) { 196 | address = ethers.utils.getAddress(address) 197 | if (!this.tokens[network]) { 198 | this.tokens[network] = {} 199 | } 200 | if (!this.tokens[network]![address]) { 201 | const token = new Token(network, address) 202 | this.tokenList.push(token) 203 | this.tokens[network]![address] = token 204 | } 205 | return this.tokens[network]![address] 206 | } 207 | 208 | async _handleToLoad( 209 | filter: (token: Token) => boolean, 210 | handle: (token: Token, connector: NetworkConnector) => void, 211 | after?: (token: Token) => void, 212 | toLoad?: Token[] 213 | ) { 214 | if (toLoad) { 215 | toLoad = [...new Set(toLoad)] 216 | } else { 217 | toLoad = this.tokenList 218 | } 219 | toLoad = toLoad.filter(filter) 220 | const loadsByNetwork: { [network in Network]?: Token[] } = {} 221 | toLoad.forEach((token) => { 222 | if (!loadsByNetwork[token.network]) { 223 | loadsByNetwork[token.network] = [] 224 | } 225 | loadsByNetwork[token.network]?.push(token) 226 | }) 227 | for (const tokensToLoad of Object.values(loadsByNetwork).filter((t) => t.length)) { 228 | const connector = new connectors[tokensToLoad[0].network]() 229 | 230 | for (const token of tokensToLoad) { 231 | handle(token, connector) 232 | } 233 | 234 | await connector.call(100) 235 | 236 | if (after) { 237 | for (const token of tokensToLoad) { 238 | after(token) 239 | } 240 | } 241 | } 242 | } 243 | 244 | queueERC20(token: Token, connector: NetworkConnector) { 245 | if (token.loaded) { 246 | return 247 | } 248 | const contract = IERC20__factory.connect(token.address, connector.provider) 249 | connector.queue( 250 | contract.populateTransaction.name(), 251 | IERC20__factory.createInterface(), 252 | (result) => ((token.details as ERC20Token).name = result), 253 | () => console.log(connector.chainName, token.address, "Name") 254 | ) 255 | connector.queue( 256 | contract.populateTransaction.symbol(), 257 | IERC20__factory.createInterface(), 258 | (result) => ((token.details as ERC20Token).symbol = result), 259 | () => console.log(connector.chainName, token.address, "Symbol") 260 | ) 261 | connector.queue( 262 | contract.populateTransaction.decimals(), 263 | IERC20__factory.createInterface(), 264 | (result) => { 265 | ;(token.details as ERC20Token).decimals = result 266 | if (token.name === "SushiSwap LP Token" && token.symbol === "SLP" && token.decimals === 18) { 267 | token.details = new SLPToken(token) 268 | this.queueSLP(token, connector) 269 | token.loaded = true 270 | } 271 | }, 272 | () => console.log(connector.chainName, token.address, "Decimals") 273 | ) 274 | } 275 | 276 | queueSLP(token: Token, connector: NetworkConnector) { 277 | if (token.loaded) { 278 | return 279 | } 280 | const pair = IUniswapV2Pair__factory.connect(token.address, connector.provider) 281 | connector.queue(pair.populateTransaction.token0(), IUniswapV2Pair__factory.createInterface(), (result) => { 282 | ;(token.details as SLPToken).token0 = this.get(connector.chainId, result) 283 | this.queueERC20((token.details as SLPToken).token0!, connector) 284 | }) 285 | connector.queue(pair.populateTransaction.token1(), IUniswapV2Pair__factory.createInterface(), (result) => { 286 | ;(token.details as SLPToken).token1 = this.get(connector.chainId, result) 287 | this.queueERC20((token.details as SLPToken).token1!, connector) 288 | token.loaded = true 289 | }) 290 | } 291 | 292 | async loadInfo(toLoad?: Token[]) { 293 | await this._handleToLoad( 294 | (token) => !token.loaded, 295 | (token, connector) => { 296 | if (token.details instanceof SLPToken) { 297 | this.queueSLP(token, connector) 298 | } else { 299 | this.queueERC20(token, connector) 300 | } 301 | }, 302 | (token) => (token.loaded = true), 303 | toLoad 304 | ) 305 | 306 | this.save() 307 | } 308 | 309 | async loadSLPInfo(toLoad?: Token[]) { 310 | await this._handleToLoad( 311 | (token) => token.details instanceof SLPToken, 312 | (token, connector) => { 313 | const pair = IUniswapV2Pair__factory.connect(token.address, connector.provider) 314 | connector.queue(pair.populateTransaction.getReserves(), IUniswapV2Pair__factory.createInterface(), (result) => { 315 | ;(token.details as SLPToken).reserve0 = result.reserve0 316 | ;(token.details as SLPToken).reserve1 = result.reserve1 317 | }) 318 | connector.queue( 319 | pair.populateTransaction.totalSupply(), 320 | IUniswapV2Pair__factory.createInterface(), 321 | (result) => ((token.details as SLPToken).totalSupply = result) 322 | ) 323 | }, 324 | undefined, 325 | toLoad 326 | ) 327 | } 328 | 329 | load() { 330 | const data = JSON.parse(localStorage.getItem("Tokens") || "[]") 331 | for (const token of data) { 332 | const t: Token | SLPToken = this.get(token.network, token.address) 333 | t.network = token.network 334 | t.address = token.address 335 | t.loaded = token.loaded 336 | 337 | if (token.type === "SLP") { 338 | t.details = new SLPToken(token) 339 | ;(t.details as SLPToken).token0 = this.get(token.network, token.token0) 340 | ;(t.details as SLPToken).token1 = this.get(token.network, token.token1) 341 | } else { 342 | ;(t.details as ERC20Token).name = token.name 343 | ;(t.details as ERC20Token).symbol = token.symbol 344 | ;(t.details as ERC20Token).decimals = token.decimals 345 | } 346 | } 347 | } 348 | 349 | save() { 350 | localStorage.setItem( 351 | "Tokens", 352 | JSON.stringify( 353 | this.tokenList.map((token) => { 354 | if (token.details instanceof SLPToken) { 355 | return { 356 | type: token.type, 357 | network: token.network, 358 | address: token.address, 359 | loaded: token.loaded, 360 | 361 | token0: (token.details as SLPToken).token0?.address, 362 | token1: (token.details as SLPToken).token1?.address, 363 | } 364 | } else { 365 | return { 366 | type: token.type, 367 | network: token.network, 368 | address: token.address, 369 | loaded: token.loaded, 370 | 371 | name: token.name, 372 | symbol: token.symbol, 373 | decimals: token.decimals, 374 | } 375 | } 376 | }) 377 | ) 378 | ) 379 | } 380 | } 381 | 382 | const tokens = new TokenManager() 383 | 384 | export { tokens } 385 | -------------------------------------------------------------------------------- /web3/classes/Web3.ts: -------------------------------------------------------------------------------- 1 | import { ProviderMessage, ProviderRpcError, ProviderConnectInfo } from "hardhat/types" 2 | import { BigNumber, ethers } from "ethers" 3 | import { computed, ComputedRef, markRaw } from "vue" 4 | import { NetworkConnector } from "./NetworkConnector" 5 | import { Network } from "./Network" 6 | import { connectors } from "./NetworkConnectors" 7 | import SafeAppsSDK, { SafeInfo } from "@gnosis.pm/safe-apps-sdk" 8 | import { SafeAppProvider } from "@gnosis.pm/safe-apps-provider" 9 | 10 | export interface EthereumEvent { 11 | connect: ProviderConnectInfo 12 | disconnect: ProviderRpcError 13 | accountsChanged: Array 14 | chainChanged: string 15 | message: ProviderMessage 16 | } 17 | 18 | type EventKeys = keyof EthereumEvent 19 | type EventHandler = (event: EthereumEvent[K]) => void 20 | 21 | export interface Ethereumish { 22 | autoRefreshOnNetworkChange: boolean 23 | chainId: string 24 | isMetaMask?: boolean 25 | isStatus?: boolean 26 | networkVersion: string 27 | selectedAddress: any 28 | 29 | on(event: K, eventHandler: EventHandler): void 30 | enable(): Promise 31 | request?: (request: { method: string; params?: Array }) => Promise 32 | } 33 | 34 | declare global { 35 | interface Window { 36 | ethereum: Ethereumish 37 | } 38 | } 39 | 40 | interface ConnectInfo { 41 | chainId: string 42 | } 43 | 44 | enum WalletProvider { 45 | METAMASK = 1, 46 | WALLETCONNECT = 2, 47 | GNOSIS_SAFE = 3, 48 | } 49 | 50 | class MetaMaskProvider { 51 | provider?: ethers.providers.JsonRpcProvider 52 | 53 | detect(): boolean { 54 | return window.ethereum && window.ethereum.request && window.ethereum.isMetaMask ? true : false 55 | } 56 | 57 | connect(force: boolean) {} 58 | } 59 | 60 | class GnosisSafeAppProvider { 61 | provider?: ethers.providers.Web3Provider 62 | 63 | async detect(): Promise { 64 | console.log("Gnosis") 65 | 66 | const sdk = new SafeAppsSDK() 67 | const safe = await sdk.safe.getInfo() 68 | 69 | console.log(safe) 70 | const provider = new ethers.providers.Web3Provider(new SafeAppProvider(safe, sdk)) 71 | console.log(await provider.getBlockNumber()) 72 | return false 73 | } 74 | 75 | connect(force: boolean) {} 76 | } 77 | 78 | export default class Web3 { 79 | name = "Loading..." 80 | walletProvider: WalletProvider = WalletProvider.METAMASK 81 | connected = false 82 | chainId = Network.NONE 83 | address = "" 84 | addresses = [] as string[] 85 | block = 0 86 | provider?: ethers.providers.JsonRpcProvider 87 | gnosis?: ethers.providers.Web3Provider 88 | safe?: SafeInfo 89 | update?: ComputedRef 90 | connector?: ComputedRef 91 | 92 | connect() { 93 | if (this.connected && window.ethereum.request) { 94 | window.ethereum.request({ method: "eth_requestAccounts" }) 95 | } 96 | } 97 | 98 | switch(chain: Network) { 99 | console.log(chain, window.ethereum) 100 | if (window.ethereum && window.ethereum.request) { 101 | window.ethereum 102 | .request({ 103 | method: "wallet_switchEthereumChain", 104 | params: [{ chainId: ethers.utils.hexStripZeros(ethers.utils.hexlify(chain)) }], 105 | }) 106 | .catch((error: ProviderRpcError) => { 107 | console.log(error) 108 | if (error.code == 4902 && window.ethereum && window.ethereum.request) { 109 | window.ethereum.request({ 110 | method: "wallet_addEthereumChain", 111 | params: [connectors[chain].chainParams], 112 | }) 113 | } 114 | }) 115 | } 116 | } 117 | 118 | setup() { 119 | const sdk = new SafeAppsSDK() 120 | sdk.safe.getInfo().then((safe) => { 121 | console.log("Gnosis safe found:", safe) 122 | this.safe = safe 123 | this.gnosis = markRaw(new ethers.providers.Web3Provider(new SafeAppProvider(safe, sdk))) 124 | }) 125 | 126 | this.update = computed(() => this.chainId + "|" + this.block + "|" + this.address) 127 | this.connector = computed(() => (this.provider ? new connectors[this.chainId](this.provider) : null)) 128 | if (window.ethereum && window.ethereum.request) { 129 | this.provider = markRaw(new ethers.providers.Web3Provider(window.ethereum)) 130 | if (window.ethereum.isMetaMask) { 131 | this.name = "MetaMask" 132 | } else { 133 | this.name = "Other" 134 | } 135 | 136 | window.ethereum.autoRefreshOnNetworkChange = false 137 | const handleBlock = (blockNumber: number) => { 138 | this.block = blockNumber 139 | } 140 | const handleChainChanged = (newChainId: string) => { 141 | this.chainId = Number(BigNumber.from(newChainId)) 142 | this.connected = true 143 | this.provider?.off("block") 144 | this.provider = markRaw(new ethers.providers.Web3Provider(window.ethereum)) 145 | this.provider.on("block", handleBlock) 146 | } 147 | const handleConnect = (info: ConnectInfo) => { 148 | handleChainChanged(info.chainId) 149 | } 150 | const handleAccountsChanged = (newAddresses: string[] | undefined) => { 151 | this.addresses = newAddresses || [] 152 | if (newAddresses && newAddresses.length) { 153 | this.address = newAddresses[0] 154 | } else { 155 | this.address = "" 156 | } 157 | } 158 | 159 | window.ethereum.on("accountsChanged", handleAccountsChanged) 160 | window.ethereum.on("chainChanged", handleChainChanged) 161 | window.ethereum.on("connect", handleConnect) 162 | window.ethereum.on("disconnect", (error: ProviderRpcError) => { 163 | this.connected = false 164 | this.block = 0 165 | }) 166 | this.provider.on("block", handleBlock) 167 | 168 | window.ethereum 169 | .request({ method: "eth_accounts" }) 170 | .then((addresses: string[]) => { 171 | handleAccountsChanged(addresses) 172 | handleConnect({ chainId: window.ethereum.chainId }) 173 | }) 174 | .catch((error: ProviderRpcError) => { 175 | console.log("Error", error) 176 | }) 177 | } else { 178 | this.name = "None" 179 | } 180 | } 181 | } 182 | 183 | export { Network, NetworkConnector, connectors } 184 | -------------------------------------------------------------------------------- /web3/classes/types/IERC20.ts: -------------------------------------------------------------------------------- 1 | /* Autogenerated file. Do not edit manually. */ 2 | /* tslint:disable */ 3 | /* eslint-disable */ 4 | import { 5 | BaseContract, 6 | BigNumber, 7 | BigNumberish, 8 | BytesLike, 9 | CallOverrides, 10 | ContractTransaction, 11 | Overrides, 12 | PopulatedTransaction, 13 | Signer, 14 | utils, 15 | } from "ethers" 16 | import { FunctionFragment, Result, EventFragment } from "@ethersproject/abi" 17 | import { Listener, Provider } from "@ethersproject/providers" 18 | import { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from "./common" 19 | 20 | export interface IERC20Interface extends utils.Interface { 21 | contractName: "IERC20" 22 | functions: { 23 | "allowance(address,address)": FunctionFragment 24 | "approve(address,uint256)": FunctionFragment 25 | "balanceOf(address)": FunctionFragment 26 | "decimals()": FunctionFragment 27 | "name()": FunctionFragment 28 | "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)": FunctionFragment 29 | "symbol()": FunctionFragment 30 | "totalSupply()": FunctionFragment 31 | } 32 | 33 | encodeFunctionData(functionFragment: "allowance", values: [string, string]): string 34 | encodeFunctionData(functionFragment: "approve", values: [string, BigNumberish]): string 35 | encodeFunctionData(functionFragment: "balanceOf", values: [string]): string 36 | encodeFunctionData(functionFragment: "decimals", values?: undefined): string 37 | encodeFunctionData(functionFragment: "name", values?: undefined): string 38 | encodeFunctionData( 39 | functionFragment: "permit", 40 | values: [string, string, BigNumberish, BigNumberish, BigNumberish, BytesLike, BytesLike] 41 | ): string 42 | encodeFunctionData(functionFragment: "symbol", values?: undefined): string 43 | encodeFunctionData(functionFragment: "totalSupply", values?: undefined): string 44 | 45 | decodeFunctionResult(functionFragment: "allowance", data: BytesLike): Result 46 | decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result 47 | decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result 48 | decodeFunctionResult(functionFragment: "decimals", data: BytesLike): Result 49 | decodeFunctionResult(functionFragment: "name", data: BytesLike): Result 50 | decodeFunctionResult(functionFragment: "permit", data: BytesLike): Result 51 | decodeFunctionResult(functionFragment: "symbol", data: BytesLike): Result 52 | decodeFunctionResult(functionFragment: "totalSupply", data: BytesLike): Result 53 | 54 | events: { 55 | "Approval(address,address,uint256)": EventFragment 56 | "Transfer(address,address,uint256)": EventFragment 57 | } 58 | 59 | getEvent(nameOrSignatureOrTopic: "Approval"): EventFragment 60 | getEvent(nameOrSignatureOrTopic: "Transfer"): EventFragment 61 | } 62 | 63 | export type ApprovalEvent = TypedEvent<[string, string, BigNumber], { owner: string; spender: string; value: BigNumber }> 64 | 65 | export type ApprovalEventFilter = TypedEventFilter 66 | 67 | export type TransferEvent = TypedEvent<[string, string, BigNumber], { from: string; to: string; value: BigNumber }> 68 | 69 | export type TransferEventFilter = TypedEventFilter 70 | 71 | export interface IERC20 extends BaseContract { 72 | contractName: "IERC20" 73 | connect(signerOrProvider: Signer | Provider | string): this 74 | attach(addressOrName: string): this 75 | deployed(): Promise 76 | 77 | interface: IERC20Interface 78 | 79 | queryFilter( 80 | event: TypedEventFilter, 81 | fromBlockOrBlockhash?: string | number | undefined, 82 | toBlock?: string | number | undefined 83 | ): Promise> 84 | 85 | listeners(eventFilter?: TypedEventFilter): Array> 86 | listeners(eventName?: string): Array 87 | removeAllListeners(eventFilter: TypedEventFilter): this 88 | removeAllListeners(eventName?: string): this 89 | off: OnEvent 90 | on: OnEvent 91 | once: OnEvent 92 | removeListener: OnEvent 93 | 94 | functions: { 95 | allowance(owner: string, spender: string, overrides?: CallOverrides): Promise<[BigNumber]> 96 | 97 | approve(spender: string, amount: BigNumberish, overrides?: Overrides & { from?: string | Promise }): Promise 98 | 99 | balanceOf(account: string, overrides?: CallOverrides): Promise<[BigNumber]> 100 | 101 | decimals(overrides?: CallOverrides): Promise<[number]> 102 | 103 | name(overrides?: CallOverrides): Promise<[string]> 104 | 105 | permit( 106 | owner: string, 107 | spender: string, 108 | value: BigNumberish, 109 | deadline: BigNumberish, 110 | v: BigNumberish, 111 | r: BytesLike, 112 | s: BytesLike, 113 | overrides?: Overrides & { from?: string | Promise } 114 | ): Promise 115 | 116 | symbol(overrides?: CallOverrides): Promise<[string]> 117 | 118 | totalSupply(overrides?: CallOverrides): Promise<[BigNumber]> 119 | } 120 | 121 | allowance(owner: string, spender: string, overrides?: CallOverrides): Promise 122 | 123 | approve(spender: string, amount: BigNumberish, overrides?: Overrides & { from?: string | Promise }): Promise 124 | 125 | balanceOf(account: string, overrides?: CallOverrides): Promise 126 | 127 | decimals(overrides?: CallOverrides): Promise 128 | 129 | name(overrides?: CallOverrides): Promise 130 | 131 | permit( 132 | owner: string, 133 | spender: string, 134 | value: BigNumberish, 135 | deadline: BigNumberish, 136 | v: BigNumberish, 137 | r: BytesLike, 138 | s: BytesLike, 139 | overrides?: Overrides & { from?: string | Promise } 140 | ): Promise 141 | 142 | symbol(overrides?: CallOverrides): Promise 143 | 144 | totalSupply(overrides?: CallOverrides): Promise 145 | 146 | callStatic: { 147 | allowance(owner: string, spender: string, overrides?: CallOverrides): Promise 148 | 149 | approve(spender: string, amount: BigNumberish, overrides?: CallOverrides): Promise 150 | 151 | balanceOf(account: string, overrides?: CallOverrides): Promise 152 | 153 | decimals(overrides?: CallOverrides): Promise 154 | 155 | name(overrides?: CallOverrides): Promise 156 | 157 | permit( 158 | owner: string, 159 | spender: string, 160 | value: BigNumberish, 161 | deadline: BigNumberish, 162 | v: BigNumberish, 163 | r: BytesLike, 164 | s: BytesLike, 165 | overrides?: CallOverrides 166 | ): Promise 167 | 168 | symbol(overrides?: CallOverrides): Promise 169 | 170 | totalSupply(overrides?: CallOverrides): Promise 171 | } 172 | 173 | filters: { 174 | "Approval(address,address,uint256)"(owner?: string | null, spender?: string | null, value?: null): ApprovalEventFilter 175 | Approval(owner?: string | null, spender?: string | null, value?: null): ApprovalEventFilter 176 | 177 | "Transfer(address,address,uint256)"(from?: string | null, to?: string | null, value?: null): TransferEventFilter 178 | Transfer(from?: string | null, to?: string | null, value?: null): TransferEventFilter 179 | } 180 | 181 | estimateGas: { 182 | allowance(owner: string, spender: string, overrides?: CallOverrides): Promise 183 | 184 | approve(spender: string, amount: BigNumberish, overrides?: Overrides & { from?: string | Promise }): Promise 185 | 186 | balanceOf(account: string, overrides?: CallOverrides): Promise 187 | 188 | decimals(overrides?: CallOverrides): Promise 189 | 190 | name(overrides?: CallOverrides): Promise 191 | 192 | permit( 193 | owner: string, 194 | spender: string, 195 | value: BigNumberish, 196 | deadline: BigNumberish, 197 | v: BigNumberish, 198 | r: BytesLike, 199 | s: BytesLike, 200 | overrides?: Overrides & { from?: string | Promise } 201 | ): Promise 202 | 203 | symbol(overrides?: CallOverrides): Promise 204 | 205 | totalSupply(overrides?: CallOverrides): Promise 206 | } 207 | 208 | populateTransaction: { 209 | allowance(owner: string, spender: string, overrides?: CallOverrides): Promise 210 | 211 | approve( 212 | spender: string, 213 | amount: BigNumberish, 214 | overrides?: Overrides & { from?: string | Promise } 215 | ): Promise 216 | 217 | balanceOf(account: string, overrides?: CallOverrides): Promise 218 | 219 | decimals(overrides?: CallOverrides): Promise 220 | 221 | name(overrides?: CallOverrides): Promise 222 | 223 | permit( 224 | owner: string, 225 | spender: string, 226 | value: BigNumberish, 227 | deadline: BigNumberish, 228 | v: BigNumberish, 229 | r: BytesLike, 230 | s: BytesLike, 231 | overrides?: Overrides & { from?: string | Promise } 232 | ): Promise 233 | 234 | symbol(overrides?: CallOverrides): Promise 235 | 236 | totalSupply(overrides?: CallOverrides): Promise 237 | } 238 | } 239 | -------------------------------------------------------------------------------- /web3/classes/types/IGnosisSafe.ts: -------------------------------------------------------------------------------- 1 | /* Autogenerated file. Do not edit manually. */ 2 | /* tslint:disable */ 3 | /* eslint-disable */ 4 | import { BaseContract, BigNumber, BytesLike, CallOverrides, PopulatedTransaction, Signer, utils } from "ethers" 5 | import { FunctionFragment, Result } from "@ethersproject/abi" 6 | import { Listener, Provider } from "@ethersproject/providers" 7 | import { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from "./common" 8 | 9 | export interface IGnosisSafeInterface extends utils.Interface { 10 | contractName: "IGnosisSafe" 11 | functions: { 12 | "getOwners()": FunctionFragment 13 | "getThreshold()": FunctionFragment 14 | } 15 | 16 | encodeFunctionData(functionFragment: "getOwners", values?: undefined): string 17 | encodeFunctionData(functionFragment: "getThreshold", values?: undefined): string 18 | 19 | decodeFunctionResult(functionFragment: "getOwners", data: BytesLike): Result 20 | decodeFunctionResult(functionFragment: "getThreshold", data: BytesLike): Result 21 | 22 | events: {} 23 | } 24 | 25 | export interface IGnosisSafe extends BaseContract { 26 | contractName: "IGnosisSafe" 27 | connect(signerOrProvider: Signer | Provider | string): this 28 | attach(addressOrName: string): this 29 | deployed(): Promise 30 | 31 | interface: IGnosisSafeInterface 32 | 33 | queryFilter( 34 | event: TypedEventFilter, 35 | fromBlockOrBlockhash?: string | number | undefined, 36 | toBlock?: string | number | undefined 37 | ): Promise> 38 | 39 | listeners(eventFilter?: TypedEventFilter): Array> 40 | listeners(eventName?: string): Array 41 | removeAllListeners(eventFilter: TypedEventFilter): this 42 | removeAllListeners(eventName?: string): this 43 | off: OnEvent 44 | on: OnEvent 45 | once: OnEvent 46 | removeListener: OnEvent 47 | 48 | functions: { 49 | getOwners(overrides?: CallOverrides): Promise<[string[]]> 50 | 51 | getThreshold(overrides?: CallOverrides): Promise<[BigNumber]> 52 | } 53 | 54 | getOwners(overrides?: CallOverrides): Promise 55 | 56 | getThreshold(overrides?: CallOverrides): Promise 57 | 58 | callStatic: { 59 | getOwners(overrides?: CallOverrides): Promise 60 | 61 | getThreshold(overrides?: CallOverrides): Promise 62 | } 63 | 64 | filters: {} 65 | 66 | estimateGas: { 67 | getOwners(overrides?: CallOverrides): Promise 68 | 69 | getThreshold(overrides?: CallOverrides): Promise 70 | } 71 | 72 | populateTransaction: { 73 | getOwners(overrides?: CallOverrides): Promise 74 | 75 | getThreshold(overrides?: CallOverrides): Promise 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /web3/classes/types/IUniswapV2Factory.ts: -------------------------------------------------------------------------------- 1 | /* Autogenerated file. Do not edit manually. */ 2 | /* tslint:disable */ 3 | /* eslint-disable */ 4 | import { 5 | BaseContract, 6 | BigNumber, 7 | BigNumberish, 8 | BytesLike, 9 | CallOverrides, 10 | ContractTransaction, 11 | Overrides, 12 | PopulatedTransaction, 13 | Signer, 14 | utils, 15 | } from "ethers" 16 | import { FunctionFragment, Result, EventFragment } from "@ethersproject/abi" 17 | import { Listener, Provider } from "@ethersproject/providers" 18 | import { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from "./common" 19 | 20 | export interface IUniswapV2FactoryInterface extends utils.Interface { 21 | contractName: "IUniswapV2Factory" 22 | functions: { 23 | "allPairs(uint256)": FunctionFragment 24 | "allPairsLength()": FunctionFragment 25 | "createPair(address,address)": FunctionFragment 26 | "feeTo()": FunctionFragment 27 | "feeToSetter()": FunctionFragment 28 | "getPair(address,address)": FunctionFragment 29 | "migrator()": FunctionFragment 30 | "setFeeTo(address)": FunctionFragment 31 | "setFeeToSetter(address)": FunctionFragment 32 | "setMigrator(address)": FunctionFragment 33 | } 34 | 35 | encodeFunctionData(functionFragment: "allPairs", values: [BigNumberish]): string 36 | encodeFunctionData(functionFragment: "allPairsLength", values?: undefined): string 37 | encodeFunctionData(functionFragment: "createPair", values: [string, string]): string 38 | encodeFunctionData(functionFragment: "feeTo", values?: undefined): string 39 | encodeFunctionData(functionFragment: "feeToSetter", values?: undefined): string 40 | encodeFunctionData(functionFragment: "getPair", values: [string, string]): string 41 | encodeFunctionData(functionFragment: "migrator", values?: undefined): string 42 | encodeFunctionData(functionFragment: "setFeeTo", values: [string]): string 43 | encodeFunctionData(functionFragment: "setFeeToSetter", values: [string]): string 44 | encodeFunctionData(functionFragment: "setMigrator", values: [string]): string 45 | 46 | decodeFunctionResult(functionFragment: "allPairs", data: BytesLike): Result 47 | decodeFunctionResult(functionFragment: "allPairsLength", data: BytesLike): Result 48 | decodeFunctionResult(functionFragment: "createPair", data: BytesLike): Result 49 | decodeFunctionResult(functionFragment: "feeTo", data: BytesLike): Result 50 | decodeFunctionResult(functionFragment: "feeToSetter", data: BytesLike): Result 51 | decodeFunctionResult(functionFragment: "getPair", data: BytesLike): Result 52 | decodeFunctionResult(functionFragment: "migrator", data: BytesLike): Result 53 | decodeFunctionResult(functionFragment: "setFeeTo", data: BytesLike): Result 54 | decodeFunctionResult(functionFragment: "setFeeToSetter", data: BytesLike): Result 55 | decodeFunctionResult(functionFragment: "setMigrator", data: BytesLike): Result 56 | 57 | events: { 58 | "PairCreated(address,address,address,uint256)": EventFragment 59 | } 60 | 61 | getEvent(nameOrSignatureOrTopic: "PairCreated"): EventFragment 62 | } 63 | 64 | export type PairCreatedEvent = TypedEvent<[string, string, string, BigNumber], { token0: string; token1: string; pair: string; arg3: BigNumber }> 65 | 66 | export type PairCreatedEventFilter = TypedEventFilter 67 | 68 | export interface IUniswapV2Factory extends BaseContract { 69 | contractName: "IUniswapV2Factory" 70 | connect(signerOrProvider: Signer | Provider | string): this 71 | attach(addressOrName: string): this 72 | deployed(): Promise 73 | 74 | interface: IUniswapV2FactoryInterface 75 | 76 | queryFilter( 77 | event: TypedEventFilter, 78 | fromBlockOrBlockhash?: string | number | undefined, 79 | toBlock?: string | number | undefined 80 | ): Promise> 81 | 82 | listeners(eventFilter?: TypedEventFilter): Array> 83 | listeners(eventName?: string): Array 84 | removeAllListeners(eventFilter: TypedEventFilter): this 85 | removeAllListeners(eventName?: string): this 86 | off: OnEvent 87 | on: OnEvent 88 | once: OnEvent 89 | removeListener: OnEvent 90 | 91 | functions: { 92 | allPairs(arg0: BigNumberish, overrides?: CallOverrides): Promise<[string] & { pair: string }> 93 | 94 | allPairsLength(overrides?: CallOverrides): Promise<[BigNumber]> 95 | 96 | createPair(tokenA: string, tokenB: string, overrides?: Overrides & { from?: string | Promise }): Promise 97 | 98 | feeTo(overrides?: CallOverrides): Promise<[string]> 99 | 100 | feeToSetter(overrides?: CallOverrides): Promise<[string]> 101 | 102 | getPair(tokenA: string, tokenB: string, overrides?: CallOverrides): Promise<[string] & { pair: string }> 103 | 104 | migrator(overrides?: CallOverrides): Promise<[string]> 105 | 106 | setFeeTo(arg0: string, overrides?: Overrides & { from?: string | Promise }): Promise 107 | 108 | setFeeToSetter(arg0: string, overrides?: Overrides & { from?: string | Promise }): Promise 109 | 110 | setMigrator(arg0: string, overrides?: Overrides & { from?: string | Promise }): Promise 111 | } 112 | 113 | allPairs(arg0: BigNumberish, overrides?: CallOverrides): Promise 114 | 115 | allPairsLength(overrides?: CallOverrides): Promise 116 | 117 | createPair(tokenA: string, tokenB: string, overrides?: Overrides & { from?: string | Promise }): Promise 118 | 119 | feeTo(overrides?: CallOverrides): Promise 120 | 121 | feeToSetter(overrides?: CallOverrides): Promise 122 | 123 | getPair(tokenA: string, tokenB: string, overrides?: CallOverrides): Promise 124 | 125 | migrator(overrides?: CallOverrides): Promise 126 | 127 | setFeeTo(arg0: string, overrides?: Overrides & { from?: string | Promise }): Promise 128 | 129 | setFeeToSetter(arg0: string, overrides?: Overrides & { from?: string | Promise }): Promise 130 | 131 | setMigrator(arg0: string, overrides?: Overrides & { from?: string | Promise }): Promise 132 | 133 | callStatic: { 134 | allPairs(arg0: BigNumberish, overrides?: CallOverrides): Promise 135 | 136 | allPairsLength(overrides?: CallOverrides): Promise 137 | 138 | createPair(tokenA: string, tokenB: string, overrides?: CallOverrides): Promise 139 | 140 | feeTo(overrides?: CallOverrides): Promise 141 | 142 | feeToSetter(overrides?: CallOverrides): Promise 143 | 144 | getPair(tokenA: string, tokenB: string, overrides?: CallOverrides): Promise 145 | 146 | migrator(overrides?: CallOverrides): Promise 147 | 148 | setFeeTo(arg0: string, overrides?: CallOverrides): Promise 149 | 150 | setFeeToSetter(arg0: string, overrides?: CallOverrides): Promise 151 | 152 | setMigrator(arg0: string, overrides?: CallOverrides): Promise 153 | } 154 | 155 | filters: { 156 | "PairCreated(address,address,address,uint256)"( 157 | token0?: string | null, 158 | token1?: string | null, 159 | pair?: null, 160 | arg3?: null 161 | ): PairCreatedEventFilter 162 | PairCreated(token0?: string | null, token1?: string | null, pair?: null, arg3?: null): PairCreatedEventFilter 163 | } 164 | 165 | estimateGas: { 166 | allPairs(arg0: BigNumberish, overrides?: CallOverrides): Promise 167 | 168 | allPairsLength(overrides?: CallOverrides): Promise 169 | 170 | createPair(tokenA: string, tokenB: string, overrides?: Overrides & { from?: string | Promise }): Promise 171 | 172 | feeTo(overrides?: CallOverrides): Promise 173 | 174 | feeToSetter(overrides?: CallOverrides): Promise 175 | 176 | getPair(tokenA: string, tokenB: string, overrides?: CallOverrides): Promise 177 | 178 | migrator(overrides?: CallOverrides): Promise 179 | 180 | setFeeTo(arg0: string, overrides?: Overrides & { from?: string | Promise }): Promise 181 | 182 | setFeeToSetter(arg0: string, overrides?: Overrides & { from?: string | Promise }): Promise 183 | 184 | setMigrator(arg0: string, overrides?: Overrides & { from?: string | Promise }): Promise 185 | } 186 | 187 | populateTransaction: { 188 | allPairs(arg0: BigNumberish, overrides?: CallOverrides): Promise 189 | 190 | allPairsLength(overrides?: CallOverrides): Promise 191 | 192 | createPair(tokenA: string, tokenB: string, overrides?: Overrides & { from?: string | Promise }): Promise 193 | 194 | feeTo(overrides?: CallOverrides): Promise 195 | 196 | feeToSetter(overrides?: CallOverrides): Promise 197 | 198 | getPair(tokenA: string, tokenB: string, overrides?: CallOverrides): Promise 199 | 200 | migrator(overrides?: CallOverrides): Promise 201 | 202 | setFeeTo(arg0: string, overrides?: Overrides & { from?: string | Promise }): Promise 203 | 204 | setFeeToSetter(arg0: string, overrides?: Overrides & { from?: string | Promise }): Promise 205 | 206 | setMigrator(arg0: string, overrides?: Overrides & { from?: string | Promise }): Promise 207 | } 208 | } 209 | -------------------------------------------------------------------------------- /web3/classes/types/Multicall2.ts: -------------------------------------------------------------------------------- 1 | /* Autogenerated file. Do not edit manually. */ 2 | /* tslint:disable */ 3 | /* eslint-disable */ 4 | import { 5 | BaseContract, 6 | BigNumber, 7 | BigNumberish, 8 | BytesLike, 9 | CallOverrides, 10 | ContractTransaction, 11 | Overrides, 12 | PopulatedTransaction, 13 | Signer, 14 | utils, 15 | } from "ethers" 16 | import { FunctionFragment, Result } from "@ethersproject/abi" 17 | import { Listener, Provider } from "@ethersproject/providers" 18 | import { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from "./common" 19 | 20 | export declare namespace Multicall2 { 21 | export type CallStruct = { target: string; callData: BytesLike } 22 | 23 | export type CallStructOutput = [string, string] & { 24 | target: string 25 | callData: string 26 | } 27 | 28 | export type ResultStruct = { success: boolean; returnData: BytesLike } 29 | 30 | export type ResultStructOutput = [boolean, string] & { 31 | success: boolean 32 | returnData: string 33 | } 34 | } 35 | 36 | export interface Multicall2Interface extends utils.Interface { 37 | contractName: "Multicall2" 38 | functions: { 39 | "aggregate((address,bytes)[])": FunctionFragment 40 | "blockAndAggregate((address,bytes)[])": FunctionFragment 41 | "getBlockHash(uint256)": FunctionFragment 42 | "getBlockNumber()": FunctionFragment 43 | "getCurrentBlockCoinbase()": FunctionFragment 44 | "getCurrentBlockDifficulty()": FunctionFragment 45 | "getCurrentBlockGasLimit()": FunctionFragment 46 | "getCurrentBlockTimestamp()": FunctionFragment 47 | "getEthBalance(address)": FunctionFragment 48 | "getLastBlockHash()": FunctionFragment 49 | "tryAggregate(bool,(address,bytes)[])": FunctionFragment 50 | "tryBlockAndAggregate(bool,(address,bytes)[])": FunctionFragment 51 | } 52 | 53 | encodeFunctionData(functionFragment: "aggregate", values: [Multicall2.CallStruct[]]): string 54 | encodeFunctionData(functionFragment: "blockAndAggregate", values: [Multicall2.CallStruct[]]): string 55 | encodeFunctionData(functionFragment: "getBlockHash", values: [BigNumberish]): string 56 | encodeFunctionData(functionFragment: "getBlockNumber", values?: undefined): string 57 | encodeFunctionData(functionFragment: "getCurrentBlockCoinbase", values?: undefined): string 58 | encodeFunctionData(functionFragment: "getCurrentBlockDifficulty", values?: undefined): string 59 | encodeFunctionData(functionFragment: "getCurrentBlockGasLimit", values?: undefined): string 60 | encodeFunctionData(functionFragment: "getCurrentBlockTimestamp", values?: undefined): string 61 | encodeFunctionData(functionFragment: "getEthBalance", values: [string]): string 62 | encodeFunctionData(functionFragment: "getLastBlockHash", values?: undefined): string 63 | encodeFunctionData(functionFragment: "tryAggregate", values: [boolean, Multicall2.CallStruct[]]): string 64 | encodeFunctionData(functionFragment: "tryBlockAndAggregate", values: [boolean, Multicall2.CallStruct[]]): string 65 | 66 | decodeFunctionResult(functionFragment: "aggregate", data: BytesLike): Result 67 | decodeFunctionResult(functionFragment: "blockAndAggregate", data: BytesLike): Result 68 | decodeFunctionResult(functionFragment: "getBlockHash", data: BytesLike): Result 69 | decodeFunctionResult(functionFragment: "getBlockNumber", data: BytesLike): Result 70 | decodeFunctionResult(functionFragment: "getCurrentBlockCoinbase", data: BytesLike): Result 71 | decodeFunctionResult(functionFragment: "getCurrentBlockDifficulty", data: BytesLike): Result 72 | decodeFunctionResult(functionFragment: "getCurrentBlockGasLimit", data: BytesLike): Result 73 | decodeFunctionResult(functionFragment: "getCurrentBlockTimestamp", data: BytesLike): Result 74 | decodeFunctionResult(functionFragment: "getEthBalance", data: BytesLike): Result 75 | decodeFunctionResult(functionFragment: "getLastBlockHash", data: BytesLike): Result 76 | decodeFunctionResult(functionFragment: "tryAggregate", data: BytesLike): Result 77 | decodeFunctionResult(functionFragment: "tryBlockAndAggregate", data: BytesLike): Result 78 | 79 | events: {} 80 | } 81 | 82 | export interface Multicall2 extends BaseContract { 83 | contractName: "Multicall2" 84 | connect(signerOrProvider: Signer | Provider | string): this 85 | attach(addressOrName: string): this 86 | deployed(): Promise 87 | 88 | interface: Multicall2Interface 89 | 90 | queryFilter( 91 | event: TypedEventFilter, 92 | fromBlockOrBlockhash?: string | number | undefined, 93 | toBlock?: string | number | undefined 94 | ): Promise> 95 | 96 | listeners(eventFilter?: TypedEventFilter): Array> 97 | listeners(eventName?: string): Array 98 | removeAllListeners(eventFilter: TypedEventFilter): this 99 | removeAllListeners(eventName?: string): this 100 | off: OnEvent 101 | on: OnEvent 102 | once: OnEvent 103 | removeListener: OnEvent 104 | 105 | functions: { 106 | aggregate(calls: Multicall2.CallStruct[], overrides?: Overrides & { from?: string | Promise }): Promise 107 | 108 | blockAndAggregate( 109 | calls: Multicall2.CallStruct[], 110 | overrides?: Overrides & { from?: string | Promise } 111 | ): Promise 112 | 113 | getBlockHash(blockNumber: BigNumberish, overrides?: CallOverrides): Promise<[string] & { blockHash: string }> 114 | 115 | getBlockNumber(overrides?: CallOverrides): Promise<[BigNumber] & { blockNumber: BigNumber }> 116 | 117 | getCurrentBlockCoinbase(overrides?: CallOverrides): Promise<[string] & { coinbase: string }> 118 | 119 | getCurrentBlockDifficulty(overrides?: CallOverrides): Promise<[BigNumber] & { difficulty: BigNumber }> 120 | 121 | getCurrentBlockGasLimit(overrides?: CallOverrides): Promise<[BigNumber] & { gaslimit: BigNumber }> 122 | 123 | getCurrentBlockTimestamp(overrides?: CallOverrides): Promise<[BigNumber] & { timestamp: BigNumber }> 124 | 125 | getEthBalance(addr: string, overrides?: CallOverrides): Promise<[BigNumber] & { balance: BigNumber }> 126 | 127 | getLastBlockHash(overrides?: CallOverrides): Promise<[string] & { blockHash: string }> 128 | 129 | tryAggregate( 130 | requireSuccess: boolean, 131 | calls: Multicall2.CallStruct[], 132 | overrides?: Overrides & { from?: string | Promise } 133 | ): Promise 134 | 135 | tryBlockAndAggregate( 136 | requireSuccess: boolean, 137 | calls: Multicall2.CallStruct[], 138 | overrides?: Overrides & { from?: string | Promise } 139 | ): Promise 140 | } 141 | 142 | aggregate(calls: Multicall2.CallStruct[], overrides?: Overrides & { from?: string | Promise }): Promise 143 | 144 | blockAndAggregate(calls: Multicall2.CallStruct[], overrides?: Overrides & { from?: string | Promise }): Promise 145 | 146 | getBlockHash(blockNumber: BigNumberish, overrides?: CallOverrides): Promise 147 | 148 | getBlockNumber(overrides?: CallOverrides): Promise 149 | 150 | getCurrentBlockCoinbase(overrides?: CallOverrides): Promise 151 | 152 | getCurrentBlockDifficulty(overrides?: CallOverrides): Promise 153 | 154 | getCurrentBlockGasLimit(overrides?: CallOverrides): Promise 155 | 156 | getCurrentBlockTimestamp(overrides?: CallOverrides): Promise 157 | 158 | getEthBalance(addr: string, overrides?: CallOverrides): Promise 159 | 160 | getLastBlockHash(overrides?: CallOverrides): Promise 161 | 162 | tryAggregate( 163 | requireSuccess: boolean, 164 | calls: Multicall2.CallStruct[], 165 | overrides?: Overrides & { from?: string | Promise } 166 | ): Promise 167 | 168 | tryBlockAndAggregate( 169 | requireSuccess: boolean, 170 | calls: Multicall2.CallStruct[], 171 | overrides?: Overrides & { from?: string | Promise } 172 | ): Promise 173 | 174 | callStatic: { 175 | aggregate( 176 | calls: Multicall2.CallStruct[], 177 | overrides?: CallOverrides 178 | ): Promise<[BigNumber, string[]] & { blockNumber: BigNumber; returnData: string[] }> 179 | 180 | blockAndAggregate( 181 | calls: Multicall2.CallStruct[], 182 | overrides?: CallOverrides 183 | ): Promise< 184 | [BigNumber, string, Multicall2.ResultStructOutput[]] & { 185 | blockNumber: BigNumber 186 | blockHash: string 187 | returnData: Multicall2.ResultStructOutput[] 188 | } 189 | > 190 | 191 | getBlockHash(blockNumber: BigNumberish, overrides?: CallOverrides): Promise 192 | 193 | getBlockNumber(overrides?: CallOverrides): Promise 194 | 195 | getCurrentBlockCoinbase(overrides?: CallOverrides): Promise 196 | 197 | getCurrentBlockDifficulty(overrides?: CallOverrides): Promise 198 | 199 | getCurrentBlockGasLimit(overrides?: CallOverrides): Promise 200 | 201 | getCurrentBlockTimestamp(overrides?: CallOverrides): Promise 202 | 203 | getEthBalance(addr: string, overrides?: CallOverrides): Promise 204 | 205 | getLastBlockHash(overrides?: CallOverrides): Promise 206 | 207 | tryAggregate( 208 | requireSuccess: boolean, 209 | calls: Multicall2.CallStruct[], 210 | overrides?: CallOverrides 211 | ): Promise 212 | 213 | tryBlockAndAggregate( 214 | requireSuccess: boolean, 215 | calls: Multicall2.CallStruct[], 216 | overrides?: CallOverrides 217 | ): Promise< 218 | [BigNumber, string, Multicall2.ResultStructOutput[]] & { 219 | blockNumber: BigNumber 220 | blockHash: string 221 | returnData: Multicall2.ResultStructOutput[] 222 | } 223 | > 224 | } 225 | 226 | filters: {} 227 | 228 | estimateGas: { 229 | aggregate(calls: Multicall2.CallStruct[], overrides?: Overrides & { from?: string | Promise }): Promise 230 | 231 | blockAndAggregate(calls: Multicall2.CallStruct[], overrides?: Overrides & { from?: string | Promise }): Promise 232 | 233 | getBlockHash(blockNumber: BigNumberish, overrides?: CallOverrides): Promise 234 | 235 | getBlockNumber(overrides?: CallOverrides): Promise 236 | 237 | getCurrentBlockCoinbase(overrides?: CallOverrides): Promise 238 | 239 | getCurrentBlockDifficulty(overrides?: CallOverrides): Promise 240 | 241 | getCurrentBlockGasLimit(overrides?: CallOverrides): Promise 242 | 243 | getCurrentBlockTimestamp(overrides?: CallOverrides): Promise 244 | 245 | getEthBalance(addr: string, overrides?: CallOverrides): Promise 246 | 247 | getLastBlockHash(overrides?: CallOverrides): Promise 248 | 249 | tryAggregate( 250 | requireSuccess: boolean, 251 | calls: Multicall2.CallStruct[], 252 | overrides?: Overrides & { from?: string | Promise } 253 | ): Promise 254 | 255 | tryBlockAndAggregate( 256 | requireSuccess: boolean, 257 | calls: Multicall2.CallStruct[], 258 | overrides?: Overrides & { from?: string | Promise } 259 | ): Promise 260 | } 261 | 262 | populateTransaction: { 263 | aggregate(calls: Multicall2.CallStruct[], overrides?: Overrides & { from?: string | Promise }): Promise 264 | 265 | blockAndAggregate( 266 | calls: Multicall2.CallStruct[], 267 | overrides?: Overrides & { from?: string | Promise } 268 | ): Promise 269 | 270 | getBlockHash(blockNumber: BigNumberish, overrides?: CallOverrides): Promise 271 | 272 | getBlockNumber(overrides?: CallOverrides): Promise 273 | 274 | getCurrentBlockCoinbase(overrides?: CallOverrides): Promise 275 | 276 | getCurrentBlockDifficulty(overrides?: CallOverrides): Promise 277 | 278 | getCurrentBlockGasLimit(overrides?: CallOverrides): Promise 279 | 280 | getCurrentBlockTimestamp(overrides?: CallOverrides): Promise 281 | 282 | getEthBalance(addr: string, overrides?: CallOverrides): Promise 283 | 284 | getLastBlockHash(overrides?: CallOverrides): Promise 285 | 286 | tryAggregate( 287 | requireSuccess: boolean, 288 | calls: Multicall2.CallStruct[], 289 | overrides?: Overrides & { from?: string | Promise } 290 | ): Promise 291 | 292 | tryBlockAndAggregate( 293 | requireSuccess: boolean, 294 | calls: Multicall2.CallStruct[], 295 | overrides?: Overrides & { from?: string | Promise } 296 | ): Promise 297 | } 298 | } 299 | -------------------------------------------------------------------------------- /web3/classes/types/common.ts: -------------------------------------------------------------------------------- 1 | /* Autogenerated file. Do not edit manually. */ 2 | /* tslint:disable */ 3 | /* eslint-disable */ 4 | import type { Listener } from "@ethersproject/providers" 5 | import type { Event, EventFilter } from "ethers" 6 | 7 | export interface TypedEvent = any, TArgsObject = any> extends Event { 8 | args: TArgsArray & TArgsObject 9 | } 10 | 11 | export interface TypedEventFilter<_TEvent extends TypedEvent> extends EventFilter {} 12 | 13 | export interface TypedListener { 14 | (...listenerArg: [...__TypechainArgsArray, TEvent]): void 15 | } 16 | 17 | type __TypechainArgsArray = T extends TypedEvent ? U : never 18 | 19 | export interface OnEvent { 20 | (eventFilter: TypedEventFilter, listener: TypedListener): TRes 21 | (eventName: string, listener: Listener): TRes 22 | } 23 | 24 | export type MinEthersFactory = { 25 | deploy(...a: ARGS[]): Promise 26 | } 27 | 28 | export type GetContractTypeFromFactory = F extends MinEthersFactory ? C : never 29 | 30 | export type GetARGsTypeFromFactory = F extends MinEthersFactory ? Parameters : never 31 | -------------------------------------------------------------------------------- /web3/classes/types/factories/IERC20__factory.ts: -------------------------------------------------------------------------------- 1 | /* Autogenerated file. Do not edit manually. */ 2 | /* tslint:disable */ 3 | /* eslint-disable */ 4 | 5 | import { Contract, Signer, utils } from "ethers" 6 | import { Provider } from "@ethersproject/providers" 7 | import type { IERC20, IERC20Interface } from "../IERC20" 8 | 9 | const _abi = [ 10 | { 11 | anonymous: false, 12 | inputs: [ 13 | { 14 | indexed: true, 15 | internalType: "address", 16 | name: "owner", 17 | type: "address", 18 | }, 19 | { 20 | indexed: true, 21 | internalType: "address", 22 | name: "spender", 23 | type: "address", 24 | }, 25 | { 26 | indexed: false, 27 | internalType: "uint256", 28 | name: "value", 29 | type: "uint256", 30 | }, 31 | ], 32 | name: "Approval", 33 | type: "event", 34 | }, 35 | { 36 | anonymous: false, 37 | inputs: [ 38 | { 39 | indexed: true, 40 | internalType: "address", 41 | name: "from", 42 | type: "address", 43 | }, 44 | { 45 | indexed: true, 46 | internalType: "address", 47 | name: "to", 48 | type: "address", 49 | }, 50 | { 51 | indexed: false, 52 | internalType: "uint256", 53 | name: "value", 54 | type: "uint256", 55 | }, 56 | ], 57 | name: "Transfer", 58 | type: "event", 59 | }, 60 | { 61 | inputs: [ 62 | { 63 | internalType: "address", 64 | name: "owner", 65 | type: "address", 66 | }, 67 | { 68 | internalType: "address", 69 | name: "spender", 70 | type: "address", 71 | }, 72 | ], 73 | name: "allowance", 74 | outputs: [ 75 | { 76 | internalType: "uint256", 77 | name: "", 78 | type: "uint256", 79 | }, 80 | ], 81 | stateMutability: "view", 82 | type: "function", 83 | }, 84 | { 85 | inputs: [ 86 | { 87 | internalType: "address", 88 | name: "spender", 89 | type: "address", 90 | }, 91 | { 92 | internalType: "uint256", 93 | name: "amount", 94 | type: "uint256", 95 | }, 96 | ], 97 | name: "approve", 98 | outputs: [ 99 | { 100 | internalType: "bool", 101 | name: "", 102 | type: "bool", 103 | }, 104 | ], 105 | stateMutability: "nonpayable", 106 | type: "function", 107 | }, 108 | { 109 | inputs: [ 110 | { 111 | internalType: "address", 112 | name: "account", 113 | type: "address", 114 | }, 115 | ], 116 | name: "balanceOf", 117 | outputs: [ 118 | { 119 | internalType: "uint256", 120 | name: "", 121 | type: "uint256", 122 | }, 123 | ], 124 | stateMutability: "view", 125 | type: "function", 126 | }, 127 | { 128 | inputs: [], 129 | name: "decimals", 130 | outputs: [ 131 | { 132 | internalType: "uint8", 133 | name: "", 134 | type: "uint8", 135 | }, 136 | ], 137 | stateMutability: "view", 138 | type: "function", 139 | }, 140 | { 141 | inputs: [], 142 | name: "name", 143 | outputs: [ 144 | { 145 | internalType: "string", 146 | name: "", 147 | type: "string", 148 | }, 149 | ], 150 | stateMutability: "view", 151 | type: "function", 152 | }, 153 | { 154 | inputs: [ 155 | { 156 | internalType: "address", 157 | name: "owner", 158 | type: "address", 159 | }, 160 | { 161 | internalType: "address", 162 | name: "spender", 163 | type: "address", 164 | }, 165 | { 166 | internalType: "uint256", 167 | name: "value", 168 | type: "uint256", 169 | }, 170 | { 171 | internalType: "uint256", 172 | name: "deadline", 173 | type: "uint256", 174 | }, 175 | { 176 | internalType: "uint8", 177 | name: "v", 178 | type: "uint8", 179 | }, 180 | { 181 | internalType: "bytes32", 182 | name: "r", 183 | type: "bytes32", 184 | }, 185 | { 186 | internalType: "bytes32", 187 | name: "s", 188 | type: "bytes32", 189 | }, 190 | ], 191 | name: "permit", 192 | outputs: [], 193 | stateMutability: "nonpayable", 194 | type: "function", 195 | }, 196 | { 197 | inputs: [], 198 | name: "symbol", 199 | outputs: [ 200 | { 201 | internalType: "string", 202 | name: "", 203 | type: "string", 204 | }, 205 | ], 206 | stateMutability: "view", 207 | type: "function", 208 | }, 209 | { 210 | inputs: [], 211 | name: "totalSupply", 212 | outputs: [ 213 | { 214 | internalType: "uint256", 215 | name: "", 216 | type: "uint256", 217 | }, 218 | ], 219 | stateMutability: "view", 220 | type: "function", 221 | }, 222 | ] 223 | 224 | export class IERC20__factory { 225 | static readonly abi = _abi 226 | static createInterface(): IERC20Interface { 227 | return new utils.Interface(_abi) as IERC20Interface 228 | } 229 | static connect(address: string, signerOrProvider: Signer | Provider): IERC20 { 230 | return new Contract(address, _abi, signerOrProvider) as IERC20 231 | } 232 | } 233 | -------------------------------------------------------------------------------- /web3/classes/types/factories/IGnosisSafe__factory.ts: -------------------------------------------------------------------------------- 1 | /* Autogenerated file. Do not edit manually. */ 2 | /* tslint:disable */ 3 | /* eslint-disable */ 4 | 5 | import { Contract, Signer, utils } from "ethers" 6 | import { Provider } from "@ethersproject/providers" 7 | import type { IGnosisSafe, IGnosisSafeInterface } from "../IGnosisSafe" 8 | 9 | const _abi = [ 10 | { 11 | inputs: [], 12 | name: "getOwners", 13 | outputs: [ 14 | { 15 | internalType: "address[]", 16 | name: "", 17 | type: "address[]", 18 | }, 19 | ], 20 | stateMutability: "view", 21 | type: "function", 22 | }, 23 | { 24 | inputs: [], 25 | name: "getThreshold", 26 | outputs: [ 27 | { 28 | internalType: "uint256", 29 | name: "", 30 | type: "uint256", 31 | }, 32 | ], 33 | stateMutability: "view", 34 | type: "function", 35 | }, 36 | ] 37 | 38 | export class IGnosisSafe__factory { 39 | static readonly abi = _abi 40 | static createInterface(): IGnosisSafeInterface { 41 | return new utils.Interface(_abi) as IGnosisSafeInterface 42 | } 43 | static connect(address: string, signerOrProvider: Signer | Provider): IGnosisSafe { 44 | return new Contract(address, _abi, signerOrProvider) as IGnosisSafe 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /web3/classes/types/factories/IUniswapV2Factory__factory.ts: -------------------------------------------------------------------------------- 1 | /* Autogenerated file. Do not edit manually. */ 2 | /* tslint:disable */ 3 | /* eslint-disable */ 4 | 5 | import { Contract, Signer, utils } from "ethers" 6 | import { Provider } from "@ethersproject/providers" 7 | import type { IUniswapV2Factory, IUniswapV2FactoryInterface } from "../IUniswapV2Factory" 8 | 9 | const _abi = [ 10 | { 11 | anonymous: false, 12 | inputs: [ 13 | { 14 | indexed: true, 15 | internalType: "address", 16 | name: "token0", 17 | type: "address", 18 | }, 19 | { 20 | indexed: true, 21 | internalType: "address", 22 | name: "token1", 23 | type: "address", 24 | }, 25 | { 26 | indexed: false, 27 | internalType: "address", 28 | name: "pair", 29 | type: "address", 30 | }, 31 | { 32 | indexed: false, 33 | internalType: "uint256", 34 | name: "", 35 | type: "uint256", 36 | }, 37 | ], 38 | name: "PairCreated", 39 | type: "event", 40 | }, 41 | { 42 | inputs: [ 43 | { 44 | internalType: "uint256", 45 | name: "", 46 | type: "uint256", 47 | }, 48 | ], 49 | name: "allPairs", 50 | outputs: [ 51 | { 52 | internalType: "address", 53 | name: "pair", 54 | type: "address", 55 | }, 56 | ], 57 | stateMutability: "view", 58 | type: "function", 59 | }, 60 | { 61 | inputs: [], 62 | name: "allPairsLength", 63 | outputs: [ 64 | { 65 | internalType: "uint256", 66 | name: "", 67 | type: "uint256", 68 | }, 69 | ], 70 | stateMutability: "view", 71 | type: "function", 72 | }, 73 | { 74 | inputs: [ 75 | { 76 | internalType: "address", 77 | name: "tokenA", 78 | type: "address", 79 | }, 80 | { 81 | internalType: "address", 82 | name: "tokenB", 83 | type: "address", 84 | }, 85 | ], 86 | name: "createPair", 87 | outputs: [ 88 | { 89 | internalType: "address", 90 | name: "pair", 91 | type: "address", 92 | }, 93 | ], 94 | stateMutability: "nonpayable", 95 | type: "function", 96 | }, 97 | { 98 | inputs: [], 99 | name: "feeTo", 100 | outputs: [ 101 | { 102 | internalType: "address", 103 | name: "", 104 | type: "address", 105 | }, 106 | ], 107 | stateMutability: "view", 108 | type: "function", 109 | }, 110 | { 111 | inputs: [], 112 | name: "feeToSetter", 113 | outputs: [ 114 | { 115 | internalType: "address", 116 | name: "", 117 | type: "address", 118 | }, 119 | ], 120 | stateMutability: "view", 121 | type: "function", 122 | }, 123 | { 124 | inputs: [ 125 | { 126 | internalType: "address", 127 | name: "tokenA", 128 | type: "address", 129 | }, 130 | { 131 | internalType: "address", 132 | name: "tokenB", 133 | type: "address", 134 | }, 135 | ], 136 | name: "getPair", 137 | outputs: [ 138 | { 139 | internalType: "address", 140 | name: "pair", 141 | type: "address", 142 | }, 143 | ], 144 | stateMutability: "view", 145 | type: "function", 146 | }, 147 | { 148 | inputs: [], 149 | name: "migrator", 150 | outputs: [ 151 | { 152 | internalType: "address", 153 | name: "", 154 | type: "address", 155 | }, 156 | ], 157 | stateMutability: "view", 158 | type: "function", 159 | }, 160 | { 161 | inputs: [ 162 | { 163 | internalType: "address", 164 | name: "", 165 | type: "address", 166 | }, 167 | ], 168 | name: "setFeeTo", 169 | outputs: [], 170 | stateMutability: "nonpayable", 171 | type: "function", 172 | }, 173 | { 174 | inputs: [ 175 | { 176 | internalType: "address", 177 | name: "", 178 | type: "address", 179 | }, 180 | ], 181 | name: "setFeeToSetter", 182 | outputs: [], 183 | stateMutability: "nonpayable", 184 | type: "function", 185 | }, 186 | { 187 | inputs: [ 188 | { 189 | internalType: "address", 190 | name: "", 191 | type: "address", 192 | }, 193 | ], 194 | name: "setMigrator", 195 | outputs: [], 196 | stateMutability: "nonpayable", 197 | type: "function", 198 | }, 199 | ] 200 | 201 | export class IUniswapV2Factory__factory { 202 | static readonly abi = _abi 203 | static createInterface(): IUniswapV2FactoryInterface { 204 | return new utils.Interface(_abi) as IUniswapV2FactoryInterface 205 | } 206 | static connect(address: string, signerOrProvider: Signer | Provider): IUniswapV2Factory { 207 | return new Contract(address, _abi, signerOrProvider) as IUniswapV2Factory 208 | } 209 | } 210 | -------------------------------------------------------------------------------- /web3/classes/types/factories/IUniswapV2Pair__factory.ts: -------------------------------------------------------------------------------- 1 | /* Autogenerated file. Do not edit manually. */ 2 | /* tslint:disable */ 3 | /* eslint-disable */ 4 | 5 | import { Contract, Signer, utils } from "ethers" 6 | import { Provider } from "@ethersproject/providers" 7 | import type { IUniswapV2Pair, IUniswapV2PairInterface } from "../IUniswapV2Pair" 8 | 9 | const _abi = [ 10 | { 11 | anonymous: false, 12 | inputs: [ 13 | { 14 | indexed: true, 15 | internalType: "address", 16 | name: "owner", 17 | type: "address", 18 | }, 19 | { 20 | indexed: true, 21 | internalType: "address", 22 | name: "spender", 23 | type: "address", 24 | }, 25 | { 26 | indexed: false, 27 | internalType: "uint256", 28 | name: "value", 29 | type: "uint256", 30 | }, 31 | ], 32 | name: "Approval", 33 | type: "event", 34 | }, 35 | { 36 | anonymous: false, 37 | inputs: [ 38 | { 39 | indexed: true, 40 | internalType: "address", 41 | name: "sender", 42 | type: "address", 43 | }, 44 | { 45 | indexed: false, 46 | internalType: "uint256", 47 | name: "amount0", 48 | type: "uint256", 49 | }, 50 | { 51 | indexed: false, 52 | internalType: "uint256", 53 | name: "amount1", 54 | type: "uint256", 55 | }, 56 | { 57 | indexed: true, 58 | internalType: "address", 59 | name: "to", 60 | type: "address", 61 | }, 62 | ], 63 | name: "Burn", 64 | type: "event", 65 | }, 66 | { 67 | anonymous: false, 68 | inputs: [ 69 | { 70 | indexed: true, 71 | internalType: "address", 72 | name: "sender", 73 | type: "address", 74 | }, 75 | { 76 | indexed: false, 77 | internalType: "uint256", 78 | name: "amount0", 79 | type: "uint256", 80 | }, 81 | { 82 | indexed: false, 83 | internalType: "uint256", 84 | name: "amount1", 85 | type: "uint256", 86 | }, 87 | ], 88 | name: "Mint", 89 | type: "event", 90 | }, 91 | { 92 | anonymous: false, 93 | inputs: [ 94 | { 95 | indexed: true, 96 | internalType: "address", 97 | name: "sender", 98 | type: "address", 99 | }, 100 | { 101 | indexed: false, 102 | internalType: "uint256", 103 | name: "amount0In", 104 | type: "uint256", 105 | }, 106 | { 107 | indexed: false, 108 | internalType: "uint256", 109 | name: "amount1In", 110 | type: "uint256", 111 | }, 112 | { 113 | indexed: false, 114 | internalType: "uint256", 115 | name: "amount0Out", 116 | type: "uint256", 117 | }, 118 | { 119 | indexed: false, 120 | internalType: "uint256", 121 | name: "amount1Out", 122 | type: "uint256", 123 | }, 124 | { 125 | indexed: true, 126 | internalType: "address", 127 | name: "to", 128 | type: "address", 129 | }, 130 | ], 131 | name: "Swap", 132 | type: "event", 133 | }, 134 | { 135 | anonymous: false, 136 | inputs: [ 137 | { 138 | indexed: false, 139 | internalType: "uint112", 140 | name: "reserve0", 141 | type: "uint112", 142 | }, 143 | { 144 | indexed: false, 145 | internalType: "uint112", 146 | name: "reserve1", 147 | type: "uint112", 148 | }, 149 | ], 150 | name: "Sync", 151 | type: "event", 152 | }, 153 | { 154 | anonymous: false, 155 | inputs: [ 156 | { 157 | indexed: true, 158 | internalType: "address", 159 | name: "from", 160 | type: "address", 161 | }, 162 | { 163 | indexed: true, 164 | internalType: "address", 165 | name: "to", 166 | type: "address", 167 | }, 168 | { 169 | indexed: false, 170 | internalType: "uint256", 171 | name: "value", 172 | type: "uint256", 173 | }, 174 | ], 175 | name: "Transfer", 176 | type: "event", 177 | }, 178 | { 179 | inputs: [], 180 | name: "DOMAIN_SEPARATOR", 181 | outputs: [ 182 | { 183 | internalType: "bytes32", 184 | name: "", 185 | type: "bytes32", 186 | }, 187 | ], 188 | stateMutability: "view", 189 | type: "function", 190 | }, 191 | { 192 | inputs: [], 193 | name: "MINIMUM_LIQUIDITY", 194 | outputs: [ 195 | { 196 | internalType: "uint256", 197 | name: "", 198 | type: "uint256", 199 | }, 200 | ], 201 | stateMutability: "pure", 202 | type: "function", 203 | }, 204 | { 205 | inputs: [], 206 | name: "PERMIT_TYPEHASH", 207 | outputs: [ 208 | { 209 | internalType: "bytes32", 210 | name: "", 211 | type: "bytes32", 212 | }, 213 | ], 214 | stateMutability: "pure", 215 | type: "function", 216 | }, 217 | { 218 | inputs: [ 219 | { 220 | internalType: "address", 221 | name: "owner", 222 | type: "address", 223 | }, 224 | { 225 | internalType: "address", 226 | name: "spender", 227 | type: "address", 228 | }, 229 | ], 230 | name: "allowance", 231 | outputs: [ 232 | { 233 | internalType: "uint256", 234 | name: "", 235 | type: "uint256", 236 | }, 237 | ], 238 | stateMutability: "view", 239 | type: "function", 240 | }, 241 | { 242 | inputs: [ 243 | { 244 | internalType: "address", 245 | name: "spender", 246 | type: "address", 247 | }, 248 | { 249 | internalType: "uint256", 250 | name: "value", 251 | type: "uint256", 252 | }, 253 | ], 254 | name: "approve", 255 | outputs: [ 256 | { 257 | internalType: "bool", 258 | name: "", 259 | type: "bool", 260 | }, 261 | ], 262 | stateMutability: "nonpayable", 263 | type: "function", 264 | }, 265 | { 266 | inputs: [ 267 | { 268 | internalType: "address", 269 | name: "owner", 270 | type: "address", 271 | }, 272 | ], 273 | name: "balanceOf", 274 | outputs: [ 275 | { 276 | internalType: "uint256", 277 | name: "", 278 | type: "uint256", 279 | }, 280 | ], 281 | stateMutability: "view", 282 | type: "function", 283 | }, 284 | { 285 | inputs: [ 286 | { 287 | internalType: "address", 288 | name: "to", 289 | type: "address", 290 | }, 291 | ], 292 | name: "burn", 293 | outputs: [ 294 | { 295 | internalType: "uint256", 296 | name: "amount0", 297 | type: "uint256", 298 | }, 299 | { 300 | internalType: "uint256", 301 | name: "amount1", 302 | type: "uint256", 303 | }, 304 | ], 305 | stateMutability: "nonpayable", 306 | type: "function", 307 | }, 308 | { 309 | inputs: [], 310 | name: "decimals", 311 | outputs: [ 312 | { 313 | internalType: "uint8", 314 | name: "", 315 | type: "uint8", 316 | }, 317 | ], 318 | stateMutability: "pure", 319 | type: "function", 320 | }, 321 | { 322 | inputs: [], 323 | name: "factory", 324 | outputs: [ 325 | { 326 | internalType: "address", 327 | name: "", 328 | type: "address", 329 | }, 330 | ], 331 | stateMutability: "view", 332 | type: "function", 333 | }, 334 | { 335 | inputs: [], 336 | name: "getReserves", 337 | outputs: [ 338 | { 339 | internalType: "uint112", 340 | name: "reserve0", 341 | type: "uint112", 342 | }, 343 | { 344 | internalType: "uint112", 345 | name: "reserve1", 346 | type: "uint112", 347 | }, 348 | { 349 | internalType: "uint32", 350 | name: "blockTimestampLast", 351 | type: "uint32", 352 | }, 353 | ], 354 | stateMutability: "view", 355 | type: "function", 356 | }, 357 | { 358 | inputs: [ 359 | { 360 | internalType: "address", 361 | name: "", 362 | type: "address", 363 | }, 364 | { 365 | internalType: "address", 366 | name: "", 367 | type: "address", 368 | }, 369 | ], 370 | name: "initialize", 371 | outputs: [], 372 | stateMutability: "nonpayable", 373 | type: "function", 374 | }, 375 | { 376 | inputs: [], 377 | name: "kLast", 378 | outputs: [ 379 | { 380 | internalType: "uint256", 381 | name: "", 382 | type: "uint256", 383 | }, 384 | ], 385 | stateMutability: "view", 386 | type: "function", 387 | }, 388 | { 389 | inputs: [ 390 | { 391 | internalType: "address", 392 | name: "to", 393 | type: "address", 394 | }, 395 | ], 396 | name: "mint", 397 | outputs: [ 398 | { 399 | internalType: "uint256", 400 | name: "liquidity", 401 | type: "uint256", 402 | }, 403 | ], 404 | stateMutability: "nonpayable", 405 | type: "function", 406 | }, 407 | { 408 | inputs: [], 409 | name: "name", 410 | outputs: [ 411 | { 412 | internalType: "string", 413 | name: "", 414 | type: "string", 415 | }, 416 | ], 417 | stateMutability: "pure", 418 | type: "function", 419 | }, 420 | { 421 | inputs: [ 422 | { 423 | internalType: "address", 424 | name: "owner", 425 | type: "address", 426 | }, 427 | ], 428 | name: "nonces", 429 | outputs: [ 430 | { 431 | internalType: "uint256", 432 | name: "", 433 | type: "uint256", 434 | }, 435 | ], 436 | stateMutability: "view", 437 | type: "function", 438 | }, 439 | { 440 | inputs: [ 441 | { 442 | internalType: "address", 443 | name: "owner", 444 | type: "address", 445 | }, 446 | { 447 | internalType: "address", 448 | name: "spender", 449 | type: "address", 450 | }, 451 | { 452 | internalType: "uint256", 453 | name: "value", 454 | type: "uint256", 455 | }, 456 | { 457 | internalType: "uint256", 458 | name: "deadline", 459 | type: "uint256", 460 | }, 461 | { 462 | internalType: "uint8", 463 | name: "v", 464 | type: "uint8", 465 | }, 466 | { 467 | internalType: "bytes32", 468 | name: "r", 469 | type: "bytes32", 470 | }, 471 | { 472 | internalType: "bytes32", 473 | name: "s", 474 | type: "bytes32", 475 | }, 476 | ], 477 | name: "permit", 478 | outputs: [], 479 | stateMutability: "nonpayable", 480 | type: "function", 481 | }, 482 | { 483 | inputs: [], 484 | name: "price0CumulativeLast", 485 | outputs: [ 486 | { 487 | internalType: "uint256", 488 | name: "", 489 | type: "uint256", 490 | }, 491 | ], 492 | stateMutability: "view", 493 | type: "function", 494 | }, 495 | { 496 | inputs: [], 497 | name: "price1CumulativeLast", 498 | outputs: [ 499 | { 500 | internalType: "uint256", 501 | name: "", 502 | type: "uint256", 503 | }, 504 | ], 505 | stateMutability: "view", 506 | type: "function", 507 | }, 508 | { 509 | inputs: [ 510 | { 511 | internalType: "address", 512 | name: "to", 513 | type: "address", 514 | }, 515 | ], 516 | name: "skim", 517 | outputs: [], 518 | stateMutability: "nonpayable", 519 | type: "function", 520 | }, 521 | { 522 | inputs: [ 523 | { 524 | internalType: "uint256", 525 | name: "amount0Out", 526 | type: "uint256", 527 | }, 528 | { 529 | internalType: "uint256", 530 | name: "amount1Out", 531 | type: "uint256", 532 | }, 533 | { 534 | internalType: "address", 535 | name: "to", 536 | type: "address", 537 | }, 538 | { 539 | internalType: "bytes", 540 | name: "data", 541 | type: "bytes", 542 | }, 543 | ], 544 | name: "swap", 545 | outputs: [], 546 | stateMutability: "nonpayable", 547 | type: "function", 548 | }, 549 | { 550 | inputs: [], 551 | name: "symbol", 552 | outputs: [ 553 | { 554 | internalType: "string", 555 | name: "", 556 | type: "string", 557 | }, 558 | ], 559 | stateMutability: "pure", 560 | type: "function", 561 | }, 562 | { 563 | inputs: [], 564 | name: "sync", 565 | outputs: [], 566 | stateMutability: "nonpayable", 567 | type: "function", 568 | }, 569 | { 570 | inputs: [], 571 | name: "token0", 572 | outputs: [ 573 | { 574 | internalType: "address", 575 | name: "", 576 | type: "address", 577 | }, 578 | ], 579 | stateMutability: "view", 580 | type: "function", 581 | }, 582 | { 583 | inputs: [], 584 | name: "token1", 585 | outputs: [ 586 | { 587 | internalType: "address", 588 | name: "", 589 | type: "address", 590 | }, 591 | ], 592 | stateMutability: "view", 593 | type: "function", 594 | }, 595 | { 596 | inputs: [], 597 | name: "totalSupply", 598 | outputs: [ 599 | { 600 | internalType: "uint256", 601 | name: "", 602 | type: "uint256", 603 | }, 604 | ], 605 | stateMutability: "view", 606 | type: "function", 607 | }, 608 | { 609 | inputs: [ 610 | { 611 | internalType: "address", 612 | name: "to", 613 | type: "address", 614 | }, 615 | { 616 | internalType: "uint256", 617 | name: "value", 618 | type: "uint256", 619 | }, 620 | ], 621 | name: "transfer", 622 | outputs: [ 623 | { 624 | internalType: "bool", 625 | name: "", 626 | type: "bool", 627 | }, 628 | ], 629 | stateMutability: "nonpayable", 630 | type: "function", 631 | }, 632 | { 633 | inputs: [ 634 | { 635 | internalType: "address", 636 | name: "from", 637 | type: "address", 638 | }, 639 | { 640 | internalType: "address", 641 | name: "to", 642 | type: "address", 643 | }, 644 | { 645 | internalType: "uint256", 646 | name: "value", 647 | type: "uint256", 648 | }, 649 | ], 650 | name: "transferFrom", 651 | outputs: [ 652 | { 653 | internalType: "bool", 654 | name: "", 655 | type: "bool", 656 | }, 657 | ], 658 | stateMutability: "nonpayable", 659 | type: "function", 660 | }, 661 | ] 662 | 663 | export class IUniswapV2Pair__factory { 664 | static readonly abi = _abi 665 | static createInterface(): IUniswapV2PairInterface { 666 | return new utils.Interface(_abi) as IUniswapV2PairInterface 667 | } 668 | static connect(address: string, signerOrProvider: Signer | Provider): IUniswapV2Pair { 669 | return new Contract(address, _abi, signerOrProvider) as IUniswapV2Pair 670 | } 671 | } 672 | -------------------------------------------------------------------------------- /web3/classes/types/factories/Multicall2__factory.ts: -------------------------------------------------------------------------------- 1 | /* Autogenerated file. Do not edit manually. */ 2 | /* tslint:disable */ 3 | /* eslint-disable */ 4 | import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers" 5 | import { Provider, TransactionRequest } from "@ethersproject/providers" 6 | import type { Multicall2, Multicall2Interface } from "../Multicall2" 7 | 8 | const _abi = [ 9 | { 10 | inputs: [ 11 | { 12 | components: [ 13 | { 14 | internalType: "address", 15 | name: "target", 16 | type: "address", 17 | }, 18 | { 19 | internalType: "bytes", 20 | name: "callData", 21 | type: "bytes", 22 | }, 23 | ], 24 | internalType: "struct Multicall2.Call[]", 25 | name: "calls", 26 | type: "tuple[]", 27 | }, 28 | ], 29 | name: "aggregate", 30 | outputs: [ 31 | { 32 | internalType: "uint256", 33 | name: "blockNumber", 34 | type: "uint256", 35 | }, 36 | { 37 | internalType: "bytes[]", 38 | name: "returnData", 39 | type: "bytes[]", 40 | }, 41 | ], 42 | stateMutability: "nonpayable", 43 | type: "function", 44 | }, 45 | { 46 | inputs: [ 47 | { 48 | components: [ 49 | { 50 | internalType: "address", 51 | name: "target", 52 | type: "address", 53 | }, 54 | { 55 | internalType: "bytes", 56 | name: "callData", 57 | type: "bytes", 58 | }, 59 | ], 60 | internalType: "struct Multicall2.Call[]", 61 | name: "calls", 62 | type: "tuple[]", 63 | }, 64 | ], 65 | name: "blockAndAggregate", 66 | outputs: [ 67 | { 68 | internalType: "uint256", 69 | name: "blockNumber", 70 | type: "uint256", 71 | }, 72 | { 73 | internalType: "bytes32", 74 | name: "blockHash", 75 | type: "bytes32", 76 | }, 77 | { 78 | components: [ 79 | { 80 | internalType: "bool", 81 | name: "success", 82 | type: "bool", 83 | }, 84 | { 85 | internalType: "bytes", 86 | name: "returnData", 87 | type: "bytes", 88 | }, 89 | ], 90 | internalType: "struct Multicall2.Result[]", 91 | name: "returnData", 92 | type: "tuple[]", 93 | }, 94 | ], 95 | stateMutability: "nonpayable", 96 | type: "function", 97 | }, 98 | { 99 | inputs: [ 100 | { 101 | internalType: "uint256", 102 | name: "blockNumber", 103 | type: "uint256", 104 | }, 105 | ], 106 | name: "getBlockHash", 107 | outputs: [ 108 | { 109 | internalType: "bytes32", 110 | name: "blockHash", 111 | type: "bytes32", 112 | }, 113 | ], 114 | stateMutability: "view", 115 | type: "function", 116 | }, 117 | { 118 | inputs: [], 119 | name: "getBlockNumber", 120 | outputs: [ 121 | { 122 | internalType: "uint256", 123 | name: "blockNumber", 124 | type: "uint256", 125 | }, 126 | ], 127 | stateMutability: "view", 128 | type: "function", 129 | }, 130 | { 131 | inputs: [], 132 | name: "getCurrentBlockCoinbase", 133 | outputs: [ 134 | { 135 | internalType: "address", 136 | name: "coinbase", 137 | type: "address", 138 | }, 139 | ], 140 | stateMutability: "view", 141 | type: "function", 142 | }, 143 | { 144 | inputs: [], 145 | name: "getCurrentBlockDifficulty", 146 | outputs: [ 147 | { 148 | internalType: "uint256", 149 | name: "difficulty", 150 | type: "uint256", 151 | }, 152 | ], 153 | stateMutability: "view", 154 | type: "function", 155 | }, 156 | { 157 | inputs: [], 158 | name: "getCurrentBlockGasLimit", 159 | outputs: [ 160 | { 161 | internalType: "uint256", 162 | name: "gaslimit", 163 | type: "uint256", 164 | }, 165 | ], 166 | stateMutability: "view", 167 | type: "function", 168 | }, 169 | { 170 | inputs: [], 171 | name: "getCurrentBlockTimestamp", 172 | outputs: [ 173 | { 174 | internalType: "uint256", 175 | name: "timestamp", 176 | type: "uint256", 177 | }, 178 | ], 179 | stateMutability: "view", 180 | type: "function", 181 | }, 182 | { 183 | inputs: [ 184 | { 185 | internalType: "address", 186 | name: "addr", 187 | type: "address", 188 | }, 189 | ], 190 | name: "getEthBalance", 191 | outputs: [ 192 | { 193 | internalType: "uint256", 194 | name: "balance", 195 | type: "uint256", 196 | }, 197 | ], 198 | stateMutability: "view", 199 | type: "function", 200 | }, 201 | { 202 | inputs: [], 203 | name: "getLastBlockHash", 204 | outputs: [ 205 | { 206 | internalType: "bytes32", 207 | name: "blockHash", 208 | type: "bytes32", 209 | }, 210 | ], 211 | stateMutability: "view", 212 | type: "function", 213 | }, 214 | { 215 | inputs: [ 216 | { 217 | internalType: "bool", 218 | name: "requireSuccess", 219 | type: "bool", 220 | }, 221 | { 222 | components: [ 223 | { 224 | internalType: "address", 225 | name: "target", 226 | type: "address", 227 | }, 228 | { 229 | internalType: "bytes", 230 | name: "callData", 231 | type: "bytes", 232 | }, 233 | ], 234 | internalType: "struct Multicall2.Call[]", 235 | name: "calls", 236 | type: "tuple[]", 237 | }, 238 | ], 239 | name: "tryAggregate", 240 | outputs: [ 241 | { 242 | components: [ 243 | { 244 | internalType: "bool", 245 | name: "success", 246 | type: "bool", 247 | }, 248 | { 249 | internalType: "bytes", 250 | name: "returnData", 251 | type: "bytes", 252 | }, 253 | ], 254 | internalType: "struct Multicall2.Result[]", 255 | name: "returnData", 256 | type: "tuple[]", 257 | }, 258 | ], 259 | stateMutability: "nonpayable", 260 | type: "function", 261 | }, 262 | { 263 | inputs: [ 264 | { 265 | internalType: "bool", 266 | name: "requireSuccess", 267 | type: "bool", 268 | }, 269 | { 270 | components: [ 271 | { 272 | internalType: "address", 273 | name: "target", 274 | type: "address", 275 | }, 276 | { 277 | internalType: "bytes", 278 | name: "callData", 279 | type: "bytes", 280 | }, 281 | ], 282 | internalType: "struct Multicall2.Call[]", 283 | name: "calls", 284 | type: "tuple[]", 285 | }, 286 | ], 287 | name: "tryBlockAndAggregate", 288 | outputs: [ 289 | { 290 | internalType: "uint256", 291 | name: "blockNumber", 292 | type: "uint256", 293 | }, 294 | { 295 | internalType: "bytes32", 296 | name: "blockHash", 297 | type: "bytes32", 298 | }, 299 | { 300 | components: [ 301 | { 302 | internalType: "bool", 303 | name: "success", 304 | type: "bool", 305 | }, 306 | { 307 | internalType: "bytes", 308 | name: "returnData", 309 | type: "bytes", 310 | }, 311 | ], 312 | internalType: "struct Multicall2.Result[]", 313 | name: "returnData", 314 | type: "tuple[]", 315 | }, 316 | ], 317 | stateMutability: "nonpayable", 318 | type: "function", 319 | }, 320 | ] 321 | 322 | const _bytecode = 323 | "0x608060405234801561001057600080fd5b506110ee806100206000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c806372425d9d1161007157806372425d9d146101a657806386d516e8146101c4578063a8b0574e146101e2578063bce38bd714610200578063c3077fa914610230578063ee82ac5e14610262576100b4565b80630f28c97d146100b9578063252dba42146100d757806327e86d6e14610108578063399542e91461012657806342cbb15c146101585780634d2301cc14610176575b600080fd5b6100c1610292565b6040516100ce91906106a3565b60405180910390f35b6100f160048036038101906100ec91906109d2565b61029a565b6040516100ff929190610b65565b60405180910390f35b610110610423565b60405161011d9190610bae565b60405180910390f35b610140600480360381019061013b9190610c01565b610438565b60405161014f93929190610d6b565b60405180910390f35b610160610457565b60405161016d91906106a3565b60405180910390f35b610190600480360381019061018b9190610da9565b61045f565b60405161019d91906106a3565b60405180910390f35b6101ae610480565b6040516101bb91906106a3565b60405180910390f35b6101cc610488565b6040516101d991906106a3565b60405180910390f35b6101ea610490565b6040516101f79190610de5565b60405180910390f35b61021a60048036038101906102159190610c01565b610498565b6040516102279190610e00565b60405180910390f35b61024a600480360381019061024591906109d2565b610640565b60405161025993929190610d6b565b60405180910390f35b61027c60048036038101906102779190610e4e565b610663565b6040516102899190610bae565b60405180910390f35b600042905090565b60006060439150825167ffffffffffffffff8111156102bc576102bb6106e8565b5b6040519080825280602002602001820160405280156102ef57816020015b60608152602001906001900390816102da5790505b50905060005b835181101561041d5760008085838151811061031457610313610e7b565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1686848151811061034957610348610e7b565b5b6020026020010151602001516040516103629190610ee6565b6000604051808303816000865af19150503d806000811461039f576040519150601f19603f3d011682016040523d82523d6000602084013e6103a4565b606091505b5091509150816103e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103e090610f5a565b60405180910390fd5b808484815181106103fd576103fc610e7b565b5b60200260200101819052505050808061041590610fa9565b9150506102f5565b50915091565b60006001436104329190610ff2565b40905090565b60008060604392504340915061044e8585610498565b90509250925092565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b600045905090565b600041905090565b6060815167ffffffffffffffff8111156104b5576104b46106e8565b5b6040519080825280602002602001820160405280156104ee57816020015b6104db61066e565b8152602001906001900390816104d35790505b50905060005b82518110156106395760008084838151811061051357610512610e7b565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1685848151811061054857610547610e7b565b5b6020026020010151602001516040516105619190610ee6565b6000604051808303816000865af19150503d806000811461059e576040519150601f19603f3d011682016040523d82523d6000602084013e6105a3565b606091505b509150915085156105ef57816105ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e590611098565b60405180910390fd5b5b604051806040016040528083151581526020018281525084848151811061061957610618610e7b565b5b60200260200101819052505050808061063190610fa9565b9150506104f4565b5092915050565b6000806060610650600185610438565b8093508194508295505050509193909250565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b61069d8161068a565b82525050565b60006020820190506106b86000830184610694565b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610720826106d7565b810181811067ffffffffffffffff8211171561073f5761073e6106e8565b5b80604052505050565b60006107526106be565b905061075e8282610717565b919050565b600067ffffffffffffffff82111561077e5761077d6106e8565b5b602082029050602081019050919050565b600080fd5b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006107c98261079e565b9050919050565b6107d9816107be565b81146107e457600080fd5b50565b6000813590506107f6816107d0565b92915050565b600080fd5b600067ffffffffffffffff82111561081c5761081b6106e8565b5b610825826106d7565b9050602081019050919050565b82818337600083830152505050565b600061085461084f84610801565b610748565b9050828152602081018484840111156108705761086f6107fc565b5b61087b848285610832565b509392505050565b600082601f830112610898576108976106d2565b5b81356108a8848260208601610841565b91505092915050565b6000604082840312156108c7576108c6610794565b5b6108d16040610748565b905060006108e1848285016107e7565b600083015250602082013567ffffffffffffffff81111561090557610904610799565b5b61091184828501610883565b60208301525092915050565b600061093061092b84610763565b610748565b905080838252602082019050602084028301858111156109535761095261078f565b5b835b8181101561099a57803567ffffffffffffffff811115610978576109776106d2565b5b80860161098589826108b1565b85526020850194505050602081019050610955565b5050509392505050565b600082601f8301126109b9576109b86106d2565b5b81356109c984826020860161091d565b91505092915050565b6000602082840312156109e8576109e76106c8565b5b600082013567ffffffffffffffff811115610a0657610a056106cd565b5b610a12848285016109a4565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610a81578082015181840152602081019050610a66565b83811115610a90576000848401525b50505050565b6000610aa182610a47565b610aab8185610a52565b9350610abb818560208601610a63565b610ac4816106d7565b840191505092915050565b6000610adb8383610a96565b905092915050565b6000602082019050919050565b6000610afb82610a1b565b610b058185610a26565b935083602082028501610b1785610a37565b8060005b85811015610b535784840389528151610b348582610acf565b9450610b3f83610ae3565b925060208a01995050600181019050610b1b565b50829750879550505050505092915050565b6000604082019050610b7a6000830185610694565b8181036020830152610b8c8184610af0565b90509392505050565b6000819050919050565b610ba881610b95565b82525050565b6000602082019050610bc36000830184610b9f565b92915050565b60008115159050919050565b610bde81610bc9565b8114610be957600080fd5b50565b600081359050610bfb81610bd5565b92915050565b60008060408385031215610c1857610c176106c8565b5b6000610c2685828601610bec565b925050602083013567ffffffffffffffff811115610c4757610c466106cd565b5b610c53858286016109a4565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610c9281610bc9565b82525050565b6000604083016000830151610cb06000860182610c89565b5060208301518482036020860152610cc88282610a96565b9150508091505092915050565b6000610ce18383610c98565b905092915050565b6000602082019050919050565b6000610d0182610c5d565b610d0b8185610c68565b935083602082028501610d1d85610c79565b8060005b85811015610d595784840389528151610d3a8582610cd5565b9450610d4583610ce9565b925060208a01995050600181019050610d21565b50829750879550505050505092915050565b6000606082019050610d806000830186610694565b610d8d6020830185610b9f565b8181036040830152610d9f8184610cf6565b9050949350505050565b600060208284031215610dbf57610dbe6106c8565b5b6000610dcd848285016107e7565b91505092915050565b610ddf816107be565b82525050565b6000602082019050610dfa6000830184610dd6565b92915050565b60006020820190508181036000830152610e1a8184610cf6565b905092915050565b610e2b8161068a565b8114610e3657600080fd5b50565b600081359050610e4881610e22565b92915050565b600060208284031215610e6457610e636106c8565b5b6000610e7284828501610e39565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081905092915050565b6000610ec082610a47565b610eca8185610eaa565b9350610eda818560208601610a63565b80840191505092915050565b6000610ef28284610eb5565b915081905092915050565b600082825260208201905092915050565b7f4d756c746963616c6c206167677265676174653a2063616c6c206661696c6564600082015250565b6000610f44602083610efd565b9150610f4f82610f0e565b602082019050919050565b60006020820190508181036000830152610f7381610f37565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610fb48261068a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610fe757610fe6610f7a565b5b600182019050919050565b6000610ffd8261068a565b91506110088361068a565b92508282101561101b5761101a610f7a565b5b828203905092915050565b7f4d756c746963616c6c32206167677265676174653a2063616c6c206661696c6560008201527f6400000000000000000000000000000000000000000000000000000000000000602082015250565b6000611082602183610efd565b915061108d82611026565b604082019050919050565b600060208201905081810360008301526110b181611075565b905091905056fea26469706673582212202ad79168f7d1dfe0e32b590efa8eefaaaf0c61e9f6257161be30bcbab1ad332264736f6c63430008090033" 324 | 325 | type Multicall2ConstructorParams = [signer?: Signer] | ConstructorParameters 326 | 327 | const isSuperArgs = (xs: Multicall2ConstructorParams): xs is ConstructorParameters => xs.length > 1 328 | 329 | export class Multicall2__factory extends ContractFactory { 330 | constructor(...args: Multicall2ConstructorParams) { 331 | if (isSuperArgs(args)) { 332 | super(...args) 333 | } else { 334 | super(_abi, _bytecode, args[0]) 335 | } 336 | this.contractName = "Multicall2" 337 | } 338 | 339 | deploy(overrides?: Overrides & { from?: string | Promise }): Promise { 340 | return super.deploy(overrides || {}) as Promise 341 | } 342 | getDeployTransaction(overrides?: Overrides & { from?: string | Promise }): TransactionRequest { 343 | return super.getDeployTransaction(overrides || {}) 344 | } 345 | attach(address: string): Multicall2 { 346 | return super.attach(address) as Multicall2 347 | } 348 | connect(signer: Signer): Multicall2__factory { 349 | return super.connect(signer) as Multicall2__factory 350 | } 351 | static readonly contractName: "Multicall2" 352 | public readonly contractName: "Multicall2" 353 | static readonly bytecode = _bytecode 354 | static readonly abi = _abi 355 | static createInterface(): Multicall2Interface { 356 | return new utils.Interface(_abi) as Multicall2Interface 357 | } 358 | static connect(address: string, signerOrProvider: Signer | Provider): Multicall2 { 359 | return new Contract(address, _abi, signerOrProvider) as Multicall2 360 | } 361 | } 362 | -------------------------------------------------------------------------------- /web3/classes/types/index.ts: -------------------------------------------------------------------------------- 1 | /* Autogenerated file. Do not edit manually. */ 2 | /* tslint:disable */ 3 | /* eslint-disable */ 4 | export type { IERC20 } from "./IERC20" 5 | export type { IGnosisSafe } from "./IGnosisSafe" 6 | export type { IUniswapV2Factory } from "./IUniswapV2Factory" 7 | export type { IUniswapV2Pair } from "./IUniswapV2Pair" 8 | export type { IUniswapV2Router01 } from "./IUniswapV2Router01" 9 | export type { Multicall2 } from "./Multicall2" 10 | 11 | export { IERC20__factory } from "./factories/IERC20__factory" 12 | export { IGnosisSafe__factory } from "./factories/IGnosisSafe__factory" 13 | export { IUniswapV2Factory__factory } from "./factories/IUniswapV2Factory__factory" 14 | export { IUniswapV2Pair__factory } from "./factories/IUniswapV2Pair__factory" 15 | export { IUniswapV2Router01__factory } from "./factories/IUniswapV2Router01__factory" 16 | export { Multicall2__factory } from "./factories/Multicall2__factory" 17 | -------------------------------------------------------------------------------- /web3/components/ExplorerAddress.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 19 | -------------------------------------------------------------------------------- /web3/components/Menu.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 60 | -------------------------------------------------------------------------------- /web3/components/SmartAddress.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 12 | -------------------------------------------------------------------------------- /web3/components/TokenAmount.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 21 | -------------------------------------------------------------------------------- /web3/components/USDAmount.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 16 | -------------------------------------------------------------------------------- /web3/components/Web3Button.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 19 | -------------------------------------------------------------------------------- /web3/dist/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boringcrypto/DAOView/4a269feb681e75ae8192fad2b0c5587f52e653d1/web3/dist/favicon.ico -------------------------------------------------------------------------------- /web3/dist/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | SushiView 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /web3/dist/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DAOView", 3 | "description": "A description of what your app do", 4 | "iconPath": "myAppIcon.svg" 5 | } 6 | -------------------------------------------------------------------------------- /web3/env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | declare module "*.vue" { 4 | import type { DefineComponent } from "vue" 5 | // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types 6 | const component: DefineComponent<{}, {}, any> 7 | export default component 8 | } 9 | -------------------------------------------------------------------------------- /web3/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | SushiView 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /web3/main.ts: -------------------------------------------------------------------------------- 1 | import { createApp, reactive } from "vue" 2 | import { createRouter, createWebHashHistory } from "vue-router" 3 | import { BigNumber } from "ethers" 4 | import BootstrapVue from "bootstrap-vue-3" 5 | 6 | import "bootswatch/dist/sandstone/bootstrap.min.css" 7 | import "bootstrap-vue-3/dist/bootstrap-vue-3.css" 8 | 9 | import App from "./App.vue" 10 | import Home from "./pages/Home.vue" 11 | import MultiSigs from "./pages/MultiSigs.vue" 12 | import Routers from "./pages/Routers.vue" 13 | import Factories from "./pages/Factories.vue" 14 | import Makers from "./pages/Makers.vue" 15 | import Chefs from "./pages/Chefs.vue" 16 | import BentoBoxes from "./pages/BentoBoxes.vue" 17 | 18 | import MultiSig from "./pages/MultiSig.vue" 19 | import WethMaker from "./pages/WethMaker.vue" 20 | import Data from "./data" 21 | import Decimal from "decimal.js-light" 22 | 23 | Decimal.config({ precision: 36 }) 24 | Decimal.config({ toExpNeg: -1000 }) 25 | Decimal.config({ toExpPos: 1000 }) 26 | 27 | // this is just for debugging 28 | declare global { 29 | interface Window { 30 | data: any 31 | } 32 | } 33 | 34 | declare module "decimal.js-light" { 35 | interface Decimal { 36 | toInt: (decimals: number) => BigNumber 37 | } 38 | } 39 | 40 | Decimal.prototype.toInt = function (decimals: number) { 41 | return BigNumber.from(this.times(new Decimal("10").pow(new Decimal(decimals.toString()))).todp(0)) 42 | } 43 | 44 | declare module "ethers" { 45 | interface BigNumber { 46 | toDec: (decimals?: number) => Decimal 47 | } 48 | } 49 | 50 | BigNumber.prototype.toDec = function (decimals?: number) { 51 | return new Decimal(this.toString()).dividedBy(new Decimal(10).toPower((decimals || 0).toString())) 52 | } 53 | const BigNumberMax = (...args: BigNumber[]) => args.reduce((m, e) => (e > m ? e : m)) 54 | const BigNumberMin = (...args: BigNumber[]) => args.reduce((m, e) => (e < m ? e : m)) 55 | 56 | declare module "@vue/runtime-core" { 57 | interface ComponentCustomProperties { 58 | app: typeof Data 59 | } 60 | } 61 | 62 | async function main() { 63 | const app = createApp(App) 64 | await Data.web3.setup() 65 | window.data = Data 66 | app.config.globalProperties.app = reactive(Data) 67 | app.provide("app", app.config.globalProperties.app) 68 | 69 | app.use( 70 | createRouter({ 71 | history: createWebHashHistory(), 72 | routes: [ 73 | { path: "/", component: Home }, 74 | { path: "/multisigs", component: MultiSigs }, 75 | { path: "/makers", component: Makers }, 76 | { path: "/factories", component: Factories }, 77 | { path: "/chefs", component: Chefs }, 78 | { path: "/bentoboxes", component: BentoBoxes }, 79 | { path: "/kashimasters", component: Makers }, 80 | { path: "/routers", component: Routers }, 81 | { path: "/multisig/:network/:address", component: MultiSig }, 82 | { path: "/wethmaker/:network/:address", component: WethMaker }, 83 | //{ path: '/address/:address', component: Address }, 84 | ], 85 | }) 86 | ) 87 | app.use(BootstrapVue) 88 | app.mount("#app") 89 | } 90 | 91 | main() 92 | -------------------------------------------------------------------------------- /web3/pages/BentoBox.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /web3/pages/BentoBoxes.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /web3/pages/Chefs.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /web3/pages/Factories.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /web3/pages/Home.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /web3/pages/KashiMasters.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /web3/pages/Makers.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /web3/pages/MultiSig.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /web3/pages/MultiSigs.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /web3/pages/Routers.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /web3/pages/WethMaker.vue: -------------------------------------------------------------------------------- 1 | 98 | 99 | 170 | 171 | 172 | -------------------------------------------------------------------------------- /web3/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boringcrypto/DAOView/4a269feb681e75ae8192fad2b0c5587f52e653d1/web3/public/favicon.ico -------------------------------------------------------------------------------- /web3/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DAOView", 3 | "description": "A description of what your app do", 4 | "iconPath": "myAppIcon.svg" 5 | } 6 | -------------------------------------------------------------------------------- /web3/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "useDefineForClassFields": true, 5 | "module": "esnext", 6 | "moduleResolution": "node", 7 | "strict": true, 8 | "jsx": "preserve", 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "esModuleInterop": true, 12 | "lib": ["esnext", "dom"] 13 | }, 14 | "include": ["**/*.ts", "**/*.d.ts", "**/*.tsx", "**/*.vue"], 15 | "references": [{ "path": "./tsconfig.node.json" }] 16 | } 17 | -------------------------------------------------------------------------------- /web3/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "module": "esnext", 5 | "moduleResolution": "node" 6 | }, 7 | "include": ["vite.config.ts"] 8 | } 9 | -------------------------------------------------------------------------------- /web3/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vite" 2 | import vue from "@vitejs/plugin-vue" 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | root: "web3", 7 | base: "/DAOView/", 8 | plugins: [vue()], 9 | }) 10 | --------------------------------------------------------------------------------