From cbde9d49f51ff7b3acabd7552be1e1b653540227 Mon Sep 17 00:00:00 2001 From: brightiron <95196612+brightiron@users.noreply.github.com> Date: Sat, 23 Apr 2022 11:28:37 -0500 Subject: [PATCH] feat: Add Olympus V2 bonds (#203) --- .../abis/olympus-bond-depository.json | 798 ------------- .../abis/olympus-v-2-bond-depository.json | 363 ++++++ .../contracts/ethers/OlympusBondDepository.ts | 940 --------------- .../ethers/OlympusV2BondDepository.ts | 1005 +++++++++++++++++ ...ts => OlympusV2BondDepository__factory.ts} | 757 +++++++------ .../contracts/ethers/factories/index.ts | 2 +- src/apps/olympus/contracts/ethers/index.ts | 4 +- src/apps/olympus/contracts/index.ts | 10 +- .../ethereum/olympus.balance-fetcher.ts | 19 +- .../olympus.bond.contract-position-fetcher.ts | 11 +- ...s.bond.contract-position-balance-helper.ts | 35 +- .../olympus.bond.contract-position-helper.ts | 13 +- src/apps/olympus/index.ts | 2 +- 13 files changed, 1849 insertions(+), 2110 deletions(-) delete mode 100644 src/apps/olympus/contracts/abis/olympus-bond-depository.json create mode 100644 src/apps/olympus/contracts/abis/olympus-v-2-bond-depository.json delete mode 100644 src/apps/olympus/contracts/ethers/OlympusBondDepository.ts create mode 100644 src/apps/olympus/contracts/ethers/OlympusV2BondDepository.ts rename src/apps/olympus/contracts/ethers/factories/{OlympusBondDepository__factory.ts => OlympusV2BondDepository__factory.ts} (63%) diff --git a/src/apps/olympus/contracts/abis/olympus-bond-depository.json b/src/apps/olympus/contracts/abis/olympus-bond-depository.json deleted file mode 100644 index 1b874f87b..000000000 --- a/src/apps/olympus/contracts/abis/olympus-bond-depository.json +++ /dev/null @@ -1,798 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_OHM", - "type": "address" - }, - { - "internalType": "address", - "name": "_principle", - "type": "address" - }, - { - "internalType": "address", - "name": "_treasury", - "type": "address" - }, - { - "internalType": "address", - "name": "_DAO", - "type": "address" - }, - { - "internalType": "address", - "name": "_bondCalculator", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "deposit", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "payout", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "expires", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "priceInUSD", - "type": "uint256" - } - ], - "name": "BondCreated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "priceInUSD", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "internalPrice", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "debtRatio", - "type": "uint256" - } - ], - "name": "BondPriceChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "payout", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "remaining", - "type": "uint256" - } - ], - "name": "BondRedeemed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "initialBCV", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newBCV", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "adjustment", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "addition", - "type": "bool" - } - ], - "name": "ControlVariableAdjustment", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipPulled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipPushed", - "type": "event" - }, - { - "inputs": [], - "name": "DAO", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "OHM", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "adjustment", - "outputs": [ - { - "internalType": "bool", - "name": "add", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "rate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "target", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "buffer", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "bondCalculator", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "bondInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "payout", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "vesting", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "pricePaid", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "bondPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "price_", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "bondPriceInUSD", - "outputs": [ - { - "internalType": "uint256", - "name": "price_", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "currentDebt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "debtDecay", - "outputs": [ - { - "internalType": "uint256", - "name": "decay_", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "debtRatio", - "outputs": [ - { - "internalType": "uint256", - "name": "debtRatio_", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxPrice", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_depositor", - "type": "address" - } - ], - "name": "deposit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_controlVariable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_vestingTerm", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minimumPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxPayout", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_fee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_initialDebt", - "type": "uint256" - } - ], - "name": "initializeBondTerms", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isLiquidityBond", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "lastDecay", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxPayout", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "payoutFor", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_depositor", - "type": "address" - } - ], - "name": "pendingPayoutFor", - "outputs": [ - { - "internalType": "uint256", - "name": "pendingPayout_", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_depositor", - "type": "address" - } - ], - "name": "percentVestedFor", - "outputs": [ - { - "internalType": "uint256", - "name": "percentVested_", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "policy", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "principle", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pullManagement", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner_", - "type": "address" - } - ], - "name": "pushManagement", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "recoverLostToken", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_recipient", - "type": "address" - }, - { - "internalType": "bool", - "name": "_stake", - "type": "bool" - } - ], - "name": "redeem", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceManagement", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_addition", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "_increment", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_target", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_buffer", - "type": "uint256" - } - ], - "name": "setAdjustment", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum OlympusBondDepository.PARAMETER", - "name": "_parameter", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "_input", - "type": "uint256" - } - ], - "name": "setBondTerms", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_staking", - "type": "address" - }, - { - "internalType": "bool", - "name": "_helper", - "type": "bool" - } - ], - "name": "setStaking", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "staking", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "stakingHelper", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "standardizedDebtRatio", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "terms", - "outputs": [ - { - "internalType": "uint256", - "name": "controlVariable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "vestingTerm", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minimumPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxPayout", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxDebt", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalDebt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "treasury", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "useHelper", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } -] diff --git a/src/apps/olympus/contracts/abis/olympus-v-2-bond-depository.json b/src/apps/olympus/contracts/abis/olympus-v-2-bond-depository.json new file mode 100644 index 000000000..63ea923fd --- /dev/null +++ b/src/apps/olympus/contracts/abis/olympus-v-2-bond-depository.json @@ -0,0 +1,363 @@ +[ + { + "inputs": [ + { "internalType": "contract IOlympusAuthority", "name": "_authority", "type": "address" }, + { "internalType": "contract IERC20", "name": "_ohm", "type": "address" }, + { "internalType": "contract IgOHM", "name": "_gohm", "type": "address" }, + { "internalType": "contract IStaking", "name": "_staking", "type": "address" }, + { "internalType": "contract ITreasury", "name": "_treasury", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "contract IOlympusAuthority", "name": "authority", "type": "address" } + ], + "name": "AuthorityUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "id", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "price", "type": "uint256" } + ], + "name": "Bond", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "uint256", "name": "id", "type": "uint256" }], + "name": "CloseMarket", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "id", "type": "uint256" }, + { "indexed": true, "internalType": "address", "name": "baseToken", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "quoteToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "initialPrice", "type": "uint256" } + ], + "name": "CreateMarket", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "id", "type": "uint256" }, + { "indexed": false, "internalType": "uint64", "name": "oldControlVariable", "type": "uint64" }, + { "indexed": false, "internalType": "uint64", "name": "newControlVariable", "type": "uint64" } + ], + "name": "Tuned", + "type": "event" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "adjustments", + "outputs": [ + { "internalType": "uint64", "name": "change", "type": "uint64" }, + { "internalType": "uint48", "name": "lastAdjustment", "type": "uint48" }, + { "internalType": "uint48", "name": "timeToAdjusted", "type": "uint48" }, + { "internalType": "bool", "name": "active", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "authority", + "outputs": [{ "internalType": "contract IOlympusAuthority", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_id", "type": "uint256" }], + "name": "close", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract IERC20", "name": "_quoteToken", "type": "address" }, + { "internalType": "uint256[3]", "name": "_market", "type": "uint256[3]" }, + { "internalType": "bool[2]", "name": "_booleans", "type": "bool[2]" }, + { "internalType": "uint256[2]", "name": "_terms", "type": "uint256[2]" }, + { "internalType": "uint32[2]", "name": "_intervals", "type": "uint32[2]" } + ], + "name": "create", + "outputs": [{ "internalType": "uint256", "name": "id_", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_id", "type": "uint256" }], + "name": "currentControlVariable", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_id", "type": "uint256" }], + "name": "currentDebt", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "daoReward", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_id", "type": "uint256" }], + "name": "debtDecay", + "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_id", "type": "uint256" }], + "name": "debtRatio", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_id", "type": "uint256" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" }, + { "internalType": "uint256", "name": "_maxPrice", "type": "uint256" }, + { "internalType": "address", "name": "_user", "type": "address" }, + { "internalType": "address", "name": "_referral", "type": "address" } + ], + "name": "deposit", + "outputs": [ + { "internalType": "uint256", "name": "payout_", "type": "uint256" }, + { "internalType": "uint256", "name": "expiry_", "type": "uint256" }, + { "internalType": "uint256", "name": "index_", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "getReward", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }], + "name": "indexesFor", + "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_id", "type": "uint256" }], + "name": "isLive", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liveMarkets", + "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_token", "type": "address" }], + "name": "liveMarketsFor", + "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_id", "type": "uint256" }], + "name": "marketPrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "markets", + "outputs": [ + { "internalType": "uint256", "name": "capacity", "type": "uint256" }, + { "internalType": "contract IERC20", "name": "quoteToken", "type": "address" }, + { "internalType": "bool", "name": "capacityInQuote", "type": "bool" }, + { "internalType": "uint64", "name": "totalDebt", "type": "uint64" }, + { "internalType": "uint64", "name": "maxPayout", "type": "uint64" }, + { "internalType": "uint64", "name": "sold", "type": "uint64" }, + { "internalType": "uint256", "name": "purchased", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "marketsForQuote", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "metadata", + "outputs": [ + { "internalType": "uint48", "name": "lastTune", "type": "uint48" }, + { "internalType": "uint48", "name": "lastDecay", "type": "uint48" }, + { "internalType": "uint48", "name": "length", "type": "uint48" }, + { "internalType": "uint48", "name": "depositInterval", "type": "uint48" }, + { "internalType": "uint48", "name": "tuneInterval", "type": "uint48" }, + { "internalType": "uint8", "name": "quoteDecimals", "type": "uint8" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "notes", + "outputs": [ + { "internalType": "uint256", "name": "payout", "type": "uint256" }, + { "internalType": "uint48", "name": "created", "type": "uint48" }, + { "internalType": "uint48", "name": "matured", "type": "uint48" }, + { "internalType": "uint48", "name": "redeemed", "type": "uint48" }, + { "internalType": "uint48", "name": "marketID", "type": "uint48" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_amount", "type": "uint256" }, + { "internalType": "uint256", "name": "_id", "type": "uint256" } + ], + "name": "payoutFor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_user", "type": "address" }, + { "internalType": "uint256", "name": "_index", "type": "uint256" } + ], + "name": "pendingFor", + "outputs": [ + { "internalType": "uint256", "name": "payout_", "type": "uint256" }, + { "internalType": "bool", "name": "matured_", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_from", "type": "address" }, + { "internalType": "uint256", "name": "_index", "type": "uint256" } + ], + "name": "pullNote", + "outputs": [{ "internalType": "uint256", "name": "newIndex_", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_to", "type": "address" }, + { "internalType": "uint256", "name": "_index", "type": "uint256" } + ], + "name": "pushNote", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_user", "type": "address" }, + { "internalType": "uint256[]", "name": "_indexes", "type": "uint256[]" }, + { "internalType": "bool", "name": "_sendgOHM", "type": "bool" } + ], + "name": "redeem", + "outputs": [{ "internalType": "uint256", "name": "payout_", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_user", "type": "address" }, + { "internalType": "bool", "name": "_sendgOHM", "type": "bool" } + ], + "name": "redeemAll", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "refReward", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "rewards", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract IOlympusAuthority", "name": "_newAuthority", "type": "address" }], + "name": "setAuthority", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_toFrontEnd", "type": "uint256" }, + { "internalType": "uint256", "name": "_toDAO", "type": "uint256" } + ], + "name": "setRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "terms", + "outputs": [ + { "internalType": "bool", "name": "fixedTerm", "type": "bool" }, + { "internalType": "uint64", "name": "controlVariable", "type": "uint64" }, + { "internalType": "uint48", "name": "vesting", "type": "uint48" }, + { "internalType": "uint48", "name": "conclusion", "type": "uint48" }, + { "internalType": "uint64", "name": "maxDebt", "type": "uint64" } + ], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "updateTreasury", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "_operator", "type": "address" }], + "name": "whitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "whitelisted", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/src/apps/olympus/contracts/ethers/OlympusBondDepository.ts b/src/apps/olympus/contracts/ethers/OlympusBondDepository.ts deleted file mode 100644 index 253904d33..000000000 --- a/src/apps/olympus/contracts/ethers/OlympusBondDepository.ts +++ /dev/null @@ -1,940 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BigNumber, - BigNumberish, - BytesLike, - CallOverrides, - ContractTransaction, - Overrides, - PopulatedTransaction, - Signer, - utils, -} from 'ethers'; -import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi'; -import type { Listener, Provider } from '@ethersproject/providers'; -import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from './common'; - -export interface OlympusBondDepositoryInterface extends utils.Interface { - functions: { - 'DAO()': FunctionFragment; - 'OHM()': FunctionFragment; - 'adjustment()': FunctionFragment; - 'bondCalculator()': FunctionFragment; - 'bondInfo(address)': FunctionFragment; - 'bondPrice()': FunctionFragment; - 'bondPriceInUSD()': FunctionFragment; - 'currentDebt()': FunctionFragment; - 'debtDecay()': FunctionFragment; - 'debtRatio()': FunctionFragment; - 'deposit(uint256,uint256,address)': FunctionFragment; - 'initializeBondTerms(uint256,uint256,uint256,uint256,uint256,uint256,uint256)': FunctionFragment; - 'isLiquidityBond()': FunctionFragment; - 'lastDecay()': FunctionFragment; - 'maxPayout()': FunctionFragment; - 'payoutFor(uint256)': FunctionFragment; - 'pendingPayoutFor(address)': FunctionFragment; - 'percentVestedFor(address)': FunctionFragment; - 'policy()': FunctionFragment; - 'principle()': FunctionFragment; - 'pullManagement()': FunctionFragment; - 'pushManagement(address)': FunctionFragment; - 'recoverLostToken(address)': FunctionFragment; - 'redeem(address,bool)': FunctionFragment; - 'renounceManagement()': FunctionFragment; - 'setAdjustment(bool,uint256,uint256,uint256)': FunctionFragment; - 'setBondTerms(uint8,uint256)': FunctionFragment; - 'setStaking(address,bool)': FunctionFragment; - 'staking()': FunctionFragment; - 'stakingHelper()': FunctionFragment; - 'standardizedDebtRatio()': FunctionFragment; - 'terms()': FunctionFragment; - 'totalDebt()': FunctionFragment; - 'treasury()': FunctionFragment; - 'useHelper()': FunctionFragment; - }; - - getFunction( - nameOrSignatureOrTopic: - | 'DAO' - | 'OHM' - | 'adjustment' - | 'bondCalculator' - | 'bondInfo' - | 'bondPrice' - | 'bondPriceInUSD' - | 'currentDebt' - | 'debtDecay' - | 'debtRatio' - | 'deposit' - | 'initializeBondTerms' - | 'isLiquidityBond' - | 'lastDecay' - | 'maxPayout' - | 'payoutFor' - | 'pendingPayoutFor' - | 'percentVestedFor' - | 'policy' - | 'principle' - | 'pullManagement' - | 'pushManagement' - | 'recoverLostToken' - | 'redeem' - | 'renounceManagement' - | 'setAdjustment' - | 'setBondTerms' - | 'setStaking' - | 'staking' - | 'stakingHelper' - | 'standardizedDebtRatio' - | 'terms' - | 'totalDebt' - | 'treasury' - | 'useHelper', - ): FunctionFragment; - - encodeFunctionData(functionFragment: 'DAO', values?: undefined): string; - encodeFunctionData(functionFragment: 'OHM', values?: undefined): string; - encodeFunctionData(functionFragment: 'adjustment', values?: undefined): string; - encodeFunctionData(functionFragment: 'bondCalculator', values?: undefined): string; - encodeFunctionData(functionFragment: 'bondInfo', values: [string]): string; - encodeFunctionData(functionFragment: 'bondPrice', values?: undefined): string; - encodeFunctionData(functionFragment: 'bondPriceInUSD', values?: undefined): string; - encodeFunctionData(functionFragment: 'currentDebt', values?: undefined): string; - encodeFunctionData(functionFragment: 'debtDecay', values?: undefined): string; - encodeFunctionData(functionFragment: 'debtRatio', values?: undefined): string; - encodeFunctionData(functionFragment: 'deposit', values: [BigNumberish, BigNumberish, string]): string; - encodeFunctionData( - functionFragment: 'initializeBondTerms', - values: [BigNumberish, BigNumberish, BigNumberish, BigNumberish, BigNumberish, BigNumberish, BigNumberish], - ): string; - encodeFunctionData(functionFragment: 'isLiquidityBond', values?: undefined): string; - encodeFunctionData(functionFragment: 'lastDecay', values?: undefined): string; - encodeFunctionData(functionFragment: 'maxPayout', values?: undefined): string; - encodeFunctionData(functionFragment: 'payoutFor', values: [BigNumberish]): string; - encodeFunctionData(functionFragment: 'pendingPayoutFor', values: [string]): string; - encodeFunctionData(functionFragment: 'percentVestedFor', values: [string]): string; - encodeFunctionData(functionFragment: 'policy', values?: undefined): string; - encodeFunctionData(functionFragment: 'principle', values?: undefined): string; - encodeFunctionData(functionFragment: 'pullManagement', values?: undefined): string; - encodeFunctionData(functionFragment: 'pushManagement', values: [string]): string; - encodeFunctionData(functionFragment: 'recoverLostToken', values: [string]): string; - encodeFunctionData(functionFragment: 'redeem', values: [string, boolean]): string; - encodeFunctionData(functionFragment: 'renounceManagement', values?: undefined): string; - encodeFunctionData( - functionFragment: 'setAdjustment', - values: [boolean, BigNumberish, BigNumberish, BigNumberish], - ): string; - encodeFunctionData(functionFragment: 'setBondTerms', values: [BigNumberish, BigNumberish]): string; - encodeFunctionData(functionFragment: 'setStaking', values: [string, boolean]): string; - encodeFunctionData(functionFragment: 'staking', values?: undefined): string; - encodeFunctionData(functionFragment: 'stakingHelper', values?: undefined): string; - encodeFunctionData(functionFragment: 'standardizedDebtRatio', values?: undefined): string; - encodeFunctionData(functionFragment: 'terms', values?: undefined): string; - encodeFunctionData(functionFragment: 'totalDebt', values?: undefined): string; - encodeFunctionData(functionFragment: 'treasury', values?: undefined): string; - encodeFunctionData(functionFragment: 'useHelper', values?: undefined): string; - - decodeFunctionResult(functionFragment: 'DAO', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'OHM', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'adjustment', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'bondCalculator', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'bondInfo', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'bondPrice', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'bondPriceInUSD', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'currentDebt', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'debtDecay', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'debtRatio', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'deposit', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'initializeBondTerms', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'isLiquidityBond', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'lastDecay', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'maxPayout', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'payoutFor', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'pendingPayoutFor', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'percentVestedFor', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'policy', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'principle', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'pullManagement', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'pushManagement', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'recoverLostToken', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'redeem', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'renounceManagement', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'setAdjustment', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'setBondTerms', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'setStaking', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'staking', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'stakingHelper', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'standardizedDebtRatio', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'terms', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'totalDebt', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'treasury', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'useHelper', data: BytesLike): Result; - - events: { - 'BondCreated(uint256,uint256,uint256,uint256)': EventFragment; - 'BondPriceChanged(uint256,uint256,uint256)': EventFragment; - 'BondRedeemed(address,uint256,uint256)': EventFragment; - 'ControlVariableAdjustment(uint256,uint256,uint256,bool)': EventFragment; - 'OwnershipPulled(address,address)': EventFragment; - 'OwnershipPushed(address,address)': EventFragment; - }; - - getEvent(nameOrSignatureOrTopic: 'BondCreated'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'BondPriceChanged'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'BondRedeemed'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'ControlVariableAdjustment'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'OwnershipPulled'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'OwnershipPushed'): EventFragment; -} - -export interface BondCreatedEventObject { - deposit: BigNumber; - payout: BigNumber; - expires: BigNumber; - priceInUSD: BigNumber; -} -export type BondCreatedEvent = TypedEvent<[BigNumber, BigNumber, BigNumber, BigNumber], BondCreatedEventObject>; - -export type BondCreatedEventFilter = TypedEventFilter; - -export interface BondPriceChangedEventObject { - priceInUSD: BigNumber; - internalPrice: BigNumber; - debtRatio: BigNumber; -} -export type BondPriceChangedEvent = TypedEvent<[BigNumber, BigNumber, BigNumber], BondPriceChangedEventObject>; - -export type BondPriceChangedEventFilter = TypedEventFilter; - -export interface BondRedeemedEventObject { - recipient: string; - payout: BigNumber; - remaining: BigNumber; -} -export type BondRedeemedEvent = TypedEvent<[string, BigNumber, BigNumber], BondRedeemedEventObject>; - -export type BondRedeemedEventFilter = TypedEventFilter; - -export interface ControlVariableAdjustmentEventObject { - initialBCV: BigNumber; - newBCV: BigNumber; - adjustment: BigNumber; - addition: boolean; -} -export type ControlVariableAdjustmentEvent = TypedEvent< - [BigNumber, BigNumber, BigNumber, boolean], - ControlVariableAdjustmentEventObject ->; - -export type ControlVariableAdjustmentEventFilter = TypedEventFilter; - -export interface OwnershipPulledEventObject { - previousOwner: string; - newOwner: string; -} -export type OwnershipPulledEvent = TypedEvent<[string, string], OwnershipPulledEventObject>; - -export type OwnershipPulledEventFilter = TypedEventFilter; - -export interface OwnershipPushedEventObject { - previousOwner: string; - newOwner: string; -} -export type OwnershipPushedEvent = TypedEvent<[string, string], OwnershipPushedEventObject>; - -export type OwnershipPushedEventFilter = TypedEventFilter; - -export interface OlympusBondDepository extends BaseContract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - interface: OlympusBondDepositoryInterface; - - queryFilter( - event: TypedEventFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>; - - listeners(eventFilter?: TypedEventFilter): Array>; - listeners(eventName?: string): Array; - removeAllListeners(eventFilter: TypedEventFilter): this; - removeAllListeners(eventName?: string): this; - off: OnEvent; - on: OnEvent; - once: OnEvent; - removeListener: OnEvent; - - functions: { - DAO(overrides?: CallOverrides): Promise<[string]>; - - OHM(overrides?: CallOverrides): Promise<[string]>; - - adjustment(overrides?: CallOverrides): Promise< - [boolean, BigNumber, BigNumber, BigNumber, BigNumber] & { - add: boolean; - rate: BigNumber; - target: BigNumber; - buffer: BigNumber; - lastBlock: BigNumber; - } - >; - - bondCalculator(overrides?: CallOverrides): Promise<[string]>; - - bondInfo( - arg0: string, - overrides?: CallOverrides, - ): Promise< - [BigNumber, BigNumber, BigNumber, BigNumber] & { - payout: BigNumber; - vesting: BigNumber; - lastBlock: BigNumber; - pricePaid: BigNumber; - } - >; - - bondPrice(overrides?: CallOverrides): Promise<[BigNumber] & { price_: BigNumber }>; - - bondPriceInUSD(overrides?: CallOverrides): Promise<[BigNumber] & { price_: BigNumber }>; - - currentDebt(overrides?: CallOverrides): Promise<[BigNumber]>; - - debtDecay(overrides?: CallOverrides): Promise<[BigNumber] & { decay_: BigNumber }>; - - debtRatio(overrides?: CallOverrides): Promise<[BigNumber] & { debtRatio_: BigNumber }>; - - deposit( - _amount: BigNumberish, - _maxPrice: BigNumberish, - _depositor: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - initializeBondTerms( - _controlVariable: BigNumberish, - _vestingTerm: BigNumberish, - _minimumPrice: BigNumberish, - _maxPayout: BigNumberish, - _fee: BigNumberish, - _maxDebt: BigNumberish, - _initialDebt: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - isLiquidityBond(overrides?: CallOverrides): Promise<[boolean]>; - - lastDecay(overrides?: CallOverrides): Promise<[BigNumber]>; - - maxPayout(overrides?: CallOverrides): Promise<[BigNumber]>; - - payoutFor(_value: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; - - pendingPayoutFor( - _depositor: string, - overrides?: CallOverrides, - ): Promise<[BigNumber] & { pendingPayout_: BigNumber }>; - - percentVestedFor( - _depositor: string, - overrides?: CallOverrides, - ): Promise<[BigNumber] & { percentVested_: BigNumber }>; - - policy(overrides?: CallOverrides): Promise<[string]>; - - principle(overrides?: CallOverrides): Promise<[string]>; - - pullManagement(overrides?: Overrides & { from?: string | Promise }): Promise; - - pushManagement( - newOwner_: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - recoverLostToken( - _token: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - redeem( - _recipient: string, - _stake: boolean, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - renounceManagement(overrides?: Overrides & { from?: string | Promise }): Promise; - - setAdjustment( - _addition: boolean, - _increment: BigNumberish, - _target: BigNumberish, - _buffer: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setBondTerms( - _parameter: BigNumberish, - _input: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setStaking( - _staking: string, - _helper: boolean, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - staking(overrides?: CallOverrides): Promise<[string]>; - - stakingHelper(overrides?: CallOverrides): Promise<[string]>; - - standardizedDebtRatio(overrides?: CallOverrides): Promise<[BigNumber]>; - - terms(overrides?: CallOverrides): Promise< - [BigNumber, BigNumber, BigNumber, BigNumber, BigNumber, BigNumber] & { - controlVariable: BigNumber; - vestingTerm: BigNumber; - minimumPrice: BigNumber; - maxPayout: BigNumber; - fee: BigNumber; - maxDebt: BigNumber; - } - >; - - totalDebt(overrides?: CallOverrides): Promise<[BigNumber]>; - - treasury(overrides?: CallOverrides): Promise<[string]>; - - useHelper(overrides?: CallOverrides): Promise<[boolean]>; - }; - - DAO(overrides?: CallOverrides): Promise; - - OHM(overrides?: CallOverrides): Promise; - - adjustment(overrides?: CallOverrides): Promise< - [boolean, BigNumber, BigNumber, BigNumber, BigNumber] & { - add: boolean; - rate: BigNumber; - target: BigNumber; - buffer: BigNumber; - lastBlock: BigNumber; - } - >; - - bondCalculator(overrides?: CallOverrides): Promise; - - bondInfo( - arg0: string, - overrides?: CallOverrides, - ): Promise< - [BigNumber, BigNumber, BigNumber, BigNumber] & { - payout: BigNumber; - vesting: BigNumber; - lastBlock: BigNumber; - pricePaid: BigNumber; - } - >; - - bondPrice(overrides?: CallOverrides): Promise; - - bondPriceInUSD(overrides?: CallOverrides): Promise; - - currentDebt(overrides?: CallOverrides): Promise; - - debtDecay(overrides?: CallOverrides): Promise; - - debtRatio(overrides?: CallOverrides): Promise; - - deposit( - _amount: BigNumberish, - _maxPrice: BigNumberish, - _depositor: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - initializeBondTerms( - _controlVariable: BigNumberish, - _vestingTerm: BigNumberish, - _minimumPrice: BigNumberish, - _maxPayout: BigNumberish, - _fee: BigNumberish, - _maxDebt: BigNumberish, - _initialDebt: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - isLiquidityBond(overrides?: CallOverrides): Promise; - - lastDecay(overrides?: CallOverrides): Promise; - - maxPayout(overrides?: CallOverrides): Promise; - - payoutFor(_value: BigNumberish, overrides?: CallOverrides): Promise; - - pendingPayoutFor(_depositor: string, overrides?: CallOverrides): Promise; - - percentVestedFor(_depositor: string, overrides?: CallOverrides): Promise; - - policy(overrides?: CallOverrides): Promise; - - principle(overrides?: CallOverrides): Promise; - - pullManagement(overrides?: Overrides & { from?: string | Promise }): Promise; - - pushManagement( - newOwner_: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - recoverLostToken( - _token: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - redeem( - _recipient: string, - _stake: boolean, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - renounceManagement(overrides?: Overrides & { from?: string | Promise }): Promise; - - setAdjustment( - _addition: boolean, - _increment: BigNumberish, - _target: BigNumberish, - _buffer: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setBondTerms( - _parameter: BigNumberish, - _input: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setStaking( - _staking: string, - _helper: boolean, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - staking(overrides?: CallOverrides): Promise; - - stakingHelper(overrides?: CallOverrides): Promise; - - standardizedDebtRatio(overrides?: CallOverrides): Promise; - - terms(overrides?: CallOverrides): Promise< - [BigNumber, BigNumber, BigNumber, BigNumber, BigNumber, BigNumber] & { - controlVariable: BigNumber; - vestingTerm: BigNumber; - minimumPrice: BigNumber; - maxPayout: BigNumber; - fee: BigNumber; - maxDebt: BigNumber; - } - >; - - totalDebt(overrides?: CallOverrides): Promise; - - treasury(overrides?: CallOverrides): Promise; - - useHelper(overrides?: CallOverrides): Promise; - - callStatic: { - DAO(overrides?: CallOverrides): Promise; - - OHM(overrides?: CallOverrides): Promise; - - adjustment(overrides?: CallOverrides): Promise< - [boolean, BigNumber, BigNumber, BigNumber, BigNumber] & { - add: boolean; - rate: BigNumber; - target: BigNumber; - buffer: BigNumber; - lastBlock: BigNumber; - } - >; - - bondCalculator(overrides?: CallOverrides): Promise; - - bondInfo( - arg0: string, - overrides?: CallOverrides, - ): Promise< - [BigNumber, BigNumber, BigNumber, BigNumber] & { - payout: BigNumber; - vesting: BigNumber; - lastBlock: BigNumber; - pricePaid: BigNumber; - } - >; - - bondPrice(overrides?: CallOverrides): Promise; - - bondPriceInUSD(overrides?: CallOverrides): Promise; - - currentDebt(overrides?: CallOverrides): Promise; - - debtDecay(overrides?: CallOverrides): Promise; - - debtRatio(overrides?: CallOverrides): Promise; - - deposit( - _amount: BigNumberish, - _maxPrice: BigNumberish, - _depositor: string, - overrides?: CallOverrides, - ): Promise; - - initializeBondTerms( - _controlVariable: BigNumberish, - _vestingTerm: BigNumberish, - _minimumPrice: BigNumberish, - _maxPayout: BigNumberish, - _fee: BigNumberish, - _maxDebt: BigNumberish, - _initialDebt: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - isLiquidityBond(overrides?: CallOverrides): Promise; - - lastDecay(overrides?: CallOverrides): Promise; - - maxPayout(overrides?: CallOverrides): Promise; - - payoutFor(_value: BigNumberish, overrides?: CallOverrides): Promise; - - pendingPayoutFor(_depositor: string, overrides?: CallOverrides): Promise; - - percentVestedFor(_depositor: string, overrides?: CallOverrides): Promise; - - policy(overrides?: CallOverrides): Promise; - - principle(overrides?: CallOverrides): Promise; - - pullManagement(overrides?: CallOverrides): Promise; - - pushManagement(newOwner_: string, overrides?: CallOverrides): Promise; - - recoverLostToken(_token: string, overrides?: CallOverrides): Promise; - - redeem(_recipient: string, _stake: boolean, overrides?: CallOverrides): Promise; - - renounceManagement(overrides?: CallOverrides): Promise; - - setAdjustment( - _addition: boolean, - _increment: BigNumberish, - _target: BigNumberish, - _buffer: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - setBondTerms(_parameter: BigNumberish, _input: BigNumberish, overrides?: CallOverrides): Promise; - - setStaking(_staking: string, _helper: boolean, overrides?: CallOverrides): Promise; - - staking(overrides?: CallOverrides): Promise; - - stakingHelper(overrides?: CallOverrides): Promise; - - standardizedDebtRatio(overrides?: CallOverrides): Promise; - - terms(overrides?: CallOverrides): Promise< - [BigNumber, BigNumber, BigNumber, BigNumber, BigNumber, BigNumber] & { - controlVariable: BigNumber; - vestingTerm: BigNumber; - minimumPrice: BigNumber; - maxPayout: BigNumber; - fee: BigNumber; - maxDebt: BigNumber; - } - >; - - totalDebt(overrides?: CallOverrides): Promise; - - treasury(overrides?: CallOverrides): Promise; - - useHelper(overrides?: CallOverrides): Promise; - }; - - filters: { - 'BondCreated(uint256,uint256,uint256,uint256)'( - deposit?: null, - payout?: BigNumberish | null, - expires?: BigNumberish | null, - priceInUSD?: BigNumberish | null, - ): BondCreatedEventFilter; - BondCreated( - deposit?: null, - payout?: BigNumberish | null, - expires?: BigNumberish | null, - priceInUSD?: BigNumberish | null, - ): BondCreatedEventFilter; - - 'BondPriceChanged(uint256,uint256,uint256)'( - priceInUSD?: BigNumberish | null, - internalPrice?: BigNumberish | null, - debtRatio?: BigNumberish | null, - ): BondPriceChangedEventFilter; - BondPriceChanged( - priceInUSD?: BigNumberish | null, - internalPrice?: BigNumberish | null, - debtRatio?: BigNumberish | null, - ): BondPriceChangedEventFilter; - - 'BondRedeemed(address,uint256,uint256)'( - recipient?: string | null, - payout?: null, - remaining?: null, - ): BondRedeemedEventFilter; - BondRedeemed(recipient?: string | null, payout?: null, remaining?: null): BondRedeemedEventFilter; - - 'ControlVariableAdjustment(uint256,uint256,uint256,bool)'( - initialBCV?: null, - newBCV?: null, - adjustment?: null, - addition?: null, - ): ControlVariableAdjustmentEventFilter; - ControlVariableAdjustment( - initialBCV?: null, - newBCV?: null, - adjustment?: null, - addition?: null, - ): ControlVariableAdjustmentEventFilter; - - 'OwnershipPulled(address,address)'( - previousOwner?: string | null, - newOwner?: string | null, - ): OwnershipPulledEventFilter; - OwnershipPulled(previousOwner?: string | null, newOwner?: string | null): OwnershipPulledEventFilter; - - 'OwnershipPushed(address,address)'( - previousOwner?: string | null, - newOwner?: string | null, - ): OwnershipPushedEventFilter; - OwnershipPushed(previousOwner?: string | null, newOwner?: string | null): OwnershipPushedEventFilter; - }; - - estimateGas: { - DAO(overrides?: CallOverrides): Promise; - - OHM(overrides?: CallOverrides): Promise; - - adjustment(overrides?: CallOverrides): Promise; - - bondCalculator(overrides?: CallOverrides): Promise; - - bondInfo(arg0: string, overrides?: CallOverrides): Promise; - - bondPrice(overrides?: CallOverrides): Promise; - - bondPriceInUSD(overrides?: CallOverrides): Promise; - - currentDebt(overrides?: CallOverrides): Promise; - - debtDecay(overrides?: CallOverrides): Promise; - - debtRatio(overrides?: CallOverrides): Promise; - - deposit( - _amount: BigNumberish, - _maxPrice: BigNumberish, - _depositor: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - initializeBondTerms( - _controlVariable: BigNumberish, - _vestingTerm: BigNumberish, - _minimumPrice: BigNumberish, - _maxPayout: BigNumberish, - _fee: BigNumberish, - _maxDebt: BigNumberish, - _initialDebt: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - isLiquidityBond(overrides?: CallOverrides): Promise; - - lastDecay(overrides?: CallOverrides): Promise; - - maxPayout(overrides?: CallOverrides): Promise; - - payoutFor(_value: BigNumberish, overrides?: CallOverrides): Promise; - - pendingPayoutFor(_depositor: string, overrides?: CallOverrides): Promise; - - percentVestedFor(_depositor: string, overrides?: CallOverrides): Promise; - - policy(overrides?: CallOverrides): Promise; - - principle(overrides?: CallOverrides): Promise; - - pullManagement(overrides?: Overrides & { from?: string | Promise }): Promise; - - pushManagement(newOwner_: string, overrides?: Overrides & { from?: string | Promise }): Promise; - - recoverLostToken(_token: string, overrides?: Overrides & { from?: string | Promise }): Promise; - - redeem( - _recipient: string, - _stake: boolean, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - renounceManagement(overrides?: Overrides & { from?: string | Promise }): Promise; - - setAdjustment( - _addition: boolean, - _increment: BigNumberish, - _target: BigNumberish, - _buffer: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setBondTerms( - _parameter: BigNumberish, - _input: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setStaking( - _staking: string, - _helper: boolean, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - staking(overrides?: CallOverrides): Promise; - - stakingHelper(overrides?: CallOverrides): Promise; - - standardizedDebtRatio(overrides?: CallOverrides): Promise; - - terms(overrides?: CallOverrides): Promise; - - totalDebt(overrides?: CallOverrides): Promise; - - treasury(overrides?: CallOverrides): Promise; - - useHelper(overrides?: CallOverrides): Promise; - }; - - populateTransaction: { - DAO(overrides?: CallOverrides): Promise; - - OHM(overrides?: CallOverrides): Promise; - - adjustment(overrides?: CallOverrides): Promise; - - bondCalculator(overrides?: CallOverrides): Promise; - - bondInfo(arg0: string, overrides?: CallOverrides): Promise; - - bondPrice(overrides?: CallOverrides): Promise; - - bondPriceInUSD(overrides?: CallOverrides): Promise; - - currentDebt(overrides?: CallOverrides): Promise; - - debtDecay(overrides?: CallOverrides): Promise; - - debtRatio(overrides?: CallOverrides): Promise; - - deposit( - _amount: BigNumberish, - _maxPrice: BigNumberish, - _depositor: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - initializeBondTerms( - _controlVariable: BigNumberish, - _vestingTerm: BigNumberish, - _minimumPrice: BigNumberish, - _maxPayout: BigNumberish, - _fee: BigNumberish, - _maxDebt: BigNumberish, - _initialDebt: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - isLiquidityBond(overrides?: CallOverrides): Promise; - - lastDecay(overrides?: CallOverrides): Promise; - - maxPayout(overrides?: CallOverrides): Promise; - - payoutFor(_value: BigNumberish, overrides?: CallOverrides): Promise; - - pendingPayoutFor(_depositor: string, overrides?: CallOverrides): Promise; - - percentVestedFor(_depositor: string, overrides?: CallOverrides): Promise; - - policy(overrides?: CallOverrides): Promise; - - principle(overrides?: CallOverrides): Promise; - - pullManagement(overrides?: Overrides & { from?: string | Promise }): Promise; - - pushManagement( - newOwner_: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - recoverLostToken( - _token: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - redeem( - _recipient: string, - _stake: boolean, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - renounceManagement(overrides?: Overrides & { from?: string | Promise }): Promise; - - setAdjustment( - _addition: boolean, - _increment: BigNumberish, - _target: BigNumberish, - _buffer: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setBondTerms( - _parameter: BigNumberish, - _input: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setStaking( - _staking: string, - _helper: boolean, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - staking(overrides?: CallOverrides): Promise; - - stakingHelper(overrides?: CallOverrides): Promise; - - standardizedDebtRatio(overrides?: CallOverrides): Promise; - - terms(overrides?: CallOverrides): Promise; - - totalDebt(overrides?: CallOverrides): Promise; - - treasury(overrides?: CallOverrides): Promise; - - useHelper(overrides?: CallOverrides): Promise; - }; -} diff --git a/src/apps/olympus/contracts/ethers/OlympusV2BondDepository.ts b/src/apps/olympus/contracts/ethers/OlympusV2BondDepository.ts new file mode 100644 index 000000000..ebe6e85cc --- /dev/null +++ b/src/apps/olympus/contracts/ethers/OlympusV2BondDepository.ts @@ -0,0 +1,1005 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PopulatedTransaction, + Signer, + utils, +} from 'ethers'; +import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi'; +import type { Listener, Provider } from '@ethersproject/providers'; +import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from './common'; + +export interface OlympusV2BondDepositoryInterface extends utils.Interface { + functions: { + 'adjustments(uint256)': FunctionFragment; + 'authority()': FunctionFragment; + 'close(uint256)': FunctionFragment; + 'create(address,uint256[3],bool[2],uint256[2],uint32[2])': FunctionFragment; + 'currentControlVariable(uint256)': FunctionFragment; + 'currentDebt(uint256)': FunctionFragment; + 'daoReward()': FunctionFragment; + 'debtDecay(uint256)': FunctionFragment; + 'debtRatio(uint256)': FunctionFragment; + 'deposit(uint256,uint256,uint256,address,address)': FunctionFragment; + 'getReward()': FunctionFragment; + 'indexesFor(address)': FunctionFragment; + 'isLive(uint256)': FunctionFragment; + 'liveMarkets()': FunctionFragment; + 'liveMarketsFor(address)': FunctionFragment; + 'marketPrice(uint256)': FunctionFragment; + 'markets(uint256)': FunctionFragment; + 'marketsForQuote(address,uint256)': FunctionFragment; + 'metadata(uint256)': FunctionFragment; + 'notes(address,uint256)': FunctionFragment; + 'payoutFor(uint256,uint256)': FunctionFragment; + 'pendingFor(address,uint256)': FunctionFragment; + 'pullNote(address,uint256)': FunctionFragment; + 'pushNote(address,uint256)': FunctionFragment; + 'redeem(address,uint256[],bool)': FunctionFragment; + 'redeemAll(address,bool)': FunctionFragment; + 'refReward()': FunctionFragment; + 'rewards(address)': FunctionFragment; + 'setAuthority(address)': FunctionFragment; + 'setRewards(uint256,uint256)': FunctionFragment; + 'terms(uint256)': FunctionFragment; + 'updateTreasury()': FunctionFragment; + 'whitelist(address)': FunctionFragment; + 'whitelisted(address)': FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | 'adjustments' + | 'authority' + | 'close' + | 'create' + | 'currentControlVariable' + | 'currentDebt' + | 'daoReward' + | 'debtDecay' + | 'debtRatio' + | 'deposit' + | 'getReward' + | 'indexesFor' + | 'isLive' + | 'liveMarkets' + | 'liveMarketsFor' + | 'marketPrice' + | 'markets' + | 'marketsForQuote' + | 'metadata' + | 'notes' + | 'payoutFor' + | 'pendingFor' + | 'pullNote' + | 'pushNote' + | 'redeem' + | 'redeemAll' + | 'refReward' + | 'rewards' + | 'setAuthority' + | 'setRewards' + | 'terms' + | 'updateTreasury' + | 'whitelist' + | 'whitelisted', + ): FunctionFragment; + + encodeFunctionData(functionFragment: 'adjustments', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'authority', values?: undefined): string; + encodeFunctionData(functionFragment: 'close', values: [BigNumberish]): string; + encodeFunctionData( + functionFragment: 'create', + values: [ + string, + [BigNumberish, BigNumberish, BigNumberish], + [boolean, boolean], + [BigNumberish, BigNumberish], + [BigNumberish, BigNumberish], + ], + ): string; + encodeFunctionData(functionFragment: 'currentControlVariable', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'currentDebt', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'daoReward', values?: undefined): string; + encodeFunctionData(functionFragment: 'debtDecay', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'debtRatio', values: [BigNumberish]): string; + encodeFunctionData( + functionFragment: 'deposit', + values: [BigNumberish, BigNumberish, BigNumberish, string, string], + ): string; + encodeFunctionData(functionFragment: 'getReward', values?: undefined): string; + encodeFunctionData(functionFragment: 'indexesFor', values: [string]): string; + encodeFunctionData(functionFragment: 'isLive', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'liveMarkets', values?: undefined): string; + encodeFunctionData(functionFragment: 'liveMarketsFor', values: [string]): string; + encodeFunctionData(functionFragment: 'marketPrice', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'markets', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'marketsForQuote', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'metadata', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'notes', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'payoutFor', values: [BigNumberish, BigNumberish]): string; + encodeFunctionData(functionFragment: 'pendingFor', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'pullNote', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'pushNote', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'redeem', values: [string, BigNumberish[], boolean]): string; + encodeFunctionData(functionFragment: 'redeemAll', values: [string, boolean]): string; + encodeFunctionData(functionFragment: 'refReward', values?: undefined): string; + encodeFunctionData(functionFragment: 'rewards', values: [string]): string; + encodeFunctionData(functionFragment: 'setAuthority', values: [string]): string; + encodeFunctionData(functionFragment: 'setRewards', values: [BigNumberish, BigNumberish]): string; + encodeFunctionData(functionFragment: 'terms', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'updateTreasury', values?: undefined): string; + encodeFunctionData(functionFragment: 'whitelist', values: [string]): string; + encodeFunctionData(functionFragment: 'whitelisted', values: [string]): string; + + decodeFunctionResult(functionFragment: 'adjustments', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'authority', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'close', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'create', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'currentControlVariable', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'currentDebt', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'daoReward', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'debtDecay', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'debtRatio', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'deposit', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'getReward', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'indexesFor', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'isLive', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'liveMarkets', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'liveMarketsFor', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'marketPrice', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'markets', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'marketsForQuote', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'metadata', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'notes', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'payoutFor', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'pendingFor', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'pullNote', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'pushNote', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'redeem', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'redeemAll', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'refReward', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'rewards', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setAuthority', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setRewards', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'terms', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'updateTreasury', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'whitelist', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'whitelisted', data: BytesLike): Result; + + events: { + 'AuthorityUpdated(address)': EventFragment; + 'Bond(uint256,uint256,uint256)': EventFragment; + 'CloseMarket(uint256)': EventFragment; + 'CreateMarket(uint256,address,address,uint256)': EventFragment; + 'Tuned(uint256,uint64,uint64)': EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: 'AuthorityUpdated'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'Bond'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'CloseMarket'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'CreateMarket'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'Tuned'): EventFragment; +} + +export interface AuthorityUpdatedEventObject { + authority: string; +} +export type AuthorityUpdatedEvent = TypedEvent<[string], AuthorityUpdatedEventObject>; + +export type AuthorityUpdatedEventFilter = TypedEventFilter; + +export interface BondEventObject { + id: BigNumber; + amount: BigNumber; + price: BigNumber; +} +export type BondEvent = TypedEvent<[BigNumber, BigNumber, BigNumber], BondEventObject>; + +export type BondEventFilter = TypedEventFilter; + +export interface CloseMarketEventObject { + id: BigNumber; +} +export type CloseMarketEvent = TypedEvent<[BigNumber], CloseMarketEventObject>; + +export type CloseMarketEventFilter = TypedEventFilter; + +export interface CreateMarketEventObject { + id: BigNumber; + baseToken: string; + quoteToken: string; + initialPrice: BigNumber; +} +export type CreateMarketEvent = TypedEvent<[BigNumber, string, string, BigNumber], CreateMarketEventObject>; + +export type CreateMarketEventFilter = TypedEventFilter; + +export interface TunedEventObject { + id: BigNumber; + oldControlVariable: BigNumber; + newControlVariable: BigNumber; +} +export type TunedEvent = TypedEvent<[BigNumber, BigNumber, BigNumber], TunedEventObject>; + +export type TunedEventFilter = TypedEventFilter; + +export interface OlympusV2BondDepository extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: OlympusV2BondDepositoryInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined, + ): Promise>; + + listeners(eventFilter?: TypedEventFilter): Array>; + listeners(eventName?: string): Array; + removeAllListeners(eventFilter: TypedEventFilter): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + adjustments( + arg0: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [BigNumber, number, number, boolean] & { + change: BigNumber; + lastAdjustment: number; + timeToAdjusted: number; + active: boolean; + } + >; + + authority(overrides?: CallOverrides): Promise<[string]>; + + close(_id: BigNumberish, overrides?: Overrides & { from?: string | Promise }): Promise; + + create( + _quoteToken: string, + _market: [BigNumberish, BigNumberish, BigNumberish], + _booleans: [boolean, boolean], + _terms: [BigNumberish, BigNumberish], + _intervals: [BigNumberish, BigNumberish], + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + currentControlVariable(_id: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; + + currentDebt(_id: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; + + daoReward(overrides?: CallOverrides): Promise<[BigNumber]>; + + debtDecay(_id: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; + + debtRatio(_id: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; + + deposit( + _id: BigNumberish, + _amount: BigNumberish, + _maxPrice: BigNumberish, + _user: string, + _referral: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + getReward(overrides?: Overrides & { from?: string | Promise }): Promise; + + indexesFor(_user: string, overrides?: CallOverrides): Promise<[BigNumber[]]>; + + isLive(_id: BigNumberish, overrides?: CallOverrides): Promise<[boolean]>; + + liveMarkets(overrides?: CallOverrides): Promise<[BigNumber[]]>; + + liveMarketsFor(_token: string, overrides?: CallOverrides): Promise<[BigNumber[]]>; + + marketPrice(_id: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; + + markets( + arg0: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [BigNumber, string, boolean, BigNumber, BigNumber, BigNumber, BigNumber] & { + capacity: BigNumber; + quoteToken: string; + capacityInQuote: boolean; + totalDebt: BigNumber; + maxPayout: BigNumber; + sold: BigNumber; + purchased: BigNumber; + } + >; + + marketsForQuote(arg0: string, arg1: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; + + metadata( + arg0: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [number, number, number, number, number, number] & { + lastTune: number; + lastDecay: number; + length: number; + depositInterval: number; + tuneInterval: number; + quoteDecimals: number; + } + >; + + notes( + arg0: string, + arg1: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [BigNumber, number, number, number, number] & { + payout: BigNumber; + created: number; + matured: number; + redeemed: number; + marketID: number; + } + >; + + payoutFor(_amount: BigNumberish, _id: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; + + pendingFor( + _user: string, + _index: BigNumberish, + overrides?: CallOverrides, + ): Promise<[BigNumber, boolean] & { payout_: BigNumber; matured_: boolean }>; + + pullNote( + _from: string, + _index: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + pushNote( + _to: string, + _index: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + redeem( + _user: string, + _indexes: BigNumberish[], + _sendgOHM: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + redeemAll( + _user: string, + _sendgOHM: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + refReward(overrides?: CallOverrides): Promise<[BigNumber]>; + + rewards(arg0: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + setAuthority( + _newAuthority: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + setRewards( + _toFrontEnd: BigNumberish, + _toDAO: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + terms( + arg0: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [boolean, BigNumber, number, number, BigNumber] & { + fixedTerm: boolean; + controlVariable: BigNumber; + vesting: number; + conclusion: number; + maxDebt: BigNumber; + } + >; + + updateTreasury(overrides?: Overrides & { from?: string | Promise }): Promise; + + whitelist( + _operator: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + whitelisted(arg0: string, overrides?: CallOverrides): Promise<[boolean]>; + }; + + adjustments( + arg0: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [BigNumber, number, number, boolean] & { + change: BigNumber; + lastAdjustment: number; + timeToAdjusted: number; + active: boolean; + } + >; + + authority(overrides?: CallOverrides): Promise; + + close(_id: BigNumberish, overrides?: Overrides & { from?: string | Promise }): Promise; + + create( + _quoteToken: string, + _market: [BigNumberish, BigNumberish, BigNumberish], + _booleans: [boolean, boolean], + _terms: [BigNumberish, BigNumberish], + _intervals: [BigNumberish, BigNumberish], + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + currentControlVariable(_id: BigNumberish, overrides?: CallOverrides): Promise; + + currentDebt(_id: BigNumberish, overrides?: CallOverrides): Promise; + + daoReward(overrides?: CallOverrides): Promise; + + debtDecay(_id: BigNumberish, overrides?: CallOverrides): Promise; + + debtRatio(_id: BigNumberish, overrides?: CallOverrides): Promise; + + deposit( + _id: BigNumberish, + _amount: BigNumberish, + _maxPrice: BigNumberish, + _user: string, + _referral: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + getReward(overrides?: Overrides & { from?: string | Promise }): Promise; + + indexesFor(_user: string, overrides?: CallOverrides): Promise; + + isLive(_id: BigNumberish, overrides?: CallOverrides): Promise; + + liveMarkets(overrides?: CallOverrides): Promise; + + liveMarketsFor(_token: string, overrides?: CallOverrides): Promise; + + marketPrice(_id: BigNumberish, overrides?: CallOverrides): Promise; + + markets( + arg0: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [BigNumber, string, boolean, BigNumber, BigNumber, BigNumber, BigNumber] & { + capacity: BigNumber; + quoteToken: string; + capacityInQuote: boolean; + totalDebt: BigNumber; + maxPayout: BigNumber; + sold: BigNumber; + purchased: BigNumber; + } + >; + + marketsForQuote(arg0: string, arg1: BigNumberish, overrides?: CallOverrides): Promise; + + metadata( + arg0: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [number, number, number, number, number, number] & { + lastTune: number; + lastDecay: number; + length: number; + depositInterval: number; + tuneInterval: number; + quoteDecimals: number; + } + >; + + notes( + arg0: string, + arg1: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [BigNumber, number, number, number, number] & { + payout: BigNumber; + created: number; + matured: number; + redeemed: number; + marketID: number; + } + >; + + payoutFor(_amount: BigNumberish, _id: BigNumberish, overrides?: CallOverrides): Promise; + + pendingFor( + _user: string, + _index: BigNumberish, + overrides?: CallOverrides, + ): Promise<[BigNumber, boolean] & { payout_: BigNumber; matured_: boolean }>; + + pullNote( + _from: string, + _index: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + pushNote( + _to: string, + _index: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + redeem( + _user: string, + _indexes: BigNumberish[], + _sendgOHM: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + redeemAll( + _user: string, + _sendgOHM: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + refReward(overrides?: CallOverrides): Promise; + + rewards(arg0: string, overrides?: CallOverrides): Promise; + + setAuthority( + _newAuthority: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + setRewards( + _toFrontEnd: BigNumberish, + _toDAO: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + terms( + arg0: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [boolean, BigNumber, number, number, BigNumber] & { + fixedTerm: boolean; + controlVariable: BigNumber; + vesting: number; + conclusion: number; + maxDebt: BigNumber; + } + >; + + updateTreasury(overrides?: Overrides & { from?: string | Promise }): Promise; + + whitelist( + _operator: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + whitelisted(arg0: string, overrides?: CallOverrides): Promise; + + callStatic: { + adjustments( + arg0: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [BigNumber, number, number, boolean] & { + change: BigNumber; + lastAdjustment: number; + timeToAdjusted: number; + active: boolean; + } + >; + + authority(overrides?: CallOverrides): Promise; + + close(_id: BigNumberish, overrides?: CallOverrides): Promise; + + create( + _quoteToken: string, + _market: [BigNumberish, BigNumberish, BigNumberish], + _booleans: [boolean, boolean], + _terms: [BigNumberish, BigNumberish], + _intervals: [BigNumberish, BigNumberish], + overrides?: CallOverrides, + ): Promise; + + currentControlVariable(_id: BigNumberish, overrides?: CallOverrides): Promise; + + currentDebt(_id: BigNumberish, overrides?: CallOverrides): Promise; + + daoReward(overrides?: CallOverrides): Promise; + + debtDecay(_id: BigNumberish, overrides?: CallOverrides): Promise; + + debtRatio(_id: BigNumberish, overrides?: CallOverrides): Promise; + + deposit( + _id: BigNumberish, + _amount: BigNumberish, + _maxPrice: BigNumberish, + _user: string, + _referral: string, + overrides?: CallOverrides, + ): Promise< + [BigNumber, BigNumber, BigNumber] & { + payout_: BigNumber; + expiry_: BigNumber; + index_: BigNumber; + } + >; + + getReward(overrides?: CallOverrides): Promise; + + indexesFor(_user: string, overrides?: CallOverrides): Promise; + + isLive(_id: BigNumberish, overrides?: CallOverrides): Promise; + + liveMarkets(overrides?: CallOverrides): Promise; + + liveMarketsFor(_token: string, overrides?: CallOverrides): Promise; + + marketPrice(_id: BigNumberish, overrides?: CallOverrides): Promise; + + markets( + arg0: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [BigNumber, string, boolean, BigNumber, BigNumber, BigNumber, BigNumber] & { + capacity: BigNumber; + quoteToken: string; + capacityInQuote: boolean; + totalDebt: BigNumber; + maxPayout: BigNumber; + sold: BigNumber; + purchased: BigNumber; + } + >; + + marketsForQuote(arg0: string, arg1: BigNumberish, overrides?: CallOverrides): Promise; + + metadata( + arg0: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [number, number, number, number, number, number] & { + lastTune: number; + lastDecay: number; + length: number; + depositInterval: number; + tuneInterval: number; + quoteDecimals: number; + } + >; + + notes( + arg0: string, + arg1: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [BigNumber, number, number, number, number] & { + payout: BigNumber; + created: number; + matured: number; + redeemed: number; + marketID: number; + } + >; + + payoutFor(_amount: BigNumberish, _id: BigNumberish, overrides?: CallOverrides): Promise; + + pendingFor( + _user: string, + _index: BigNumberish, + overrides?: CallOverrides, + ): Promise<[BigNumber, boolean] & { payout_: BigNumber; matured_: boolean }>; + + pullNote(_from: string, _index: BigNumberish, overrides?: CallOverrides): Promise; + + pushNote(_to: string, _index: BigNumberish, overrides?: CallOverrides): Promise; + + redeem(_user: string, _indexes: BigNumberish[], _sendgOHM: boolean, overrides?: CallOverrides): Promise; + + redeemAll(_user: string, _sendgOHM: boolean, overrides?: CallOverrides): Promise; + + refReward(overrides?: CallOverrides): Promise; + + rewards(arg0: string, overrides?: CallOverrides): Promise; + + setAuthority(_newAuthority: string, overrides?: CallOverrides): Promise; + + setRewards(_toFrontEnd: BigNumberish, _toDAO: BigNumberish, overrides?: CallOverrides): Promise; + + terms( + arg0: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [boolean, BigNumber, number, number, BigNumber] & { + fixedTerm: boolean; + controlVariable: BigNumber; + vesting: number; + conclusion: number; + maxDebt: BigNumber; + } + >; + + updateTreasury(overrides?: CallOverrides): Promise; + + whitelist(_operator: string, overrides?: CallOverrides): Promise; + + whitelisted(arg0: string, overrides?: CallOverrides): Promise; + }; + + filters: { + 'AuthorityUpdated(address)'(authority?: string | null): AuthorityUpdatedEventFilter; + AuthorityUpdated(authority?: string | null): AuthorityUpdatedEventFilter; + + 'Bond(uint256,uint256,uint256)'(id?: BigNumberish | null, amount?: null, price?: null): BondEventFilter; + Bond(id?: BigNumberish | null, amount?: null, price?: null): BondEventFilter; + + 'CloseMarket(uint256)'(id?: BigNumberish | null): CloseMarketEventFilter; + CloseMarket(id?: BigNumberish | null): CloseMarketEventFilter; + + 'CreateMarket(uint256,address,address,uint256)'( + id?: BigNumberish | null, + baseToken?: string | null, + quoteToken?: string | null, + initialPrice?: null, + ): CreateMarketEventFilter; + CreateMarket( + id?: BigNumberish | null, + baseToken?: string | null, + quoteToken?: string | null, + initialPrice?: null, + ): CreateMarketEventFilter; + + 'Tuned(uint256,uint64,uint64)'( + id?: BigNumberish | null, + oldControlVariable?: null, + newControlVariable?: null, + ): TunedEventFilter; + Tuned(id?: BigNumberish | null, oldControlVariable?: null, newControlVariable?: null): TunedEventFilter; + }; + + estimateGas: { + adjustments(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + authority(overrides?: CallOverrides): Promise; + + close(_id: BigNumberish, overrides?: Overrides & { from?: string | Promise }): Promise; + + create( + _quoteToken: string, + _market: [BigNumberish, BigNumberish, BigNumberish], + _booleans: [boolean, boolean], + _terms: [BigNumberish, BigNumberish], + _intervals: [BigNumberish, BigNumberish], + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + currentControlVariable(_id: BigNumberish, overrides?: CallOverrides): Promise; + + currentDebt(_id: BigNumberish, overrides?: CallOverrides): Promise; + + daoReward(overrides?: CallOverrides): Promise; + + debtDecay(_id: BigNumberish, overrides?: CallOverrides): Promise; + + debtRatio(_id: BigNumberish, overrides?: CallOverrides): Promise; + + deposit( + _id: BigNumberish, + _amount: BigNumberish, + _maxPrice: BigNumberish, + _user: string, + _referral: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + getReward(overrides?: Overrides & { from?: string | Promise }): Promise; + + indexesFor(_user: string, overrides?: CallOverrides): Promise; + + isLive(_id: BigNumberish, overrides?: CallOverrides): Promise; + + liveMarkets(overrides?: CallOverrides): Promise; + + liveMarketsFor(_token: string, overrides?: CallOverrides): Promise; + + marketPrice(_id: BigNumberish, overrides?: CallOverrides): Promise; + + markets(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + marketsForQuote(arg0: string, arg1: BigNumberish, overrides?: CallOverrides): Promise; + + metadata(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + notes(arg0: string, arg1: BigNumberish, overrides?: CallOverrides): Promise; + + payoutFor(_amount: BigNumberish, _id: BigNumberish, overrides?: CallOverrides): Promise; + + pendingFor(_user: string, _index: BigNumberish, overrides?: CallOverrides): Promise; + + pullNote( + _from: string, + _index: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + pushNote( + _to: string, + _index: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + redeem( + _user: string, + _indexes: BigNumberish[], + _sendgOHM: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + redeemAll( + _user: string, + _sendgOHM: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + refReward(overrides?: CallOverrides): Promise; + + rewards(arg0: string, overrides?: CallOverrides): Promise; + + setAuthority( + _newAuthority: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + setRewards( + _toFrontEnd: BigNumberish, + _toDAO: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + terms(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + updateTreasury(overrides?: Overrides & { from?: string | Promise }): Promise; + + whitelist(_operator: string, overrides?: Overrides & { from?: string | Promise }): Promise; + + whitelisted(arg0: string, overrides?: CallOverrides): Promise; + }; + + populateTransaction: { + adjustments(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + authority(overrides?: CallOverrides): Promise; + + close( + _id: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + create( + _quoteToken: string, + _market: [BigNumberish, BigNumberish, BigNumberish], + _booleans: [boolean, boolean], + _terms: [BigNumberish, BigNumberish], + _intervals: [BigNumberish, BigNumberish], + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + currentControlVariable(_id: BigNumberish, overrides?: CallOverrides): Promise; + + currentDebt(_id: BigNumberish, overrides?: CallOverrides): Promise; + + daoReward(overrides?: CallOverrides): Promise; + + debtDecay(_id: BigNumberish, overrides?: CallOverrides): Promise; + + debtRatio(_id: BigNumberish, overrides?: CallOverrides): Promise; + + deposit( + _id: BigNumberish, + _amount: BigNumberish, + _maxPrice: BigNumberish, + _user: string, + _referral: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + getReward(overrides?: Overrides & { from?: string | Promise }): Promise; + + indexesFor(_user: string, overrides?: CallOverrides): Promise; + + isLive(_id: BigNumberish, overrides?: CallOverrides): Promise; + + liveMarkets(overrides?: CallOverrides): Promise; + + liveMarketsFor(_token: string, overrides?: CallOverrides): Promise; + + marketPrice(_id: BigNumberish, overrides?: CallOverrides): Promise; + + markets(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + marketsForQuote(arg0: string, arg1: BigNumberish, overrides?: CallOverrides): Promise; + + metadata(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + notes(arg0: string, arg1: BigNumberish, overrides?: CallOverrides): Promise; + + payoutFor(_amount: BigNumberish, _id: BigNumberish, overrides?: CallOverrides): Promise; + + pendingFor(_user: string, _index: BigNumberish, overrides?: CallOverrides): Promise; + + pullNote( + _from: string, + _index: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + pushNote( + _to: string, + _index: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + redeem( + _user: string, + _indexes: BigNumberish[], + _sendgOHM: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + redeemAll( + _user: string, + _sendgOHM: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + refReward(overrides?: CallOverrides): Promise; + + rewards(arg0: string, overrides?: CallOverrides): Promise; + + setAuthority( + _newAuthority: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + setRewards( + _toFrontEnd: BigNumberish, + _toDAO: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + terms(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + updateTreasury(overrides?: Overrides & { from?: string | Promise }): Promise; + + whitelist( + _operator: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + whitelisted(arg0: string, overrides?: CallOverrides): Promise; + }; +} diff --git a/src/apps/olympus/contracts/ethers/factories/OlympusBondDepository__factory.ts b/src/apps/olympus/contracts/ethers/factories/OlympusV2BondDepository__factory.ts similarity index 63% rename from src/apps/olympus/contracts/ethers/factories/OlympusBondDepository__factory.ts rename to src/apps/olympus/contracts/ethers/factories/OlympusV2BondDepository__factory.ts index 9d0f9c29b..fe4f7e222 100644 --- a/src/apps/olympus/contracts/ethers/factories/OlympusBondDepository__factory.ts +++ b/src/apps/olympus/contracts/ethers/factories/OlympusV2BondDepository__factory.ts @@ -4,34 +4,34 @@ import { Contract, Signer, utils } from 'ethers'; import type { Provider } from '@ethersproject/providers'; -import type { OlympusBondDepository, OlympusBondDepositoryInterface } from '../OlympusBondDepository'; +import type { OlympusV2BondDepository, OlympusV2BondDepositoryInterface } from '../OlympusV2BondDepository'; const _abi = [ { inputs: [ { - internalType: 'address', - name: '_OHM', + internalType: 'contract IOlympusAuthority', + name: '_authority', type: 'address', }, { - internalType: 'address', - name: '_principle', + internalType: 'contract IERC20', + name: '_ohm', type: 'address', }, { - internalType: 'address', - name: '_treasury', + internalType: 'contract IgOHM', + name: '_gohm', type: 'address', }, { - internalType: 'address', - name: '_DAO', + internalType: 'contract IStaking', + name: '_staking', type: 'address', }, { - internalType: 'address', - name: '_bondCalculator', + internalType: 'contract ITreasury', + name: '_treasury', type: 'address', }, ], @@ -42,31 +42,38 @@ const _abi = [ anonymous: false, inputs: [ { - indexed: false, - internalType: 'uint256', - name: 'deposit', - type: 'uint256', + indexed: true, + internalType: 'contract IOlympusAuthority', + name: 'authority', + type: 'address', }, + ], + name: 'AuthorityUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ { indexed: true, internalType: 'uint256', - name: 'payout', + name: 'id', type: 'uint256', }, { - indexed: true, + indexed: false, internalType: 'uint256', - name: 'expires', + name: 'amount', type: 'uint256', }, { - indexed: true, + indexed: false, internalType: 'uint256', - name: 'priceInUSD', + name: 'price', type: 'uint256', }, ], - name: 'BondCreated', + name: 'Bond', type: 'event', }, { @@ -75,127 +82,98 @@ const _abi = [ { indexed: true, internalType: 'uint256', - name: 'priceInUSD', - type: 'uint256', - }, - { - indexed: true, - internalType: 'uint256', - name: 'internalPrice', - type: 'uint256', - }, - { - indexed: true, - internalType: 'uint256', - name: 'debtRatio', + name: 'id', type: 'uint256', }, ], - name: 'BondPriceChanged', + name: 'CloseMarket', type: 'event', }, { anonymous: false, inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'id', + type: 'uint256', + }, { indexed: true, internalType: 'address', - name: 'recipient', + name: 'baseToken', type: 'address', }, { - indexed: false, - internalType: 'uint256', - name: 'payout', - type: 'uint256', + indexed: true, + internalType: 'address', + name: 'quoteToken', + type: 'address', }, { indexed: false, internalType: 'uint256', - name: 'remaining', + name: 'initialPrice', type: 'uint256', }, ], - name: 'BondRedeemed', + name: 'CreateMarket', type: 'event', }, { anonymous: false, inputs: [ { - indexed: false, + indexed: true, internalType: 'uint256', - name: 'initialBCV', + name: 'id', type: 'uint256', }, { indexed: false, - internalType: 'uint256', - name: 'newBCV', - type: 'uint256', + internalType: 'uint64', + name: 'oldControlVariable', + type: 'uint64', }, { indexed: false, - internalType: 'uint256', - name: 'adjustment', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bool', - name: 'addition', - type: 'bool', + internalType: 'uint64', + name: 'newControlVariable', + type: 'uint64', }, ], - name: 'ControlVariableAdjustment', + name: 'Tuned', type: 'event', }, { - anonymous: false, inputs: [ { - indexed: true, - internalType: 'address', - name: 'previousOwner', - type: 'address', + internalType: 'uint256', + name: '', + type: 'uint256', }, + ], + name: 'adjustments', + outputs: [ { - indexed: true, - internalType: 'address', - name: 'newOwner', - type: 'address', + internalType: 'uint64', + name: 'change', + type: 'uint64', }, - ], - name: 'OwnershipPulled', - type: 'event', - }, - { - anonymous: false, - inputs: [ { - indexed: true, - internalType: 'address', - name: 'previousOwner', - type: 'address', + internalType: 'uint48', + name: 'lastAdjustment', + type: 'uint48', }, { - indexed: true, - internalType: 'address', - name: 'newOwner', - type: 'address', + internalType: 'uint48', + name: 'timeToAdjusted', + type: 'uint48', }, - ], - name: 'OwnershipPushed', - type: 'event', - }, - { - inputs: [], - name: 'DAO', - outputs: [ { - internalType: 'address', - name: '', - type: 'address', + internalType: 'bool', + name: 'active', + type: 'bool', }, ], stateMutability: 'view', @@ -203,10 +181,10 @@ const _abi = [ }, { inputs: [], - name: 'OHM', + name: 'authority', outputs: [ { - internalType: 'address', + internalType: 'contract IOlympusAuthority', name: '', type: 'address', }, @@ -215,105 +193,70 @@ const _abi = [ type: 'function', }, { - inputs: [], - name: 'adjustment', - outputs: [ - { - internalType: 'bool', - name: 'add', - type: 'bool', - }, - { - internalType: 'uint256', - name: 'rate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'target', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'buffer', - type: 'uint256', - }, + inputs: [ { internalType: 'uint256', - name: 'lastBlock', + name: '_id', type: 'uint256', }, ], - stateMutability: 'view', + name: 'close', + outputs: [], + stateMutability: 'nonpayable', type: 'function', }, { - inputs: [], - name: 'bondCalculator', - outputs: [ + inputs: [ { - internalType: 'address', - name: '', + internalType: 'contract IERC20', + name: '_quoteToken', type: 'address', }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ { - internalType: 'address', - name: '', - type: 'address', + internalType: 'uint256[3]', + name: '_market', + type: 'uint256[3]', }, - ], - name: 'bondInfo', - outputs: [ { - internalType: 'uint256', - name: 'payout', - type: 'uint256', + internalType: 'bool[2]', + name: '_booleans', + type: 'bool[2]', }, { - internalType: 'uint256', - name: 'vesting', - type: 'uint256', + internalType: 'uint256[2]', + name: '_terms', + type: 'uint256[2]', }, { - internalType: 'uint256', - name: 'lastBlock', - type: 'uint256', + internalType: 'uint32[2]', + name: '_intervals', + type: 'uint32[2]', }, + ], + name: 'create', + outputs: [ { internalType: 'uint256', - name: 'pricePaid', + name: 'id_', type: 'uint256', }, ], - stateMutability: 'view', + stateMutability: 'nonpayable', type: 'function', }, { - inputs: [], - name: 'bondPrice', - outputs: [ + inputs: [ { internalType: 'uint256', - name: 'price_', + name: '_id', type: 'uint256', }, ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'bondPriceInUSD', + name: 'currentControlVariable', outputs: [ { internalType: 'uint256', - name: 'price_', + name: '', type: 'uint256', }, ], @@ -321,7 +264,13 @@ const _abi = [ type: 'function', }, { - inputs: [], + inputs: [ + { + internalType: 'uint256', + name: '_id', + type: 'uint256', + }, + ], name: 'currentDebt', outputs: [ { @@ -335,11 +284,11 @@ const _abi = [ }, { inputs: [], - name: 'debtDecay', + name: 'daoReward', outputs: [ { internalType: 'uint256', - name: 'decay_', + name: '', type: 'uint256', }, ], @@ -347,15 +296,21 @@ const _abi = [ type: 'function', }, { - inputs: [], - name: 'debtRatio', - outputs: [ + inputs: [ { internalType: 'uint256', - name: 'debtRatio_', + name: '_id', type: 'uint256', }, ], + name: 'debtDecay', + outputs: [ + { + internalType: 'uint64', + name: '', + type: 'uint64', + }, + ], stateMutability: 'view', type: 'function', }, @@ -363,21 +318,11 @@ const _abi = [ inputs: [ { internalType: 'uint256', - name: '_amount', + name: '_id', type: 'uint256', }, - { - internalType: 'uint256', - name: '_maxPrice', - type: 'uint256', - }, - { - internalType: 'address', - name: '_depositor', - type: 'address', - }, ], - name: 'deposit', + name: 'debtRatio', outputs: [ { internalType: 'uint256', @@ -385,55 +330,93 @@ const _abi = [ type: 'uint256', }, ], - stateMutability: 'nonpayable', + stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'uint256', - name: '_controlVariable', + name: '_id', type: 'uint256', }, { internalType: 'uint256', - name: '_vestingTerm', + name: '_amount', type: 'uint256', }, { internalType: 'uint256', - name: '_minimumPrice', + name: '_maxPrice', type: 'uint256', }, { - internalType: 'uint256', - name: '_maxPayout', - type: 'uint256', + internalType: 'address', + name: '_user', + type: 'address', + }, + { + internalType: 'address', + name: '_referral', + type: 'address', }, + ], + name: 'deposit', + outputs: [ { internalType: 'uint256', - name: '_fee', + name: 'payout_', type: 'uint256', }, { internalType: 'uint256', - name: '_maxDebt', + name: 'expiry_', type: 'uint256', }, { internalType: 'uint256', - name: '_initialDebt', + name: 'index_', type: 'uint256', }, ], - name: 'initializeBondTerms', - outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [], - name: 'isLiquidityBond', + name: 'getReward', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_user', + type: 'address', + }, + ], + name: 'indexesFor', + outputs: [ + { + internalType: 'uint256[]', + name: '', + type: 'uint256[]', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_id', + type: 'uint256', + }, + ], + name: 'isLive', outputs: [ { internalType: 'bool', @@ -446,25 +429,31 @@ const _abi = [ }, { inputs: [], - name: 'lastDecay', + name: 'liveMarkets', outputs: [ { - internalType: 'uint256', + internalType: 'uint256[]', name: '', - type: 'uint256', + type: 'uint256[]', }, ], stateMutability: 'view', type: 'function', }, { - inputs: [], - name: 'maxPayout', + inputs: [ + { + internalType: 'address', + name: '_token', + type: 'address', + }, + ], + name: 'liveMarketsFor', outputs: [ { - internalType: 'uint256', + internalType: 'uint256[]', name: '', - type: 'uint256', + type: 'uint256[]', }, ], stateMutability: 'view', @@ -474,11 +463,11 @@ const _abi = [ inputs: [ { internalType: 'uint256', - name: '_value', + name: '_id', type: 'uint256', }, ], - name: 'payoutFor', + name: 'marketPrice', outputs: [ { internalType: 'uint256', @@ -492,16 +481,46 @@ const _abi = [ { inputs: [ { - internalType: 'address', - name: '_depositor', - type: 'address', + internalType: 'uint256', + name: '', + type: 'uint256', }, ], - name: 'pendingPayoutFor', + name: 'markets', outputs: [ { internalType: 'uint256', - name: 'pendingPayout_', + name: 'capacity', + type: 'uint256', + }, + { + internalType: 'contract IERC20', + name: 'quoteToken', + type: 'address', + }, + { + internalType: 'bool', + name: 'capacityInQuote', + type: 'bool', + }, + { + internalType: 'uint64', + name: 'totalDebt', + type: 'uint64', + }, + { + internalType: 'uint64', + name: 'maxPayout', + type: 'uint64', + }, + { + internalType: 'uint64', + name: 'sold', + type: 'uint64', + }, + { + internalType: 'uint256', + name: 'purchased', type: 'uint256', }, ], @@ -512,15 +531,20 @@ const _abi = [ inputs: [ { internalType: 'address', - name: '_depositor', + name: '', type: 'address', }, + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, ], - name: 'percentVestedFor', + name: 'marketsForQuote', outputs: [ { internalType: 'uint256', - name: 'percentVested_', + name: '', type: 'uint256', }, ], @@ -528,125 +552,184 @@ const _abi = [ type: 'function', }, { - inputs: [], - name: 'policy', - outputs: [ + inputs: [ { - internalType: 'address', + internalType: 'uint256', name: '', - type: 'address', + type: 'uint256', }, ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'principle', + name: 'metadata', outputs: [ { - internalType: 'address', - name: '', - type: 'address', + internalType: 'uint48', + name: 'lastTune', + type: 'uint48', + }, + { + internalType: 'uint48', + name: 'lastDecay', + type: 'uint48', + }, + { + internalType: 'uint48', + name: 'length', + type: 'uint48', + }, + { + internalType: 'uint48', + name: 'depositInterval', + type: 'uint48', + }, + { + internalType: 'uint48', + name: 'tuneInterval', + type: 'uint48', + }, + { + internalType: 'uint8', + name: 'quoteDecimals', + type: 'uint8', }, ], stateMutability: 'view', type: 'function', }, - { - inputs: [], - name: 'pullManagement', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, { inputs: [ { internalType: 'address', - name: 'newOwner_', + name: '', type: 'address', }, + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, ], - name: 'pushManagement', - outputs: [], - stateMutability: 'nonpayable', + name: 'notes', + outputs: [ + { + internalType: 'uint256', + name: 'payout', + type: 'uint256', + }, + { + internalType: 'uint48', + name: 'created', + type: 'uint48', + }, + { + internalType: 'uint48', + name: 'matured', + type: 'uint48', + }, + { + internalType: 'uint48', + name: 'redeemed', + type: 'uint48', + }, + { + internalType: 'uint48', + name: 'marketID', + type: 'uint48', + }, + ], + stateMutability: 'view', type: 'function', }, { inputs: [ { - internalType: 'address', - name: '_token', - type: 'address', + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: '_id', + type: 'uint256', }, ], - name: 'recoverLostToken', + name: 'payoutFor', outputs: [ { - internalType: 'bool', + internalType: 'uint256', name: '', - type: 'bool', + type: 'uint256', }, ], - stateMutability: 'nonpayable', + stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'address', - name: '_recipient', + name: '_user', type: 'address', }, { - internalType: 'bool', - name: '_stake', - type: 'bool', + internalType: 'uint256', + name: '_index', + type: 'uint256', }, ], - name: 'redeem', + name: 'pendingFor', outputs: [ { internalType: 'uint256', - name: '', + name: 'payout_', type: 'uint256', }, + { + internalType: 'bool', + name: 'matured_', + type: 'bool', + }, ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'renounceManagement', - outputs: [], - stateMutability: 'nonpayable', + stateMutability: 'view', type: 'function', }, { inputs: [ { - internalType: 'bool', - name: '_addition', - type: 'bool', + internalType: 'address', + name: '_from', + type: 'address', }, { internalType: 'uint256', - name: '_increment', + name: '_index', type: 'uint256', }, + ], + name: 'pullNote', + outputs: [ { internalType: 'uint256', - name: '_target', + name: 'newIndex_', type: 'uint256', }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_to', + type: 'address', + }, { internalType: 'uint256', - name: '_buffer', + name: '_index', type: 'uint256', }, ], - name: 'setAdjustment', + name: 'pushNote', outputs: [], stateMutability: 'nonpayable', type: 'function', @@ -654,18 +737,29 @@ const _abi = [ { inputs: [ { - internalType: 'enum OlympusBondDepository.PARAMETER', - name: '_parameter', - type: 'uint8', + internalType: 'address', + name: '_user', + type: 'address', }, + { + internalType: 'uint256[]', + name: '_indexes', + type: 'uint256[]', + }, + { + internalType: 'bool', + name: '_sendgOHM', + type: 'bool', + }, + ], + name: 'redeem', + outputs: [ { internalType: 'uint256', - name: '_input', + name: 'payout_', type: 'uint256', }, ], - name: 'setBondTerms', - outputs: [], stateMutability: 'nonpayable', type: 'function', }, @@ -673,49 +767,48 @@ const _abi = [ inputs: [ { internalType: 'address', - name: '_staking', + name: '_user', type: 'address', }, { internalType: 'bool', - name: '_helper', + name: '_sendgOHM', type: 'bool', }, ], - name: 'setStaking', - outputs: [], + name: 'redeemAll', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], stateMutability: 'nonpayable', type: 'function', }, { inputs: [], - name: 'staking', + name: 'refReward', outputs: [ { - internalType: 'address', + internalType: 'uint256', name: '', - type: 'address', + type: 'uint256', }, ], stateMutability: 'view', type: 'function', }, { - inputs: [], - name: 'stakingHelper', - outputs: [ + inputs: [ { internalType: 'address', name: '', type: 'address', }, ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'standardizedDebtRatio', + name: 'rewards', outputs: [ { internalType: 'uint256', @@ -727,38 +820,70 @@ const _abi = [ type: 'function', }, { - inputs: [], - name: 'terms', - outputs: [ + inputs: [ { - internalType: 'uint256', - name: 'controlVariable', - type: 'uint256', + internalType: 'contract IOlympusAuthority', + name: '_newAuthority', + type: 'address', }, + ], + name: 'setAuthority', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ { internalType: 'uint256', - name: 'vestingTerm', + name: '_toFrontEnd', type: 'uint256', }, { internalType: 'uint256', - name: 'minimumPrice', + name: '_toDAO', type: 'uint256', }, + ], + name: 'setRewards', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ { internalType: 'uint256', - name: 'maxPayout', + name: '', type: 'uint256', }, + ], + name: 'terms', + outputs: [ { - internalType: 'uint256', - name: 'fee', - type: 'uint256', + internalType: 'bool', + name: 'fixedTerm', + type: 'bool', }, { - internalType: 'uint256', + internalType: 'uint64', + name: 'controlVariable', + type: 'uint64', + }, + { + internalType: 'uint48', + name: 'vesting', + type: 'uint48', + }, + { + internalType: 'uint48', + name: 'conclusion', + type: 'uint48', + }, + { + internalType: 'uint64', name: 'maxDebt', - type: 'uint256', + type: 'uint64', }, ], stateMutability: 'view', @@ -766,33 +891,33 @@ const _abi = [ }, { inputs: [], - name: 'totalDebt', - outputs: [ + name: 'updateTreasury', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ { - internalType: 'uint256', - name: '', - type: 'uint256', + internalType: 'address', + name: '_operator', + type: 'address', }, ], - stateMutability: 'view', + name: 'whitelist', + outputs: [], + stateMutability: 'nonpayable', type: 'function', }, { - inputs: [], - name: 'treasury', - outputs: [ + inputs: [ { internalType: 'address', name: '', type: 'address', }, ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'useHelper', + name: 'whitelisted', outputs: [ { internalType: 'bool', @@ -805,12 +930,12 @@ const _abi = [ }, ]; -export class OlympusBondDepository__factory { +export class OlympusV2BondDepository__factory { static readonly abi = _abi; - static createInterface(): OlympusBondDepositoryInterface { - return new utils.Interface(_abi) as OlympusBondDepositoryInterface; + static createInterface(): OlympusV2BondDepositoryInterface { + return new utils.Interface(_abi) as OlympusV2BondDepositoryInterface; } - static connect(address: string, signerOrProvider: Signer | Provider): OlympusBondDepository { - return new Contract(address, _abi, signerOrProvider) as OlympusBondDepository; + static connect(address: string, signerOrProvider: Signer | Provider): OlympusV2BondDepository { + return new Contract(address, _abi, signerOrProvider) as OlympusV2BondDepository; } } diff --git a/src/apps/olympus/contracts/ethers/factories/index.ts b/src/apps/olympus/contracts/ethers/factories/index.ts index 3ab323104..d7c008e17 100644 --- a/src/apps/olympus/contracts/ethers/factories/index.ts +++ b/src/apps/olympus/contracts/ethers/factories/index.ts @@ -1,9 +1,9 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -export { OlympusBondDepository__factory } from './OlympusBondDepository__factory'; export { OlympusGOhmToken__factory } from './OlympusGOhmToken__factory'; export { OlympusSOhmToken__factory } from './OlympusSOhmToken__factory'; export { OlympusSOhmV1Token__factory } from './OlympusSOhmV1Token__factory'; +export { OlympusV2BondDepository__factory } from './OlympusV2BondDepository__factory'; export { OlympusWsOhmV1Token__factory } from './OlympusWsOhmV1Token__factory'; export { OlympusZapperZap__factory } from './OlympusZapperZap__factory'; diff --git a/src/apps/olympus/contracts/ethers/index.ts b/src/apps/olympus/contracts/ethers/index.ts index 784f37153..3653a4d59 100644 --- a/src/apps/olympus/contracts/ethers/index.ts +++ b/src/apps/olympus/contracts/ethers/index.ts @@ -1,16 +1,16 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -export type { OlympusBondDepository } from './OlympusBondDepository'; export type { OlympusGOhmToken } from './OlympusGOhmToken'; export type { OlympusSOhmToken } from './OlympusSOhmToken'; export type { OlympusSOhmV1Token } from './OlympusSOhmV1Token'; +export type { OlympusV2BondDepository } from './OlympusV2BondDepository'; export type { OlympusWsOhmV1Token } from './OlympusWsOhmV1Token'; export type { OlympusZapperZap } from './OlympusZapperZap'; export * as factories from './factories'; -export { OlympusBondDepository__factory } from './factories/OlympusBondDepository__factory'; export { OlympusGOhmToken__factory } from './factories/OlympusGOhmToken__factory'; export { OlympusSOhmToken__factory } from './factories/OlympusSOhmToken__factory'; export { OlympusSOhmV1Token__factory } from './factories/OlympusSOhmV1Token__factory'; +export { OlympusV2BondDepository__factory } from './factories/OlympusV2BondDepository__factory'; export { OlympusWsOhmV1Token__factory } from './factories/OlympusWsOhmV1Token__factory'; export { OlympusZapperZap__factory } from './factories/OlympusZapperZap__factory'; diff --git a/src/apps/olympus/contracts/index.ts b/src/apps/olympus/contracts/index.ts index 4e67384a5..a1872e5c2 100644 --- a/src/apps/olympus/contracts/index.ts +++ b/src/apps/olympus/contracts/index.ts @@ -4,10 +4,10 @@ import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface'; import { ContractFactory } from '~contract/contracts'; import { Network } from '~types/network.interface'; -import { OlympusBondDepository__factory } from './ethers'; import { OlympusGOhmToken__factory } from './ethers'; import { OlympusSOhmToken__factory } from './ethers'; import { OlympusSOhmV1Token__factory } from './ethers'; +import { OlympusV2BondDepository__factory } from './ethers'; import { OlympusWsOhmV1Token__factory } from './ethers'; import { OlympusZapperZap__factory } from './ethers'; @@ -20,9 +20,6 @@ export class OlympusContractFactory extends ContractFactory { super((network: Network) => appToolkit.getNetworkProvider(network)); } - olympusBondDepository({ address, network }: ContractOpts) { - return OlympusBondDepository__factory.connect(address, this.appToolkit.getNetworkProvider(network)); - } olympusGOhmToken({ address, network }: ContractOpts) { return OlympusGOhmToken__factory.connect(address, this.appToolkit.getNetworkProvider(network)); } @@ -32,6 +29,9 @@ export class OlympusContractFactory extends ContractFactory { olympusSOhmV1Token({ address, network }: ContractOpts) { return OlympusSOhmV1Token__factory.connect(address, this.appToolkit.getNetworkProvider(network)); } + olympusV2BondDepository({ address, network }: ContractOpts) { + return OlympusV2BondDepository__factory.connect(address, this.appToolkit.getNetworkProvider(network)); + } olympusWsOhmV1Token({ address, network }: ContractOpts) { return OlympusWsOhmV1Token__factory.connect(address, this.appToolkit.getNetworkProvider(network)); } @@ -40,9 +40,9 @@ export class OlympusContractFactory extends ContractFactory { } } -export type { OlympusBondDepository } from './ethers'; export type { OlympusGOhmToken } from './ethers'; export type { OlympusSOhmToken } from './ethers'; export type { OlympusSOhmV1Token } from './ethers'; +export type { OlympusV2BondDepository } from './ethers'; export type { OlympusWsOhmV1Token } from './ethers'; export type { OlympusZapperZap } from './ethers'; diff --git a/src/apps/olympus/ethereum/olympus.balance-fetcher.ts b/src/apps/olympus/ethereum/olympus.balance-fetcher.ts index 3cc43c00f..95e3ec8a5 100644 --- a/src/apps/olympus/ethereum/olympus.balance-fetcher.ts +++ b/src/apps/olympus/ethereum/olympus.balance-fetcher.ts @@ -6,7 +6,7 @@ import { BalanceFetcher } from '~balance/balance-fetcher.interface'; import { APP_TOOLKIT, IAppToolkit } from '~lib'; import { Network } from '~types/network.interface'; -import { OlympusBondDepository, OlympusContractFactory } from '../contracts'; +import { OlympusContractFactory, OlympusV2BondDepository } from '../contracts'; import { OlympusBondContractPositionBalanceHelper } from '../helpers/olympus.bond.contract-position-balance-helper'; import { OLYMPUS_DEFINITION } from '../olympus.definition'; @@ -45,19 +45,22 @@ export class EthereumOlympusBalanceFetcher implements BalanceFetcher { private async getBonds(address: string) { const network = Network.ETHEREUM_MAINNET; - return this.contractPositionBalanceHelper.getBalances({ + return this.contractPositionBalanceHelper.getBalances({ network, groupId: OLYMPUS_DEFINITION.groups.bond.id, appId: OLYMPUS_DEFINITION.id, address, - resolveDepositoryContract: ({ depositoryAddress: address }) => - this.contractFactory.olympusBondDepository({ network, address }), - resolveClaimablePayout: ({ multicall, contract, address }) => multicall.wrap(contract).pendingPayoutFor(address), - resolveTotalPayout: ({ multicall, contract, address }) => + resolveDepositoryContract: ({ depositoryAddress: address }) => { + return this.contractFactory.olympusV2BondDepository({ address, network }); + }, + resolveClaimablePayout: ({ multicall, contract, address }) => multicall .wrap(contract) - .bondInfo(address) - .then(v => v.payout), + .indexesFor(address) + .then( + async indexes => + await Promise.all(indexes.map(index => multicall.wrap(contract).pendingFor(address, index))), + ), }); } diff --git a/src/apps/olympus/ethereum/olympus.bond.contract-position-fetcher.ts b/src/apps/olympus/ethereum/olympus.bond.contract-position-fetcher.ts index 78206ef64..ef7f1d0ed 100644 --- a/src/apps/olympus/ethereum/olympus.bond.contract-position-fetcher.ts +++ b/src/apps/olympus/ethereum/olympus.bond.contract-position-fetcher.ts @@ -20,22 +20,13 @@ export class EthereumOlympusBondContractPositionFetcher implements PositionFetch ) {} async getPositions(): Promise { const network = Network.ETHEREUM_MAINNET; - const depositories = [ - { depositoryAddress: '0xc20cfff07076858a7e642e396180ec390e5a02f7', symbol: 'OHM-FRAX LP' }, - { depositoryAddress: '0x8510c8c2b6891e04864fa196693d44e6b6ec2514', symbol: 'FRAX' }, - { depositoryAddress: '0x575409f8d77c12b05fed8b455815f0e54797381c', symbol: 'DAI' }, - { depositoryAddress: '0x956c43998316b6a2f21f89a1539f73fb5b78c151', symbol: 'OHM-DAI SLP' }, - { depositoryAddress: '0xe6295201cd1ff13ced5f063a5421c39a1d236f1c', symbol: 'WETH' }, - { depositoryAddress: '0x10c0f93f64e3c8d0a1b0f4b87d6155fd9e89d08d', symbol: 'LUSD' }, - ]; - const mintedTokenAddress = '0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5'; // Since OHM v1 and OHM have the same symbol + const depositories = [{ depositoryAddress: '0x9025046c6fb25Fb39e720d97a8FD881ED69a1Ef6', symbol: 'gOHM' }]; return this.olympusContractPositionHelper.getPositions({ appId: OLYMPUS_DEFINITION.id, network, groupId: OLYMPUS_DEFINITION.groups.bond.id, depositories, - mintedTokenAddress, }); } } diff --git a/src/apps/olympus/helpers/olympus.bond.contract-position-balance-helper.ts b/src/apps/olympus/helpers/olympus.bond.contract-position-balance-helper.ts index 826a3e0e3..03bbf3c8b 100644 --- a/src/apps/olympus/helpers/olympus.bond.contract-position-balance-helper.ts +++ b/src/apps/olympus/helpers/olympus.bond.contract-position-balance-helper.ts @@ -1,6 +1,5 @@ import { Inject, Injectable } from '@nestjs/common'; -import BigNumber from 'bignumber.js'; -import { BigNumberish } from 'ethers'; +import { BigNumber } from 'ethers'; import { sumBy } from 'lodash'; import { drillBalance } from '~app-toolkit'; @@ -18,18 +17,12 @@ type OlympusBondContractPositionBalanceHelperParams = { groupId: string; network: Network; resolveDepositoryContract: (opts: { depositoryAddress: string; network: Network }) => T; - resolveTotalPayout: (opts: { - multicall: Multicall; - contract: T; - address: string; - contractPosition: ContractPosition; - }) => Promise; resolveClaimablePayout: (opts: { multicall: Multicall; contract: T; address: string; contractPosition: ContractPosition; - }) => Promise; + }) => Promise; }; @Injectable() @@ -39,32 +32,28 @@ export class OlympusBondContractPositionBalanceHelper { async getBalances( opts: OlympusBondContractPositionBalanceHelperParams, ): Promise[]> { - const { address, appId, groupId, network, resolveDepositoryContract, resolveTotalPayout, resolveClaimablePayout } = - opts; - + const { address, appId, groupId, network, resolveDepositoryContract, resolveClaimablePayout } = opts; const multicall = this.appToolkit.getMulticall(network); const contractPositions = await this.appToolkit.getAppContractPositions({ network, appId, groupIds: [groupId] }); - const contractPositionBalances = await Promise.all( contractPositions.map(async contractPosition => { const contract = resolveDepositoryContract({ depositoryAddress: contractPosition.address, network }); - const vestingToken = contractPosition.tokens.find(isVesting)!; const claimableToken = contractPosition.tokens.find(isClaimable)!; - const [pendingPayoutRaw, claimableBalanceRaw] = await Promise.all([ - resolveTotalPayout({ multicall, contract, address, contractPosition }), + const [claimableBalanceRaw] = await Promise.all([ resolveClaimablePayout({ multicall, contract, address, contractPosition }), ]); - const pendingPayoutRawBN = new BigNumber(pendingPayoutRaw.toString()); - const claimableBalanceRawBN = new BigNumber(claimableBalanceRaw.toString()); + const claimableBonds = claimableBalanceRaw.filter(p => p.matured_); + const vestingBonds = claimableBalanceRaw.filter(p => !p.matured_); - const vestingBalanceRaw = pendingPayoutRawBN.gt(claimableBalanceRawBN) - ? pendingPayoutRawBN.minus(claimableBalanceRawBN).toFixed(0) - : '0'; - const claimableTokenBalance = drillBalance(claimableToken, claimableBalanceRaw.toString()); - const vestingTokenBalance = drillBalance(vestingToken, vestingBalanceRaw); + const claimableAmount = claimableBonds.reduce((acc, bond) => acc.add(bond.payout_), BigNumber.from('0')); + const vestingAmount = vestingBonds.reduce((acc, bond) => { + return acc.add(bond.payout_); + }, BigNumber.from('0')); + const claimableTokenBalance = drillBalance(claimableToken, claimableAmount.toString()); + const vestingTokenBalance = drillBalance(vestingToken, vestingAmount.toString()); const tokens = [claimableTokenBalance, vestingTokenBalance].filter(v => v.balanceUSD > 0); const balanceUSD = sumBy(tokens, t => t.balanceUSD); diff --git a/src/apps/olympus/helpers/olympus.bond.contract-position-helper.ts b/src/apps/olympus/helpers/olympus.bond.contract-position-helper.ts index 15977cf7b..26da22ef0 100644 --- a/src/apps/olympus/helpers/olympus.bond.contract-position-helper.ts +++ b/src/apps/olympus/helpers/olympus.bond.contract-position-helper.ts @@ -9,6 +9,8 @@ import { AppGroupsDefinition } from '~position/position.service'; import { claimable, vesting } from '~position/position.utils'; import { Network } from '~types/network.interface'; +import { OLYMPUS_DEFINITION } from '../olympus.definition'; + type OlympusDepository = { depositoryAddress: string; symbol: string; @@ -20,7 +22,6 @@ type OlympusBondContractPositionHelperParams = { groupId: string; network: Network; depositories: OlympusDepository[]; - mintedTokenAddress: string; dependencies?: AppGroupsDefinition[]; }; @@ -33,8 +34,8 @@ export class OlympusBondContractPositionHelper { groupId, network, depositories, - mintedTokenAddress, - dependencies = [], + + dependencies = [{ appId, groupIds: [OLYMPUS_DEFINITION.groups.gOhm.id], network }], }: OlympusBondContractPositionHelperParams) { const [baseTokens, appTokens] = await Promise.all([ this.appToolkit.getBaseTokenPrices(network), @@ -42,9 +43,9 @@ export class OlympusBondContractPositionHelper { ]); const allTokens = [...appTokens, ...baseTokens]; - const mintedToken = allTokens.find(price => price.address === mintedTokenAddress); + const mintedToken = allTokens.find(token => token.symbol === 'gOHM'); if (!mintedToken) { - throw new Error(`minted token with address ${mintedTokenAddress} is missing`); + throw new Error(`minted token with address gOHM is missing`); } const depositoryContractPositions = await Promise.all( @@ -58,7 +59,7 @@ export class OlympusBondContractPositionHelper { tokens: [vesting(mintedToken), claimable(mintedToken)], dataProps: {}, displayProps: { - label: `${symbol} Bond`, + label: `Bond`, images: images || [getTokenImg(symbol, network)], statsItems: [], }, diff --git a/src/apps/olympus/index.ts b/src/apps/olympus/index.ts index 55ec06767..6fc2906e3 100644 --- a/src/apps/olympus/index.ts +++ b/src/apps/olympus/index.ts @@ -2,7 +2,7 @@ export { OLYMPUS_DEFINITION, OlympusAppDefinition } from './olympus.definition'; export { OlympusAppModule } from './olympus.module'; export { OlympusContractFactory } from './contracts'; -export type { OlympusBondDepository } from './contracts'; +export type { OlympusV2BondDepository } from './contracts'; export type { OlympusGOhmToken } from './contracts'; export type { OlympusSOhmToken } from './contracts'; export type { OlympusSOhmV1Token } from './contracts';