From 6874f7429c10f9100a7c1fe8e2d7c1d9192744cc Mon Sep 17 00:00:00 2001 From: Anton Yip Date: Thu, 22 Jul 2021 20:30:10 -0700 Subject: [PATCH 1/3] Badger Contracts and Interfaces --- README.md | 1 + package-lock.json | 2 +- src/badger/abi/AffiliateVault.json | 618 ++++++++++++++++ src/badger/abi/DiggSett.json | 481 +++++++++++++ src/badger/abi/MiniMeToken.json | 586 +++++++++++++++ src/badger/abi/Sett.json | 671 ++++++++++++++++++ src/badger/abi/UFragments.json | 610 ++++++++++++++++ src/badger/abi/ibBTC.json | 204 ++++++ src/badger/contracts.ts | 118 +++ src/badger/contracts/IAccessControl.sol | 73 ++ src/badger/contracts/IAddressWhitelist.sol | 8 + src/badger/contracts/IBadgerERC1155.sol | 9 + src/badger/contracts/IBadgerGeyser.sol | 23 + src/badger/contracts/IBadgerTreeV2.sol | 65 ++ src/badger/contracts/IController.sol | 28 + src/badger/contracts/IConverter.sol | 8 + ...ICumulativeMultiTokenMerkleDistributor.sol | 29 + src/badger/contracts/IDefender.sol | 6 + .../contracts/IMerkleAddressWhitelist.sol | 8 + src/badger/contracts/IMerkleDistributor.sol | 13 + src/badger/contracts/IMiniMe.sol | 19 + src/badger/contracts/IMintr.sol | 8 + src/badger/contracts/IOneSplitAudit.sol | 22 + src/badger/contracts/IOwnable.sol | 5 + src/badger/contracts/IPausable.sol | 7 + src/badger/contracts/IPing.sol | 6 + src/badger/contracts/ISett.sol | 30 + .../contracts/ISettAccessControlDefended.sol | 8 + src/badger/contracts/ISettV4.sol | 27 + .../contracts/ISimpleTimelockWithVoting.sol | 11 + .../contracts/IStakingRewardsSignalOnly.sol | 20 + src/badger/contracts/IStrategy.sol | 46 ++ src/badger/contracts/ISwapStrategyRouter.sol | 31 + src/badger/contracts/IToken.sol | 13 + src/badger/contracts/IUnifiedLogger.sol | 5 + src/badger/index.ts | 5 + 36 files changed, 3823 insertions(+), 1 deletion(-) create mode 100644 src/badger/abi/AffiliateVault.json create mode 100644 src/badger/abi/DiggSett.json create mode 100644 src/badger/abi/MiniMeToken.json create mode 100644 src/badger/abi/Sett.json create mode 100644 src/badger/abi/UFragments.json create mode 100644 src/badger/abi/ibBTC.json create mode 100644 src/badger/contracts.ts create mode 100644 src/badger/contracts/IAccessControl.sol create mode 100644 src/badger/contracts/IAddressWhitelist.sol create mode 100644 src/badger/contracts/IBadgerERC1155.sol create mode 100644 src/badger/contracts/IBadgerGeyser.sol create mode 100644 src/badger/contracts/IBadgerTreeV2.sol create mode 100644 src/badger/contracts/IController.sol create mode 100644 src/badger/contracts/IConverter.sol create mode 100644 src/badger/contracts/ICumulativeMultiTokenMerkleDistributor.sol create mode 100644 src/badger/contracts/IDefender.sol create mode 100644 src/badger/contracts/IMerkleAddressWhitelist.sol create mode 100644 src/badger/contracts/IMerkleDistributor.sol create mode 100644 src/badger/contracts/IMiniMe.sol create mode 100644 src/badger/contracts/IMintr.sol create mode 100644 src/badger/contracts/IOneSplitAudit.sol create mode 100644 src/badger/contracts/IOwnable.sol create mode 100644 src/badger/contracts/IPausable.sol create mode 100644 src/badger/contracts/IPing.sol create mode 100644 src/badger/contracts/ISett.sol create mode 100644 src/badger/contracts/ISettAccessControlDefended.sol create mode 100644 src/badger/contracts/ISettV4.sol create mode 100644 src/badger/contracts/ISimpleTimelockWithVoting.sol create mode 100644 src/badger/contracts/IStakingRewardsSignalOnly.sol create mode 100644 src/badger/contracts/IStrategy.sol create mode 100644 src/badger/contracts/ISwapStrategyRouter.sol create mode 100644 src/badger/contracts/IToken.sol create mode 100644 src/badger/contracts/IUnifiedLogger.sol create mode 100644 src/badger/index.ts diff --git a/README.md b/README.md index 3104f3a..7ad5ac2 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Protocols supported: - Balancer - mStable - Uniswap v2 +- BadgerDAO Importing specific protocols is also supported: diff --git a/package-lock.json b/package-lock.json index 4f2d4dd..5c52aa5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@studydefi/money-legos", - "version": "2.4.1", + "version": "2.4.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/badger/abi/AffiliateVault.json b/src/badger/abi/AffiliateVault.json new file mode 100644 index 0000000..94f6860 --- /dev/null +++ b/src/badger/abi/AffiliateVault.json @@ -0,0 +1,618 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "affiliate", + "type": "address" + } + ], + "name": "AcceptAffiliate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "affiliate", + "type": "address" + } + ], + "name": "PendingAffiliate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "guardian", + "type": "address" + } + ], + "name": "SetGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "manager", + "type": "address" + } + ], + "name": "SetManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "guestList", + "type": "address" + } + ], + "name": "UpdateGuestList", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_TYPEHASH", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PERMIT_TYPEHASH", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptAffiliate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "affiliate", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "allVaults", + "outputs": [ + { "internalType": "contract VaultAPI[]", "name": "", "type": "address[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bestVault", + "outputs": [ + { "internalType": "contract VaultAPI", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "deposit", + "outputs": [ + { "internalType": "uint256", "name": "deposited", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "deposit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "guardian", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "guestList", + "outputs": [ + { "internalType": "contract GuestListAPI", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_token", "type": "address" }, + { "internalType": "address", "name": "_registry", "type": "address" }, + { "internalType": "string", "name": "name", "type": "string" }, + { "internalType": "string", "name": "symbol", "type": "string" }, + { "internalType": "address", "name": "_guardian", "type": "address" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "manager", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { + "internalType": "uint256", + "name": "maxMigrationLoss", + "type": "uint256" + } + ], + "name": "migrate", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "migrate", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "migrate", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "nonces", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingAffiliate", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "pricePerShare", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "registry", + "outputs": [ + { "internalType": "contract RegistryAPI", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_affiliate", "type": "address" } + ], + "name": "setAffiliate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_guardian", "type": "address" } + ], + "name": "setGuardian", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_guestList", "type": "address" } + ], + "name": "setGuestList", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_manager", "type": "address" } + ], + "name": "setManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_registry", "type": "address" } + ], + "name": "setRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssets", + "outputs": [ + { "internalType": "uint256", "name": "assets", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "totalVaultBalance", + "outputs": [ + { "internalType": "uint256", "name": "balance", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "shares", "type": "uint256" } + ], + "name": "withdraw", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/badger/abi/DiggSett.json b/src/badger/abi/DiggSett.json new file mode 100644 index 0000000..7a70612 --- /dev/null +++ b/src/badger/abi/DiggSett.json @@ -0,0 +1,481 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "name": "FullPricePerShareUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "approveContractAccess", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "approved", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "available", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "balance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "blockLock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "controller", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "depositAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "earn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getPricePerFullShare", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governance", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "guardian", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "reserve", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "harvest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_token", "type": "address" }, + { "internalType": "address", "name": "_controller", "type": "address" }, + { "internalType": "address", "name": "_governance", "type": "address" }, + { "internalType": "address", "name": "_keeper", "type": "address" }, + { "internalType": "address", "name": "_guardian", "type": "address" }, + { "internalType": "bool", "name": "_overrideTokenName", "type": "bool" }, + { "internalType": "string", "name": "_namePrefix", "type": "string" }, + { "internalType": "string", "name": "_symbolPrefix", "type": "string" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "keeper", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "max", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "min", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "revokeContractAccess", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_controller", "type": "address" } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_governance", "type": "address" } + ], + "name": "setGovernance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_guardian", "type": "address" } + ], + "name": "setGuardian", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_keeper", "type": "address" } + ], + "name": "setKeeper", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_min", "type": "uint256" } + ], + "name": "setMin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_strategist", "type": "address" } + ], + "name": "setStrategist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "shares", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "strategist", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "trackFullPricePerShare", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_shares", "type": "uint256" } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/badger/abi/MiniMeToken.json b/src/badger/abi/MiniMeToken.json new file mode 100644 index 0000000..31905ba --- /dev/null +++ b/src/badger/abi/MiniMeToken.json @@ -0,0 +1,586 @@ +[ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "creationBlock", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_newController", + "type": "address" + } + ], + "name": "changeController", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "balanceOfAt", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "version", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_cloneTokenName", + "type": "string" + }, + { + "name": "_cloneDecimalUnits", + "type": "uint8" + }, + { + "name": "_cloneTokenSymbol", + "type": "string" + }, + { + "name": "_snapshotBlock", + "type": "uint256" + }, + { + "name": "_transfersEnabled", + "type": "bool" + } + ], + "name": "createCloneToken", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "parentToken", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_amount", + "type": "uint256" + } + ], + "name": "generateTokens", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "totalSupplyAt", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "transfersEnabled", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "parentSnapShotBlock", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_amount", + "type": "uint256" + }, + { + "name": "_extraData", + "type": "bytes" + } + ], + "name": "approveAndCall", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_amount", + "type": "uint256" + } + ], + "name": "destroyTokens", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "remaining", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + } + ], + "name": "claimTokens", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "tokenFactory", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_transfersEnabled", + "type": "bool" + } + ], + "name": "enableTransfers", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "controller", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "_tokenFactory", + "type": "address" + }, + { + "name": "_parentToken", + "type": "address" + }, + { + "name": "_parentSnapShotBlock", + "type": "uint256" + }, + { + "name": "_tokenName", + "type": "string" + }, + { + "name": "_decimalUnits", + "type": "uint8" + }, + { + "name": "_tokenSymbol", + "type": "string" + }, + { + "name": "_transfersEnabled", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_token", + "type": "address" + }, + { + "indexed": true, + "name": "_controller", + "type": "address" + }, + { + "indexed": false, + "name": "_amount", + "type": "uint256" + } + ], + "name": "ClaimedTokens", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "name": "_amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_cloneToken", + "type": "address" + }, + { + "indexed": false, + "name": "_snapshotBlock", + "type": "uint256" + } + ], + "name": "NewCloneToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_spender", + "type": "address" + }, + { + "indexed": false, + "name": "_amount", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + } +] \ No newline at end of file diff --git a/src/badger/abi/Sett.json b/src/badger/abi/Sett.json new file mode 100644 index 0000000..426c83b --- /dev/null +++ b/src/badger/abi/Sett.json @@ -0,0 +1,671 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "name": "FullPricePerShareUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "approveContractAccess", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "approved", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "available", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "balance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "blockLock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "controller", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "depositAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "earn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getPricePerFullShare", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governance", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "harvest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_controller", + "type": "address" + }, + { + "internalType": "address", + "name": "_governance", + "type": "address" + }, + { + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "internalType": "bool", + "name": "_overrideTokenName", + "type": "bool" + }, + { + "internalType": "string", + "name": "_namePrefix", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbolPrefix", + "type": "string" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "keeper", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "max", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "min", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeContractAccess", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_controller", + "type": "address" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governance", + "type": "address" + } + ], + "name": "setGovernance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + } + ], + "name": "setKeeper", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_min", + "type": "uint256" + } + ], + "name": "setMin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_strategist", + "type": "address" + } + ], + "name": "setStrategist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "strategist", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "trackFullPricePerShare", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_shares", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] \ No newline at end of file diff --git a/src/badger/abi/UFragments.json b/src/badger/abi/UFragments.json new file mode 100644 index 0000000..9f1031e --- /dev/null +++ b/src/badger/abi/UFragments.json @@ -0,0 +1,610 @@ +[ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "spender", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "fragments", + "type": "uint256" + } + ], + "name": "fragmentsToShares", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "decimals", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "spender", + "type": "address" + }, + { + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalShares", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "shares", + "type": "uint256" + } + ], + "name": "sharesToFragments", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "_sharesPerFragment", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "shares", + "type": "uint256" + } + ], + "name": "sharesToScaledShares", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "who", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "epoch", + "type": "uint256" + }, + { + "name": "supplyDelta", + "type": "int256" + } + ], + "name": "rebase", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "monetaryPolicy_", + "type": "address" + } + ], + "name": "setMonetaryPolicy", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "monetaryPolicy", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "spender", + "type": "address" + }, + { + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "to", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "rebaseStartTime", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "_initialSharesPerFragment", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "owner_", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "owner_", + "type": "address" + }, + { + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "who", + "type": "address" + } + ], + "name": "sharesOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "fragments", + "type": "uint256" + } + ], + "name": "scaledSharesToShares", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "name": "totalSupply", + "type": "uint256" + } + ], + "name": "LogRebase", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "monetaryPolicy", + "type": "address" + } + ], + "name": "LogMonetaryPolicyUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "previousOwner", + "type": "address" + } + ], + "name": "OwnershipRenounced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "from", + "type": "address" + }, + { + "indexed": true, + "name": "to", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + } +] \ No newline at end of file diff --git a/src/badger/abi/ibBTC.json b/src/badger/abi/ibBTC.json new file mode 100644 index 0000000..86a623f --- /dev/null +++ b/src/badger/abi/ibBTC.json @@ -0,0 +1,204 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "_core", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pricePerShare", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_core", "type": "address" } + ], + "name": "switchCore", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/badger/contracts.ts b/src/badger/contracts.ts new file mode 100644 index 0000000..a6816b9 --- /dev/null +++ b/src/badger/contracts.ts @@ -0,0 +1,118 @@ +import AffiliateVault from "./abi/AffiliateVault.json" +import DiggSett from "./abi/DiggSett.json" +import ibBTC from "./abi/ibBTC.json" +import MiniMeToken from "./abi/MiniMeToken.json" +import Sett from "./abi/Sett.json" +import UFragments from "./abi/UFragments.json" + +const contracts = { + // Badger and Digg + BadgerToken: { + abi: MiniMeToken, + address: "0x3472A5A71965499acd81997a54BBA8D852C6E53d", + }, + DiggToken: { + abi: UFragments, + address: "0x798D1bE841a82a273720CE31c822C61a67a601C3", + }, + bBadgerToken: { + abi: Sett, + address: "0x19D97D8fA813EE2f51aD4B4e04EA08bAf4DFfC28", + }, + bDiggToken: { + abi: DiggSett, + address: "0x7e7E112A68d8D2E221E11047a72fFC1065c38e1a", + }, + // Vaults + //// Uniswap + native_uniBadgerWbtc: { + abi: Sett, + address: "0x235c9e24D3FB2FAFd58a2E49D454Fdcd2DBf7FF1", + }, + native_uniDiggWbtc: { + abi: Sett, + address: "0xC17078FDd324CC473F8175Dc5290fae5f2E84714", + }, + //// Sushi Swap + native_sushiWbtcEth: { + abi: Sett, + address: "0x758A43EE2BFf8230eeb784879CdcFF4828F2544D", + }, + native_sushiBadgerWbtc: { + abi: Sett, + address: "0x1862A18181346EBd9EdAf800804f89190DeF24a5", + }, + native_sushiDiggWbtc: { + abi: Sett, + address: "0x88128580ACdD9c04Ce47AFcE196875747bF2A9f6", + }, + //// Yearn + yearn_wbtc: { + abi: AffiliateVault, + address: "0x4b92d19c11435614cd49af1b589001b7c08cd4d5", + }, + //// Harvest + harvest_renCrv: { + abi: Sett, + address: "0xAf5A1DECfa95BAF63E0084a35c62592B774A2A87", + }, + //// Curve + native_cvxCrv: { + abi: Sett, + address: "0x2B5455aac8d64C14786c3a29858E43b5945819C0", + }, + native_cvx: { + abi: Sett, + address: "0x53c8e199eb2cb7c01543c137078a038937a68e40", + }, + native_renCrv: { + abi: Sett, + address: "0x6dEf55d2e18486B9dDfaA075bc4e4EE0B28c1545", + }, + native_sbtcCrv: { + abi: Sett, + address: "0xd04c48A53c111300aD41190D63681ed3dAd998eC", + }, + native_tbtcCrv: { + abi: Sett, + address: "0xb9D076fDe463dbc9f915E5392F807315Bf940334", + }, + native_tricrypto: { + abi: Sett, + address: "0xBE08Ef12e4a553666291E9fFC24fCCFd354F2Dd2", + }, + native_hbtcCrv: { + abi: Sett, + address: "0x8c76970747afd5398e958bdfada4cf0b9fca16c4", + }, + native_pbtcCrv: { + abi: Sett, + address: "0x55912d0cf83b75c492e761932abc4db4a5cb1b17", + }, + native_obtcCrv: { + abi: Sett, + address: "0xf349c0faa80fc1870306ac093f75934078e28991", + }, + native_bbtcCrv: { + abi: Sett, + address: "0x5dce29e92b1b939f8e8c60dcf15bde82a85be4a9", + }, + //// Others + experimental_sushiIBbtcWbtc: { + abi: Sett, + address: "0x8a8ffec8f4a0c8c9585da95d9d97e8cd6de273de", + }, + /* + experimental_digg: { + abi: StabilizeDiggSett, + address: "0x608b6D82eb121F3e5C0baeeD32d81007B916E83C", + }, + */ + //// ibBTC + ibBTC: { + abi: ibBTC, + address: "0xc4E15973E6fF2A35cC804c2CF9D2a1b817a8b40F", + }, +}; + +export default contracts; diff --git a/src/badger/contracts/IAccessControl.sol b/src/badger/contracts/IAccessControl.sol new file mode 100644 index 0000000..ae24140 --- /dev/null +++ b/src/badger/contracts/IAccessControl.sol @@ -0,0 +1,73 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IAccessControl { + /** + * @dev Returns `true` if `account` has been granted `role`. + */ + function hasRole(bytes32 role, address account) external view returns (bool); + + /** + * @dev Returns the number of accounts that have `role`. Can be used + * together with {getRoleMember} to enumerate all bearers of a role. + */ + function getRoleMemberCount(bytes32 role) external view returns (uint256); + + /** + * @dev Returns one of the accounts that have `role`. `index` must be a + * value between 0 and {getRoleMemberCount}, non-inclusive. + * + * Role bearers are not sorted in any particular way, and their ordering may + * change at any point. + * + * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure + * you perform all queries on the same block. See the following + * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] + * for more information. + */ + function getRoleMember(bytes32 role, uint256 index) external view returns (address); + /** + * @dev Returns the admin role that controls `role`. See {grantRole} and + * {revokeRole}. + * + * To change a role's admin, use {_setRoleAdmin}. + */ + function getRoleAdmin(bytes32 role) external view returns (bytes32); + /** + * @dev Grants `role` to `account`. + * + * If `account` had not been already granted `role`, emits a {RoleGranted} + * event. + * + * Requirements: + * + * - the caller must have ``role``'s admin role. + */ + function grantRole(bytes32 role, address account) external; + /** + * @dev Revokes `role` from `account`. + * + * If `account` had been granted `role`, emits a {RoleRevoked} event. + * + * Requirements: + * + * - the caller must have ``role``'s admin role. + */ + function revokeRole(bytes32 role, address account) external; + + /** + * @dev Revokes `role` from the calling account. + * + * Roles are often managed via {grantRole} and {revokeRole}: this function's + * purpose is to provide a mechanism for accounts to lose their privileges + * if they are compromised (such as when a trusted device is misplaced). + * + * If the calling account had been granted `role`, emits a {RoleRevoked} + * event. + * + * Requirements: + * + * - the caller must be `account`. + */ + function renounceRole(bytes32 role, address account) external; +} diff --git a/src/badger/contracts/IAddressWhitelist.sol b/src/badger/contracts/IAddressWhitelist.sol new file mode 100644 index 0000000..cc3e53b --- /dev/null +++ b/src/badger/contracts/IAddressWhitelist.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.0; + +// Generic address whitelist. +interface IAddressWhitelist { + // Checks if address exists in whitelist. + function exists(address addr) external returns (bool); +} diff --git a/src/badger/contracts/IBadgerERC1155.sol b/src/badger/contracts/IBadgerERC1155.sol new file mode 100644 index 0000000..2f9aec9 --- /dev/null +++ b/src/badger/contracts/IBadgerERC1155.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IBadgerERC1155 { + function balanceOf(address account, uint256 id) external view returns (uint256); + function totalSupply(uint256 id) external view returns (uint256); + function tokenSupply(uint256 id) external view returns (uint256); + function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes memory data) external; +} diff --git a/src/badger/contracts/IBadgerGeyser.sol b/src/badger/contracts/IBadgerGeyser.sol new file mode 100644 index 0000000..b0b98c5 --- /dev/null +++ b/src/badger/contracts/IBadgerGeyser.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT + +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IBadgerGeyser { + function stake(address) external returns (uint256); + + function signalTokenLock( + address token, + uint256 amount, + uint256 durationSec, + uint256 startTime + ) external; + + function modifyTokenLock( + address token, + uint256 index, + uint256 amount, + uint256 durationSec, + uint256 startTime + ) external; +} diff --git a/src/badger/contracts/IBadgerTreeV2.sol b/src/badger/contracts/IBadgerTreeV2.sol new file mode 100644 index 0000000..b64ed40 --- /dev/null +++ b/src/badger/contracts/IBadgerTreeV2.sol @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: MIT + +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IBadgerTreeV2 { + /// @dev Return true if account has outstanding claims in any token from the given input data + function isClaimAvailableFor( + address user, + address[] memory tokens, + uint256[] memory cumulativeAmounts + ) external view; + + /// @dev Get the number of tokens claimable for an account, given a list of tokens and latest cumulativeAmounts data + function getClaimableFor( + address user, + address[] memory tokens, + uint256[] memory cumulativeAmounts + ) external view; + + /// @dev Get the cumulative number of tokens claimed for an account, given a list of tokens + function getClaimedFor(address user, address[] memory tokens) external view; + + /// @dev Utility function to encode a merkle tree node + function encodeClaim( + address[] calldata tokens, + uint256[] calldata cumulativeAmounts, + address account, + uint256 index, + uint256 cycle + ) external pure; + + /// @notice Claim specifiedrewards for a set of tokens at a given cycle number + /// @notice Can choose to skip certain tokens by setting amount to claim to zero for that token index + function claim( + address[] calldata tokens, + uint256[] calldata cumulativeAmounts, + uint256 index, + uint256 cycle, + bytes32[] calldata merkleProof, + uint256[] calldata amountsToClaim + ) external; + + // ===== Root Updater Restricted ===== + + /// @notice Propose a new root and content hash, which will be stored as pending until approved + function proposeRoot( + bytes32 root, + bytes32 contentHash, + uint256 cycle, + uint256 startBlock, + uint256 endBlock + ) external; + + /// ===== Guardian Restricted ===== + + /// @notice Approve the current pending root and content hash + function approveRoot( + bytes32 root, + bytes32 contentHash, + uint256 cycle, + uint256 startBlock, + uint256 endBlock + ) external; +} diff --git a/src/badger/contracts/IController.sol b/src/badger/contracts/IController.sol new file mode 100644 index 0000000..900cbee --- /dev/null +++ b/src/badger/contracts/IController.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IController { + function withdraw(address, uint256) external; + + function withdrawAll(address) external; + + function strategies(address) external view returns (address); + + function approvedStrategies(address, address) external view returns (address); + + function balanceOf(address) external view returns (uint256); + + function earn(address, uint256) external; + + function approveStrategy(address, address) external; + + function setStrategy(address, address) external; + + function setVault(address, address) external; + + function want(address) external view returns (address); + + function rewards() external view returns (address); + + function vaults(address) external view returns (address); +} diff --git a/src/badger/contracts/IConverter.sol b/src/badger/contracts/IConverter.sol new file mode 100644 index 0000000..210a08f --- /dev/null +++ b/src/badger/contracts/IConverter.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT + +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IConverter { + function convert(address) external returns (uint256); +} diff --git a/src/badger/contracts/ICumulativeMultiTokenMerkleDistributor.sol b/src/badger/contracts/ICumulativeMultiTokenMerkleDistributor.sol new file mode 100644 index 0000000..b77aa7d --- /dev/null +++ b/src/badger/contracts/ICumulativeMultiTokenMerkleDistributor.sol @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity >=0.5.0; + +/* + Cumulative Merkle distributor +*/ +interface ICumulativeMultiTokenMerkleDistributor { + /// @notice Emit when insufficient funds to handle incoming root totals + event InsufficientFundsForRoot(bytes32 indexed root); + event RootProposed( + uint256 indexed cycle, + bytes32 indexed root, + bytes32 indexed contentHash, + uint256 startBlock, + uint256 endBlock, + uint256 timestamp, + uint256 blockNumber + ); + event RootUpdated( + uint256 indexed cycle, + bytes32 indexed root, + bytes32 indexed contentHash, + uint256 startBlock, + uint256 endBlock, + uint256 timestamp, + uint256 blockNumber + ); + event Claimed(address indexed user, address indexed token, uint256 amount, uint256 indexed cycle, uint256 timestamp, uint256 blockNumber); +} diff --git a/src/badger/contracts/IDefender.sol b/src/badger/contracts/IDefender.sol new file mode 100644 index 0000000..b8ac61a --- /dev/null +++ b/src/badger/contracts/IDefender.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IDefender { + function isAllowed(address) external returns (bool); +} diff --git a/src/badger/contracts/IMerkleAddressWhitelist.sol b/src/badger/contracts/IMerkleAddressWhitelist.sol new file mode 100644 index 0000000..10a84d5 --- /dev/null +++ b/src/badger/contracts/IMerkleAddressWhitelist.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.0; + +// Generic address whitelist impl as a merkle tree. +interface IMerkleAddressWhitelist { + // Checks if address exists in whitelist. + function exists(address addr, bytes32[] calldata merkleProof) external returns (bool); +} diff --git a/src/badger/contracts/IMerkleDistributor.sol b/src/badger/contracts/IMerkleDistributor.sol new file mode 100644 index 0000000..dc1afe9 --- /dev/null +++ b/src/badger/contracts/IMerkleDistributor.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity >=0.5.0; + +// Allows anyone to claim a token if they exist in a merkle root. +interface IMerkleDistributor { + // Returns true if the index has been marked claimed. + function isClaimed(uint256 index) external view returns (bool); + // Claim the given amount of the token to the given address. Reverts if the inputs are invalid. + function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external; + + // This event is triggered whenever a call to #claim succeeds. + event Claimed(uint256 index, address account, uint256 amount); +} \ No newline at end of file diff --git a/src/badger/contracts/IMiniMe.sol b/src/badger/contracts/IMiniMe.sol new file mode 100644 index 0000000..9978a56 --- /dev/null +++ b/src/badger/contracts/IMiniMe.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT + +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IMiniMe { + event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount); + event Transfer(address indexed _from, address indexed _to, uint256 _amount); + event NewCloneToken(address indexed _cloneToken, uint256 _snapshotBlock); + event Approval(address indexed _owner, address indexed _spender, uint256 _amount); + + function claimTokens(address _token) external; + + function enableTransfers(bool _transfersEnabled) external; + + function generateTokens(address _owner, uint256 _amount) external returns (bool); + + function destroyTokens(address _owner, uint256 _amount) external returns (bool); +} diff --git a/src/badger/contracts/IMintr.sol b/src/badger/contracts/IMintr.sol new file mode 100644 index 0000000..fd9b70c --- /dev/null +++ b/src/badger/contracts/IMintr.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT + +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IMintr { + function mint(address) external; +} diff --git a/src/badger/contracts/IOneSplitAudit.sol b/src/badger/contracts/IOneSplitAudit.sol new file mode 100644 index 0000000..ec68681 --- /dev/null +++ b/src/badger/contracts/IOneSplitAudit.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IOneSplitAudit { + function swap( + address fromToken, + address destToken, + uint256 amount, + uint256 minReturn, + uint256[] calldata distribution, + uint256 flags + ) external payable returns (uint256 returnAmount); + + function getExpectedReturn( + address fromToken, + address destToken, + uint256 amount, + uint256 parts, + uint256 flags // See constants in IOneSplit.sol + ) external view returns (uint256 returnAmount, uint256[] memory distribution); +} diff --git a/src/badger/contracts/IOwnable.sol b/src/badger/contracts/IOwnable.sol new file mode 100644 index 0000000..9877319 --- /dev/null +++ b/src/badger/contracts/IOwnable.sol @@ -0,0 +1,5 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; +interface IOwnable { + function transferOwnership(address newOwner) external; +} diff --git a/src/badger/contracts/IPausable.sol b/src/badger/contracts/IPausable.sol new file mode 100644 index 0000000..5b0da40 --- /dev/null +++ b/src/badger/contracts/IPausable.sol @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IPausable { + function pause() external; + function unpause() external; +} diff --git a/src/badger/contracts/IPing.sol b/src/badger/contracts/IPing.sol new file mode 100644 index 0000000..0ff5c71 --- /dev/null +++ b/src/badger/contracts/IPing.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IPing { + function ping() external pure returns (uint256); +} diff --git a/src/badger/contracts/ISett.sol b/src/badger/contracts/ISett.sol new file mode 100644 index 0000000..6d3398b --- /dev/null +++ b/src/badger/contracts/ISett.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface ISett { + function token() external view returns (address); + + function keeper() external view returns (address); + + function deposit(uint256) external; + + function depositFor(address, uint256) external; + + function depositAll() external; + + function withdraw(uint256) external; + + function withdrawAll() external; + + function earn() external; + + function balance() external view returns (uint256); + + function balanceOf(address account) external view returns (uint256); + + function totalSupply() external view returns (uint256); + + function claimInsurance() external; // NOTE: Only yDelegatedVault implements this + + function getPricePerFullShare() external view returns (uint256); +} diff --git a/src/badger/contracts/ISettAccessControlDefended.sol b/src/badger/contracts/ISettAccessControlDefended.sol new file mode 100644 index 0000000..a269d41 --- /dev/null +++ b/src/badger/contracts/ISettAccessControlDefended.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.6.11; + +interface ISettAccessControlDefended { + function approveContractAccess(address account) external; + + function revokeContractAccess(address account) external; +} diff --git a/src/badger/contracts/ISettV4.sol b/src/badger/contracts/ISettV4.sol new file mode 100644 index 0000000..8c5ee94 --- /dev/null +++ b/src/badger/contracts/ISettV4.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface ISettV4 { + function token() external view returns (address); + function keeper() external view returns (address); + + function deposit(uint256) external; + + function depositFor(address, uint256) external; + + function depositAll() external; + + function withdraw(uint256) external; + + function withdrawAll() external; + + function earn() external; + + function balanceOf(address account) external view returns (uint256); + + function totalSupply() external view returns (uint256); + + function claimInsurance() external; // NOTE: Only yDelegatedVault implements this + + function getPricePerFullShare() external view returns (uint256); +} diff --git a/src/badger/contracts/ISimpleTimelockWithVoting.sol b/src/badger/contracts/ISimpleTimelockWithVoting.sol new file mode 100644 index 0000000..dee097a --- /dev/null +++ b/src/badger/contracts/ISimpleTimelockWithVoting.sol @@ -0,0 +1,11 @@ +//SPDX-License-Identifier: Unlicense +pragma solidity >=0.5.0 <0.8.0; +interface ISimpleTimelockWithVoting { + function release() external; + + function vote( + uint256 _voteId, + bool _supports, + bool _executesIfDecided + ) external payable; +} diff --git a/src/badger/contracts/IStakingRewardsSignalOnly.sol b/src/badger/contracts/IStakingRewardsSignalOnly.sol new file mode 100644 index 0000000..9e43020 --- /dev/null +++ b/src/badger/contracts/IStakingRewardsSignalOnly.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IStakingRewardsSignalOnly { + function stakingToken() external view returns (address); + + function rewardsToken() external view returns (address); + + function withdraw(uint256) external; + + function getReward() external; + + function earned(address account) external view returns (uint256); + + function stake(uint256) external; + + function balanceOf(address) external view returns (uint256); + + function exit() external; +} diff --git a/src/badger/contracts/IStrategy.sol b/src/badger/contracts/IStrategy.sol new file mode 100644 index 0000000..915564b --- /dev/null +++ b/src/badger/contracts/IStrategy.sol @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: MIT + +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IStrategy { + function want() external view returns (address); + + function deposit() external; + + // NOTE: must exclude any tokens used in the yield + // Controller role - withdraw should return to Controller + function withdrawOther(address) external returns (uint256 balance); + + // Controller | Vault role - withdraw should always return to Vault + function withdraw(uint256) external; + + // Controller | Vault role - withdraw should always return to Vault + function withdrawAll() external returns (uint256); + + function balanceOf() external view returns (uint256); + function balanceOfPool() external view returns (uint256); + function balanceOfWant() external view returns (uint256); + + function getName() external pure returns (string memory); + + function setStrategist(address _strategist) external; + + function setWithdrawalFee(uint256 _withdrawalFee) external; + + function setPerformanceFeeStrategist(uint256 _performanceFeeStrategist) external; + + function setPerformanceFeeGovernance(uint256 _performanceFeeGovernance) external; + + function setGovernance(address _governance) external; + + function setController(address _controller) external; + + function controller() external returns (address); + + function governance() external returns (address); + + function tend() external; + + function harvest() external; +} diff --git a/src/badger/contracts/ISwapStrategyRouter.sol b/src/badger/contracts/ISwapStrategyRouter.sol new file mode 100644 index 0000000..114f1c9 --- /dev/null +++ b/src/badger/contracts/ISwapStrategyRouter.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.6.0; + +// ISwapStrategyRouter performs optimal routing of swaps. +interface ISwapStrategyRouter { + // Return the optimal rate and the strategy ID. + function optimizeSwap( + address _from, + address _to, + uint256 _amount + ) external returns (address strategy, uint256 amount); +} + +// ISwapStrategy enforces a standard API for swaps. +interface ISwapStrategy { + function swapTokens( + address _from, + address _to, + uint256 _amount, + // Slippage is in bps. + uint256 _slippage + ) external returns (uint256 amount); + + // Estimate swap amount returns the swap rate. + function estimateSwapAmount( + address _from, + address _to, + uint256 _amount + ) external returns (uint256 amount); +} diff --git a/src/badger/contracts/IToken.sol b/src/badger/contracts/IToken.sol new file mode 100644 index 0000000..43910fc --- /dev/null +++ b/src/badger/contracts/IToken.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT + +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +// NOTE: Basically an alias for Vaults +interface IbERC20 { + function deposit(uint256 _amount) external; + + function withdraw(uint256 _amount) external; + + function getPricePerFullShare() external view returns (uint256); +} diff --git a/src/badger/contracts/IUnifiedLogger.sol b/src/badger/contracts/IUnifiedLogger.sol new file mode 100644 index 0000000..b059c81 --- /dev/null +++ b/src/badger/contracts/IUnifiedLogger.sol @@ -0,0 +1,5 @@ +//SPDX-License-Identifier: Unlicense +pragma solidity >=0.5.0 <0.8.0; +interface IUnifiedLogger { + function batchLogs(bytes memory logs) external; +} diff --git a/src/badger/index.ts b/src/badger/index.ts new file mode 100644 index 0000000..e9a8a7a --- /dev/null +++ b/src/badger/index.ts @@ -0,0 +1,5 @@ +import { default as contracts } from "./contracts"; + +export = { + ...contracts, +}; From 45f8da4a4bb80dc1d9e056201fe71eb987e1e709 Mon Sep 17 00:00:00 2001 From: Anton Yip Date: Thu, 22 Jul 2021 20:54:10 -0700 Subject: [PATCH 2/3] documentation for badger --- docs/badger.md | 18 ++++++++++++++++++ docs/overview_mainnet_address.md | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 docs/badger.md diff --git a/docs/badger.md b/docs/badger.md new file mode 100644 index 0000000..482dd96 --- /dev/null +++ b/docs/badger.md @@ -0,0 +1,18 @@ +# Badger + +[Official Badger Github](https://github.com/Badger-Finance/badger-system) + +## Examples + +Import `@studydefi/money-legos/badger` package + +```js +const badger = require("@studydefi/money-legos/badger"); + +// Examples to access a badger contract address +badger.BadgerToken.address + +// Examples to access a badger contract abi +badger.BadgerToken.abi +``` + diff --git a/docs/overview_mainnet_address.md b/docs/overview_mainnet_address.md index aabf281..b4cbb59 100644 --- a/docs/overview_mainnet_address.md +++ b/docs/overview_mainnet_address.md @@ -26,6 +26,38 @@ - aWBTC: [0xfc4b8ed459e00e5400be803a9bb3954234fd50e3](https://etherscan.io/address/0xfc4b8ed459e00e5400be803a9bb3954234fd50e3) - aZRX: [0x6fb0855c404e09c47c3fbca25f08d4e41f9f062f](https://etherscan.io/address/0x6fb0855c404e09c47c3fbca25f08d4e41f9f062f) +## Badger + +[Link to ABIs](https://github.com/studydefi/money-legos/tree/master/src/badger/abi) + + + +- BadgerToken: [0x3472A5A71965499acd81997a54BBA8D852C6E53d](https://etherscan.io/address/0x3472A5A71965499acd81997a54BBA8D852C6E53d) +- DiggToken: [0x798D1bE841a82a273720CE31c822C61a67a601C3](https://etherscan.io/address/0x798D1bE841a82a273720CE31c822C61a67a601C3) +- bBadgerToken: [0x19D97D8fA813EE2f51aD4B4e04EA08bAf4DFfC28](https://etherscan.io/address/0x19D97D8fA813EE2f51aD4B4e04EA08bAf4DFfC28) +- bDiggToken: [0x7e7E112A68d8D2E221E11047a72fFC1065c38e1a](https://etherscan.io/address/0x7e7E112A68d8D2E221E11047a72fFC1065c38e1a) +- native_uniBadgerWbtc: [0x235c9e24D3FB2FAFd58a2E49D454Fdcd2DBf7FF1](https://etherscan.io/address/0x235c9e24D3FB2FAFd58a2E49D454Fdcd2DBf7FF1) +- native_uniDiggWbtc: [0xC17078FDd324CC473F8175Dc5290fae5f2E84714](https://etherscan.io/address/0xC17078FDd324CC473F8175Dc5290fae5f2E84714) +- native_sushiWbtcEth: [0x758A43EE2BFf8230eeb784879CdcFF4828F2544D](https://etherscan.io/address/0x758A43EE2BFf8230eeb784879CdcFF4828F2544D) +- native_sushiBadgerWbtc: [0x1862A18181346EBd9EdAf800804f89190DeF24a5](https://etherscan.io/address/0x1862A18181346EBd9EdAf800804f89190DeF24a5) +- native_sushiDiggWbtc: [0x88128580ACdD9c04Ce47AFcE196875747bF2A9f6](https://etherscan.io/address/0x88128580ACdD9c04Ce47AFcE196875747bF2A9f6) +- yearn_wbtc: [0x4b92d19c11435614cd49af1b589001b7c08cd4d5](https://etherscan.io/address/0x4b92d19c11435614cd49af1b589001b7c08cd4d5) +- harvest_renCrv: [0xAf5A1DECfa95BAF63E0084a35c62592B774A2A87](https://etherscan.io/address/0xAf5A1DECfa95BAF63E0084a35c62592B774A2A87) +- native_cvxCrv: [0x2B5455aac8d64C14786c3a29858E43b5945819C0](https://etherscan.io/address/0x2B5455aac8d64C14786c3a29858E43b5945819C0) +- native_cvx: [0x53c8e199eb2cb7c01543c137078a038937a68e40](https://etherscan.io/address/0x53c8e199eb2cb7c01543c137078a038937a68e40) +- native_renCrv: [0x6dEf55d2e18486B9dDfaA075bc4e4EE0B28c1545](https://etherscan.io/address/0x6dEf55d2e18486B9dDfaA075bc4e4EE0B28c1545) +- native_sbtcCrv: [0xd04c48A53c111300aD41190D63681ed3dAd998eC](https://etherscan.io/address/0xd04c48A53c111300aD41190D63681ed3dAd998eC) +- native_tbtcCrv: [0xb9D076fDe463dbc9f915E5392F807315Bf940334](https://etherscan.io/address/0xb9D076fDe463dbc9f915E5392F807315Bf940334) +- native_tricrypto: [0xBE08Ef12e4a553666291E9fFC24fCCFd354F2Dd2](https://etherscan.io/address/0xBE08Ef12e4a553666291E9fFC24fCCFd354F2Dd2) +- native_hbtcCrv: [0x8c76970747afd5398e958bdfada4cf0b9fca16c4](https://etherscan.io/address/0x8c76970747afd5398e958bdfada4cf0b9fca16c4) +- native_pbtcCrv: [0x55912d0cf83b75c492e761932abc4db4a5cb1b17](https://etherscan.io/address/0x55912d0cf83b75c492e761932abc4db4a5cb1b17) +- native_obtcCrv: [0xf349c0faa80fc1870306ac093f75934078e28991](https://etherscan.io/address/0xf349c0faa80fc1870306ac093f75934078e28991) +- native_bbtcCrv: [0x5dce29e92b1b939f8e8c60dcf15bde82a85be4a9](https://etherscan.io/address/0x5dce29e92b1b939f8e8c60dcf15bde82a85be4a9) +- experimental_sushiIBbtcWbtc: [0x8a8ffec8f4a0c8c9585da95d9d97e8cd6de273de](https://etherscan.io/address/0x8a8ffec8f4a0c8c9585da95d9d97e8cd6de273de) +- experimental_digg: [0x608b6D82eb121F3e5C0baeeD32d81007B916E83C](https://etherscan.io/address/0x608b6D82eb121F3e5C0baeeD32d81007B916E83C) +- ibBTC: [0xc4E15973E6fF2A35cC804c2CF9D2a1b817a8b40F](https://etherscan.io/address/0xc4E15973E6fF2A35cC804c2CF9D2a1b817a8b40F) + + ## Balancer [Link to ABIs](https://github.com/studydefi/money-legos/tree/master/src/balancer/abi) From 7cada13f9fd570b6c5df2b2e52c2ee7d66f8e48f Mon Sep 17 00:00:00 2001 From: Anton Yip Date: Thu, 22 Jul 2021 20:57:55 -0700 Subject: [PATCH 3/3] adding more documentation --- docs/README.md | 1 + docs/_sidebar.md | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/README.md b/docs/README.md index 1612dc2..69b7ddf 100644 --- a/docs/README.md +++ b/docs/README.md @@ -38,3 +38,4 @@ - Balancer - mStable - Uniswap v2 +- BadgerDAO diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 6f5c7f3..88f2c1d 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -7,6 +7,7 @@ - Reference Guides - [Aave](aave.md) + - [Badger](badger.md) - [Compound](compound.md) - [CurveFi](curvefi.md) - [DyDx](dydx.md)