From 468b4ac0c2979b925c53b837324b927986230e50 Mon Sep 17 00:00:00 2001 From: Mike Date: Tue, 17 Oct 2023 18:36:28 -0400 Subject: [PATCH 01/19] remove momp from pool; add referencePrice to liquidationAuction; remove kickMomp and kickerAward --- schema.graphql | 4 +--- src/mappings/base/base-pool.ts | 1 - src/mappings/erc-20-pool.ts | 1 - src/mappings/erc-721-pool.ts | 1 - src/utils/pool/liquidation.ts | 9 +++++---- src/utils/pool/pool.ts | 10 ---------- tests/erc-20-pool.test.ts | 30 ++++++++++-------------------- tests/erc-721-pool.test.ts | 12 ++++-------- tests/utils/common.ts | 1 - tests/utils/mock-contract-calls.ts | 14 +------------- 10 files changed, 21 insertions(+), 62 deletions(-) diff --git a/schema.graphql b/schema.graphql index 5cf6c8a..eaec4aa 100644 --- a/schema.graphql +++ b/schema.graphql @@ -86,7 +86,6 @@ type Pool @entity { htpIndex: Int! # current highest threshold price index lup: BigDecimal! # current lowest utilized price lupIndex: Int! # current lowest utilized price index - momp: BigDecimal! # most optimistic matching price # RESERVES INFORMATION # current reserves contractQuoteBalance + poolDebt - pool.depositSize() @@ -264,6 +263,7 @@ type LiquidationAuction @entity { bondSize: BigDecimal! # bond provided by kicker to initate auction bondFactor: BigDecimal! # bond factor determining the reward or penalty for the kicker neutralPrice: BigDecimal! # price at which kicker will have their bond returned without penalty or reward + referencePrice: BigDecimal! # max(HTP, NP) used in auction price curve } # tracks the reserve auction process across multiple takes in a single auction @@ -420,7 +420,6 @@ type Flashloan @entity(immutable: true) { type Kick @entity { id: Bytes! kicker: Bytes! # address of the kicker - kickMomp: BigDecimal! # pool MOMP at the time of kicking pool: Pool! # Pool in which a kick occurred loan: Loan! # Loan which was kicked locked: BigDecimal! # amount of quote from the bond locked in the kick (updated on take) TODO: rename bondLocked @@ -503,7 +502,6 @@ type RepayDebt @entity(immutable: true) { type ReserveAuctionKick @entity(immutable: true) { id: Bytes! # transaction.hash + transaction.from kicker: Bytes # address of the taker, null if emitted as start of event - kickerAward: BigDecimal! # amount of quote rewarded to kicker for starting reserves auction reserveAuction: ReserveAuction! # reserve auction in which the take is occuring pool: Pool! # pool in which the auction was kicked claimableReserves: BigDecimal! # uint256 initial amount of claimable reserves in the auction diff --git a/src/mappings/base/base-pool.ts b/src/mappings/base/base-pool.ts index 180deb6..abe6a10 100644 --- a/src/mappings/base/base-pool.ts +++ b/src/mappings/base/base-pool.ts @@ -641,7 +641,6 @@ export function _handleReserveAuctionKick(event: ethereum.Event, currentBurnEpoc updatePool(pool) addReserveAuctionToPool(pool, reserveAuction) pool.txCount = pool.txCount.plus(ONE_BI) - reserveKick.kickerAward = reserveAuctionKickerReward(pool) // update account state const account = loadOrCreateAccount(addressToBytes(event.transaction.from)) diff --git a/src/mappings/erc-20-pool.ts b/src/mappings/erc-20-pool.ts index 1ce54e7..c31faf9 100644 --- a/src/mappings/erc-20-pool.ts +++ b/src/mappings/erc-20-pool.ts @@ -384,7 +384,6 @@ export function handleKick(event: KickEvent): void { const auction = loadOrCreateLiquidationAuction(pool.id, auctionId, kick, loan) updateLiquidationAuction(auction, auctionInfo, auctionStatus) - kick.kickMomp = wadToDecimal(auctionInfo.kickMomp) kick.startingPrice = wadToDecimal(auctionStatus.price) kick.pool = pool.id kick.loan = loan.id diff --git a/src/mappings/erc-721-pool.ts b/src/mappings/erc-721-pool.ts index c595f9b..49eaf87 100644 --- a/src/mappings/erc-721-pool.ts +++ b/src/mappings/erc-721-pool.ts @@ -572,7 +572,6 @@ export function handleKick(event: KickEvent): void { const auction = loadOrCreateLiquidationAuction(pool.id, auctionId, kick, loan) updateLiquidationAuction(auction, auctionInfo, auctionStatus) - kick.kickMomp = wadToDecimal(auctionInfo.kickMomp) kick.startingPrice = wadToDecimal(auctionStatus.price) kick.pool = pool.id kick.loan = loan.id diff --git a/src/utils/pool/liquidation.ts b/src/utils/pool/liquidation.ts index 8b6c8d7..4a5f669 100644 --- a/src/utils/pool/liquidation.ts +++ b/src/utils/pool/liquidation.ts @@ -1,6 +1,6 @@ import { Address, BigDecimal, BigInt, Bytes, Value, dataSource } from "@graphprotocol/graph-ts" -import { LiquidationAuction, Kick, Loan, Pool, BucketTake } from "../../../generated/schema" +import { LiquidationAuction, Kick, Loan, Pool, BucketTake } from '../../../generated/schema'; import { ERC20Pool } from '../../../generated/templates/ERC20Pool/ERC20Pool' import { ERC721Pool } from "../../../generated/templates/ERC721Pool/ERC721Pool" import { PoolInfoUtils } from "../../../generated/templates/ERC20Pool/PoolInfoUtils" @@ -81,6 +81,7 @@ export function updateLiquidationAuction( liquidationAuction.bondSize = wadToDecimal(auctionInfo.bondSize) liquidationAuction.kickTime = auctionInfo.kickTime liquidationAuction.neutralPrice = wadToDecimal(auctionInfo.neutralPrice) + liquidationAuction.referencePrice = wadToDecimal(auctionInfo.referencePrice) } // update remaining quantities even if auction was settled and they are 0 @@ -96,18 +97,18 @@ export class AuctionInfo { bondFactor: BigInt bondSize: BigInt kickTime: BigInt - kickMomp: BigInt + referencePrice: BigInt neutralPrice: BigInt head: Address next: Address prev: Address alreadyTaken: bool - constructor(kicker: Address, bondFactor: BigInt, bondSize: BigInt, kickTime: BigInt, kickMomp: BigInt, neutralPrice: BigInt, head: Address, next: Address, prev: Address, alreadyTaken: bool) { + constructor(kicker: Address, bondFactor: BigInt, bondSize: BigInt, kickTime: BigInt, referencePrice: BigInt, neutralPrice: BigInt, head: Address, next: Address, prev: Address, alreadyTaken: bool) { this.kicker = kicker this.bondFactor = bondFactor this.bondSize = bondSize this.kickTime = kickTime - this.kickMomp = kickMomp + this.referencePrice = referencePrice this.neutralPrice = neutralPrice this.head = head this.next = next diff --git a/src/utils/pool/pool.ts b/src/utils/pool/pool.ts index 92c75ab..6b0e850 100644 --- a/src/utils/pool/pool.ts +++ b/src/utils/pool/pool.ts @@ -58,14 +58,6 @@ export function getLenderInfoERC721Pool(poolId: Bytes, bucketIndex: BigInt, lend ) } -// retrieve the current pool MOMP by calling PoolInfoUtils.momp() -export function getMomp(poolId: Bytes): BigDecimal { - const poolInfoUtilsAddress = poolInfoUtilsAddressTable.get(dataSource.network())! - const poolInfoUtilsContract = PoolInfoUtils.bind(poolInfoUtilsAddress) - const pool = Pool.load(poolId) - return wadToDecimal(poolInfoUtilsContract.momp(Address.fromBytes(poolId))) -} - export class RatesAndFees { lenderInterestMargin: BigInt borrowFeeRate: BigInt @@ -239,7 +231,6 @@ export function updatePool(pool: Pool): void { pool.htpIndex = poolPricesInfo.htpIndex.toU32() pool.lup = wadToDecimal(poolPricesInfo.lup) pool.lupIndex = poolPricesInfo.lupIndex.toU32() - pool.momp = getMomp(pool.id) // update reserve auction information const poolReservesInfo = getPoolReservesInfo(pool) @@ -440,7 +431,6 @@ export function loadOrCreatePool(id: Bytes): Pool { pool.htpIndex = 0 pool.lup = MAX_PRICE pool.lupIndex = MAX_PRICE_INDEX - pool.momp = ZERO_BD // reserve auction information pool.reserves = ZERO_BD diff --git a/tests/erc-20-pool.test.ts b/tests/erc-20-pool.test.ts index 12ae23b..9322325 100644 --- a/tests/erc-20-pool.test.ts +++ b/tests/erc-20-pool.test.ts @@ -95,7 +95,6 @@ describe("ERC20Pool assertions", () => { htpIndex: ZERO_BI, lup: MAX_PRICE_BI, lupIndex: BigInt.fromU32(MAX_PRICE_INDEX), - momp: BigInt.fromU32(623804), reserves: ZERO_BI, claimableReserves: ZERO_BI, claimableReservesRemaining: ZERO_BI, @@ -202,7 +201,6 @@ describe("ERC20Pool assertions", () => { htpIndex: ZERO_BI, lup: lup, lupIndex: BigInt.fromU32(MAX_PRICE_INDEX), //TODO: indexToPrice(lup) - momp: BigInt.fromI32(623803), reserves: ZERO_BI, claimableReserves: ZERO_BI, claimableReservesRemaining: ZERO_BI, @@ -631,8 +629,8 @@ describe("ERC20Pool assertions", () => { const kicker = Address.fromString("0x0000000000000000000000000000000000000003") const bondFactor = ONE_WAD_BI const kickTime = BigInt.fromI32(123) - const kickMomp = BigInt.fromI32(456) const neutralPrice = BigInt.fromI32(456) + const referencePrice = BigInt.fromI32(456) const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") @@ -643,7 +641,7 @@ describe("ERC20Pool assertions", () => { bondFactor, bond, kickTime, - kickMomp, + referencePrice, neutralPrice, head, next, @@ -815,7 +813,7 @@ describe("ERC20Pool assertions", () => { const bondFactor = ONE_WAD_BI const debt = BigInt.fromString("567529276179422528643") // 567.529276179422528643 * 1e18 const kickTime = BigInt.fromI32(123) - const kickMomp = BigInt.fromI32(456) + const referencePrice = BigInt.fromI32(456) const neutralPrice = BigInt.fromI32(456) const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") @@ -827,7 +825,7 @@ describe("ERC20Pool assertions", () => { bondFactor, bond, kickTime, - kickMomp, + referencePrice, neutralPrice, head, next, @@ -864,7 +862,7 @@ describe("ERC20Pool assertions", () => { bondFactor, bond, kickTime, - kickMomp, + referencePrice, neutralPrice, head, next, @@ -1006,7 +1004,7 @@ describe("ERC20Pool assertions", () => { const bondFactor = ONE_WAD_BI const debt = BigInt.fromString("567529276179422528643") // 567.529276179422528643 * 1e18 const kickTime = BigInt.fromI32(123) - const kickMomp = BigInt.fromI32(456) + const referencePrice = BigInt.fromI32(456) const neutralPrice = BigInt.fromI32(456) const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") @@ -1017,7 +1015,7 @@ describe("ERC20Pool assertions", () => { bondFactor, bond, kickTime, - kickMomp, + referencePrice, neutralPrice, head, next, @@ -1047,7 +1045,7 @@ describe("ERC20Pool assertions", () => { bondFactor, bond, kickTime, - kickMomp, + referencePrice, neutralPrice, head, next, @@ -1201,7 +1199,7 @@ describe("ERC20Pool assertions", () => { const bondFactor = ONE_WAD_BI const debt = BigInt.fromString("567529276179422528643") // 567.529276179422528643 * 1e18 const kickTime = BigInt.fromI32(123) - const kickMomp = BigInt.fromI32(456) + const referencePrice = BigInt.fromI32(456) const neutralPrice = BigInt.fromI32(456) const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") @@ -1212,7 +1210,7 @@ describe("ERC20Pool assertions", () => { bondFactor, bond, kickTime, - kickMomp, + referencePrice, neutralPrice, head, next, @@ -1264,7 +1262,6 @@ describe("ERC20Pool assertions", () => { htpIndex: ZERO_BI, lup: MAX_PRICE_BI, //TODO: indexToPrice(lup) lupIndex: BigInt.fromU32(MAX_PRICE_INDEX), - momp: BigInt.fromI32(623801), reserves: ZERO_BI, claimableReserves: claimableReserves, claimableReservesRemaining: claimableReserves, @@ -1327,12 +1324,6 @@ describe("ERC20Pool assertions", () => { "kicker", `${kicker.toHexString()}` ) - assert.fieldEquals( - "ReserveAuctionKick", - `${kickReserveAuctionID.toHexString()}`, - "kickerAward", - `${wadToDecimal(wmul(claimableReserves, ONE_PERCENT_BI))}` - ) assert.entityCount("ReserveAuction", 1) assert.fieldEquals( @@ -1382,7 +1373,6 @@ describe("ERC20Pool assertions", () => { htpIndex: ZERO_BI, lup: MAX_PRICE_BI, lupIndex: BigInt.fromU32(MAX_PRICE_INDEX), //TODO: indexToPrice(lup) - momp: BigInt.fromI32(623802), reserves: ZERO_BI, claimableReserves: claimableReservesAfterTake, claimableReservesRemaining: claimableReservesAfterTake, diff --git a/tests/erc-721-pool.test.ts b/tests/erc-721-pool.test.ts index fb9559e..490b5d4 100644 --- a/tests/erc-721-pool.test.ts +++ b/tests/erc-721-pool.test.ts @@ -95,7 +95,6 @@ describe("Describe entity assertions", () => { htpIndex: ZERO_BI, lup: MAX_PRICE_BI, lupIndex: BigInt.fromU32(MAX_PRICE_INDEX), - momp: BigInt.fromU32(623804), reserves: ZERO_BI, claimableReserves: ZERO_BI, claimableReservesRemaining: ZERO_BI, @@ -187,7 +186,6 @@ describe("Describe entity assertions", () => { htpIndex: ZERO_BI, lup: lup, lupIndex: BigInt.fromU32(MAX_PRICE_INDEX), //TODO: indexToPrice(lup) - momp: BigInt.fromI32(623803), reserves: ZERO_BI, claimableReserves: ZERO_BI, claimableReservesRemaining: ZERO_BI, @@ -579,7 +577,6 @@ describe("Describe entity assertions", () => { htpIndex: ZERO_BI, lup: MAX_PRICE_BI, lupIndex: BigInt.fromU32(MAX_PRICE_INDEX), - momp: BigInt.fromU32(623804), reserves: ZERO_BI, claimableReserves: ZERO_BI, claimableReservesRemaining: ZERO_BI, @@ -797,7 +794,7 @@ describe("Describe entity assertions", () => { const bondFactor = ONE_WAD_BI const debt = BigInt.fromString("567529276179422528643") // 567.529276179422528643 * 1e18 const kickTime = BigInt.fromI32(123) - const kickMomp = BigInt.fromI32(456) + const referencePrice = BigInt.fromI32(456) const neutralPrice = BigInt.fromI32(456) const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") @@ -810,7 +807,7 @@ describe("Describe entity assertions", () => { bondFactor, bond, kickTime, - kickMomp, + referencePrice, neutralPrice, head, next, @@ -1103,7 +1100,6 @@ describe("Describe entity assertions", () => { htpIndex: ZERO_BI, lup: lup, lupIndex: BigInt.fromU32(MAX_PRICE_INDEX), //TODO: indexToPrice(lup) - momp: BigInt.fromI32(623803), reserves: ZERO_BI, claimableReserves: ZERO_BI, claimableReservesRemaining: ZERO_BI, @@ -1193,7 +1189,7 @@ describe("Describe entity assertions", () => { const bondFactor = ONE_WAD_BI const debt = BigInt.fromString("567529276179422528643") // 567.529276179422528643 * 1e18 const kickTime = BigInt.fromI32(123) - const kickMomp = BigInt.fromI32(456) + const referencePrice = BigInt.fromI32(456) const neutralPrice = BigInt.fromI32(456) const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") @@ -1206,7 +1202,7 @@ describe("Describe entity assertions", () => { bondFactor, bond, kickTime, - kickMomp, + referencePrice, neutralPrice, head, next, diff --git a/tests/utils/common.ts b/tests/utils/common.ts index ef449e2..7d3b944 100644 --- a/tests/utils/common.ts +++ b/tests/utils/common.ts @@ -352,7 +352,6 @@ export function createAndHandleAddQuoteTokenEvent(poolAddress: Address, lender: htpIndex: ZERO_BI, lup: lup, lupIndex: BigInt.fromU32(MAX_PRICE_INDEX), //TODO: indexToPrice(lup) - momp: BigInt.fromI32(623803), reserves: ZERO_BI, claimableReserves: ZERO_BI, claimableReservesRemaining: ZERO_BI, diff --git a/tests/utils/mock-contract-calls.ts b/tests/utils/mock-contract-calls.ts index 9772fc5..49ca531 100644 --- a/tests/utils/mock-contract-calls.ts +++ b/tests/utils/mock-contract-calls.ts @@ -229,15 +229,6 @@ export function mockGetPoolPricesInfo(pool: Address, expectedInfo: PoolPricesInf ]) } -// mock getMomp contract calls -export function mockGetPoolMomp(pool: Address, expectedInfo: BigInt): void { - createMockedFunction(poolInfoUtilsAddressTable.get(dataSource.network())!, 'momp', 'momp(address):(uint256)') - .withArgs([ethereum.Value.fromAddress(pool)]) - .returns([ - ethereum.Value.fromUnsignedBigInt(expectedInfo) - ]) -} - // mock getPoolReserves contract calls export function mockGetPoolReserves(pool: Address, expectedInfo: ReservesInfo): void { createMockedFunction(poolInfoUtilsAddressTable.get(dataSource.network())!, 'poolReservesInfo', 'poolReservesInfo(address):(uint256,uint256,uint256,uint256,uint256)') @@ -272,7 +263,7 @@ export function mockGetAuctionInfo(borrower: Address, pool: Address, expectedInf ethereum.Value.fromUnsignedBigInt(expectedInfo.bondFactor), ethereum.Value.fromUnsignedBigInt(expectedInfo.bondSize), ethereum.Value.fromUnsignedBigInt(expectedInfo.kickTime), - ethereum.Value.fromUnsignedBigInt(expectedInfo.kickMomp), + ethereum.Value.fromUnsignedBigInt(expectedInfo.referencePrice), ethereum.Value.fromUnsignedBigInt(expectedInfo.neutralPrice), ethereum.Value.fromAddress(expectedInfo.head), ethereum.Value.fromAddress(expectedInfo.next), @@ -360,7 +351,6 @@ export class PoolMockParams { htpIndex: BigInt lup: BigInt lupIndex: BigInt - momp: BigInt // reserves info mock params reserves: BigInt claimableReserves: BigInt @@ -401,8 +391,6 @@ export function mockPoolInfoUtilsPoolUpdateCalls(pool: Address, params: PoolMock ) mockGetPoolPricesInfo(pool, expectedPoolPricesInfo) - mockGetPoolMomp(pool, params.momp) - const expectedPoolReservesInfo = new ReservesInfo( params.reserves, params.claimableReserves, From 6a17eef199977f902a9b8b635acae6c1c2651d7e Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 18 Oct 2023 12:03:33 -0400 Subject: [PATCH 02/19] remove dead code --- src/mappings/base/base-pool.ts | 2 +- src/utils/pool/reserve-auction.ts | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/mappings/base/base-pool.ts b/src/mappings/base/base-pool.ts index abe6a10..9e9e765 100644 --- a/src/mappings/base/base-pool.ts +++ b/src/mappings/base/base-pool.ts @@ -21,7 +21,7 @@ import { getDepositTime, getLendId, loadOrCreateLend, lpbValueInQuote, saveOrRem import { addReserveAuctionToPool, getBurnInfo, getLenderInfo, isERC20Pool, updatePool } from "../../utils/pool/pool" import { incrementTokenTxCount as incrementTokenTxCountERC20Pool } from "../../utils/token-erc20" import { incrementTokenTxCount as incrementTokenTxCountERC721Pool } from "../../utils/token-erc721" -import { loadOrCreateReserveAuction, reserveAuctionKickerReward } from "../../utils/pool/reserve-auction" +import { loadOrCreateReserveAuction } from "../../utils/pool/reserve-auction" import { saveOrRemovePositionLend } from "../../utils/position" import { decreaseAllowances, increaseAllowances, loadOrCreateAllowances, revokeAllowances, saveOrRemoveAllowances } from "../../utils/pool/lp-allowances" import { approveTransferors, loadOrCreateTransferors, revokeTransferors, saveOrRemoveTransferors } from "../../utils/pool/lp-transferors" diff --git a/src/utils/pool/reserve-auction.ts b/src/utils/pool/reserve-auction.ts index 334e31f..b7aff09 100644 --- a/src/utils/pool/reserve-auction.ts +++ b/src/utils/pool/reserve-auction.ts @@ -24,10 +24,3 @@ export function loadOrCreateReserveAuction(poolId: Bytes, burnEpoch: BigInt): Re } return reserveAuction } - -// TODO: check calculation of pool claimable reserves -export function reserveAuctionKickerReward(pool: Pool): BigDecimal { - // kicker award = claimableReserves * 0.01 - return BigDecimal.fromString(`${pool.claimableReserves}`) - .times(BigDecimal.fromString("0.01")) -} From 8ff8d2907eac315e86daabf9632242881f2bf74d Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 18 Oct 2023 15:31:15 -0400 Subject: [PATCH 03/19] update abis and networks.json; remove alreadyTaken from auctionInfo --- abis/ERC20Pool.json | 35 ++- abis/ERC721Pool.json | 33 +- abis/PoolInfoUtils.json | 21 +- abis/RewardsManager.json | 486 ----------------------------- networks.json | 6 +- src/utils/pool/liquidation.ts | 10 +- tests/erc-20-pool.test.ts | 22 +- tests/erc-721-pool.test.ts | 8 +- tests/utils/mock-contract-calls.ts | 3 +- 9 files changed, 57 insertions(+), 567 deletions(-) delete mode 100644 abis/RewardsManager.json diff --git a/abis/ERC20Pool.json b/abis/ERC20Pool.json index cf3bc3c..328b2ad 100644 --- a/abis/ERC20Pool.json +++ b/abis/ERC20Pool.json @@ -34,6 +34,11 @@ "name": "AuctionNotCleared", "type": "error" }, + { + "inputs": [], + "name": "AuctionNotTakeable", + "type": "error" + }, { "inputs": [], "name": "AuctionPriceGtBucketPrice", @@ -319,11 +324,6 @@ "name": "ReserveAuctionTooSoon", "type": "error" }, - { - "inputs": [], - "name": "TakeNotPastCooldown", - "type": "error" - }, { "inputs": [], "name": "TransactionExpired", @@ -1265,7 +1265,7 @@ }, { "internalType": "uint256", - "name": "kickMomp_", + "name": "referencePrice_", "type": "uint256" }, { @@ -1287,11 +1287,6 @@ "internalType": "address", "name": "prev_", "type": "address" - }, - { - "internalType": "bool", - "name": "alreadyTaken_", - "type": "bool" } ], "stateMutability": "view", @@ -2212,7 +2207,13 @@ } ], "name": "repayDebt", - "outputs": [], + "outputs": [ + { + "internalType": "uint256", + "name": "amountRepaid_", + "type": "uint256" + } + ], "stateMutability": "nonpayable", "type": "function" }, @@ -2324,7 +2325,13 @@ } ], "name": "take", - "outputs": [], + "outputs": [ + { + "internalType": "uint256", + "name": "collateralTaken_", + "type": "uint256" + } + ], "stateMutability": "nonpayable", "type": "function" }, @@ -2434,4 +2441,4 @@ "stateMutability": "nonpayable", "type": "function" } -] +] \ No newline at end of file diff --git a/abis/ERC721Pool.json b/abis/ERC721Pool.json index 8cb96a6..34ae7d6 100644 --- a/abis/ERC721Pool.json +++ b/abis/ERC721Pool.json @@ -34,6 +34,11 @@ "name": "AuctionNotCleared", "type": "error" }, + { + "inputs": [], + "name": "AuctionNotTakeable", + "type": "error" + }, { "inputs": [], "name": "AuctionPriceGtBucketPrice", @@ -270,11 +275,6 @@ "name": "ReserveAuctionTooSoon", "type": "error" }, - { - "inputs": [], - "name": "TakeNotPastCooldown", - "type": "error" - }, { "inputs": [], "name": "TransactionExpired", @@ -1241,7 +1241,7 @@ }, { "internalType": "uint256", - "name": "kickMomp_", + "name": "referencePrice_", "type": "uint256" }, { @@ -1263,11 +1263,6 @@ "internalType": "address", "name": "prev_", "type": "address" - }, - { - "internalType": "bool", - "name": "alreadyTaken_", - "type": "bool" } ], "stateMutability": "view", @@ -2251,7 +2246,13 @@ } ], "name": "repayDebt", - "outputs": [], + "outputs": [ + { + "internalType": "uint256", + "name": "amountRepaid_", + "type": "uint256" + } + ], "stateMutability": "nonpayable", "type": "function" }, @@ -2363,7 +2364,13 @@ } ], "name": "take", - "outputs": [], + "outputs": [ + { + "internalType": "uint256", + "name": "collateralTaken_", + "type": "uint256" + } + ], "stateMutability": "nonpayable", "type": "function" }, diff --git a/abis/PoolInfoUtils.json b/abis/PoolInfoUtils.json index 2d96218..1c996c2 100644 --- a/abis/PoolInfoUtils.json +++ b/abis/PoolInfoUtils.json @@ -484,25 +484,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "ajnaPool_", - "type": "address" - } - ], - "name": "momp", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -697,4 +678,4 @@ "stateMutability": "view", "type": "function" } -] +] \ No newline at end of file diff --git a/abis/RewardsManager.json b/abis/RewardsManager.json deleted file mode 100644 index 5d8eac2..0000000 --- a/abis/RewardsManager.json +++ /dev/null @@ -1,486 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "ajnaToken_", - "type": "address" - }, - { - "internalType": "contract IPositionManager", - "name": "positionManager_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "AlreadyClaimed", - "type": "error" - }, - { - "inputs": [], - "name": "DeployWithZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EpochNotAvailable", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientLiquidity", - "type": "error" - }, - { - "inputs": [], - "name": "MoveStakedLiquidityInvalid", - "type": "error" - }, - { - "inputs": [], - "name": "NotAjnaPool", - "type": "error" - }, - { - "inputs": [], - "name": "NotOwnerOfDeposit", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "ajnaPool", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "epochsClaimed", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ClaimRewards", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "fromIndexes", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "toIndexes", - "type": "uint256[]" - } - ], - "name": "MoveStakedLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "ajnaPool", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Stake", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "ajnaPool", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Unstake", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "ajnaPool", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "indexesUpdated", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "rewardsClaimed", - "type": "uint256" - } - ], - "name": "UpdateExchangeRates", - "type": "event" - }, - { - "inputs": [], - "name": "ajnaToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "epochToClaim_", - "type": "uint256" - } - ], - "name": "calculateRewards", - "outputs": [ - { - "internalType": "uint256", - "name": "rewards_", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "epochToClaim_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minAmount_", - "type": "uint256" - } - ], - "name": "claimRewards", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId_", - "type": "uint256" - } - ], - "name": "emergencyUnstake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bucketId_", - "type": "uint256" - } - ], - "name": "getBucketStateStakeInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId_", - "type": "uint256" - } - ], - "name": "getStakeInfo", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "pool_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "bucketIndex_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "epoch_", - "type": "uint256" - } - ], - "name": "isBucketUpdated", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "isEpochClaimed", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "positionManager", - "outputs": [ - { - "internalType": "contract IPositionManager", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "rewardsClaimed", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId_", - "type": "uint256" - } - ], - "name": "stake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId_", - "type": "uint256" - } - ], - "name": "unstake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "pool_", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "subsetHash_", - "type": "bytes32" - }, - { - "internalType": "uint256[]", - "name": "indexes_", - "type": "uint256[]" - } - ], - "name": "updateBucketExchangeRatesAndClaim", - "outputs": [ - { - "internalType": "uint256", - "name": "updateReward", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "updateRewardsClaimed", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -] diff --git a/networks.json b/networks.json index 3db6a57..a46238a 100644 --- a/networks.json +++ b/networks.json @@ -53,15 +53,15 @@ }, "goerli": { "ERC20PoolFactory": { - "address": "0x01Da8a85A5B525D476cA2b51e44fe7087fFafaFF", + "address": "0x14F2474fB5ea9DF82059053c4F85A8C803Ab10C9", "startBlock": 9289397 }, "ERC721PoolFactory": { - "address": "0x37048D43A65748409B04f4051eEd9480BEf68c82", + "address": "0xb0d1c875B240EE9f6C2c3284a31b10f1EC6De7d2", "startBlock": 9289397 }, "PositionManager": { - "address": "0x23E2EFF19bd50BfCF0364B7dCA01004D5cce41f9", + "address": "0xC4114D90F51960854ab574297Cf7CC131d445F29", "startBlock": 9289397 }, "GrantFund": { diff --git a/src/utils/pool/liquidation.ts b/src/utils/pool/liquidation.ts index 4a5f669..44c9346 100644 --- a/src/utils/pool/liquidation.ts +++ b/src/utils/pool/liquidation.ts @@ -102,8 +102,7 @@ export class AuctionInfo { head: Address next: Address prev: Address - alreadyTaken: bool - constructor(kicker: Address, bondFactor: BigInt, bondSize: BigInt, kickTime: BigInt, referencePrice: BigInt, neutralPrice: BigInt, head: Address, next: Address, prev: Address, alreadyTaken: bool) { + constructor(kicker: Address, bondFactor: BigInt, bondSize: BigInt, kickTime: BigInt, referencePrice: BigInt, neutralPrice: BigInt, head: Address, next: Address, prev: Address) { this.kicker = kicker this.bondFactor = bondFactor this.bondSize = bondSize @@ -113,7 +112,6 @@ export class AuctionInfo { this.head = head this.next = next this.prev = prev - this.alreadyTaken = alreadyTaken } } export function getAuctionInfoERC20Pool(borrower: Bytes, pool: Pool): AuctionInfo { @@ -128,8 +126,7 @@ export function getAuctionInfoERC20Pool(borrower: Bytes, pool: Pool): AuctionInf auctionInfoResult.value5, auctionInfoResult.value6, auctionInfoResult.value7, - auctionInfoResult.value8, - auctionInfoResult.value9 + auctionInfoResult.value8 ) return auctionInfo } @@ -145,8 +142,7 @@ export function getAuctionInfoERC721Pool(borrower: Bytes, pool: Pool): AuctionIn auctionInfoResult.value5, auctionInfoResult.value6, auctionInfoResult.value7, - auctionInfoResult.value8, - auctionInfoResult.value9 + auctionInfoResult.value8 ) return auctionInfo } diff --git a/tests/erc-20-pool.test.ts b/tests/erc-20-pool.test.ts index 9322325..c876f19 100644 --- a/tests/erc-20-pool.test.ts +++ b/tests/erc-20-pool.test.ts @@ -634,7 +634,6 @@ describe("ERC20Pool assertions", () => { const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") - const alreadyTaken = false const startPrice = neutralPrice.times(BigInt.fromU32(32)) const expectedAuctionInfo = new AuctionInfo( kicker, @@ -645,8 +644,7 @@ describe("ERC20Pool assertions", () => { neutralPrice, head, next, - prev, - alreadyTaken + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) const expectedAuctionStatus = new AuctionStatus( @@ -818,7 +816,6 @@ describe("ERC20Pool assertions", () => { const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") - const alreadyTaken = false let expectedAuctionInfo = new AuctionInfo( kicker, @@ -829,8 +826,7 @@ describe("ERC20Pool assertions", () => { neutralPrice, head, next, - prev, - false + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) @@ -866,8 +862,7 @@ describe("ERC20Pool assertions", () => { neutralPrice, head, next, - prev, - alreadyTaken + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) const expectedAuctionStatus = new AuctionStatus( @@ -1009,7 +1004,6 @@ describe("ERC20Pool assertions", () => { const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") - const alreadyTaken = false let expectedAuctionInfo = new AuctionInfo( kicker, bondFactor, @@ -1019,8 +1013,7 @@ describe("ERC20Pool assertions", () => { neutralPrice, head, next, - prev, - alreadyTaken + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) @@ -1049,8 +1042,7 @@ describe("ERC20Pool assertions", () => { neutralPrice, head, next, - prev, - alreadyTaken + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) const expectedAuctionStatus = new AuctionStatus( @@ -1204,7 +1196,6 @@ describe("ERC20Pool assertions", () => { const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") - const alreadyTaken = false let expectedAuctionInfo = new AuctionInfo( kicker, bondFactor, @@ -1214,8 +1205,7 @@ describe("ERC20Pool assertions", () => { neutralPrice, head, next, - prev, - alreadyTaken + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) diff --git a/tests/erc-721-pool.test.ts b/tests/erc-721-pool.test.ts index 490b5d4..f94f81d 100644 --- a/tests/erc-721-pool.test.ts +++ b/tests/erc-721-pool.test.ts @@ -799,7 +799,6 @@ describe("Describe entity assertions", () => { const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") - const alreadyTaken = false // mock required contract calls let expectedAuctionInfo = new AuctionInfo( @@ -811,8 +810,7 @@ describe("Describe entity assertions", () => { neutralPrice, head, next, - prev, - false + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) @@ -1194,7 +1192,6 @@ describe("Describe entity assertions", () => { const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") - const alreadyTaken = false // mock required contract calls let expectedAuctionInfo = new AuctionInfo( @@ -1206,8 +1203,7 @@ describe("Describe entity assertions", () => { neutralPrice, head, next, - prev, - false + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) diff --git a/tests/utils/mock-contract-calls.ts b/tests/utils/mock-contract-calls.ts index 49ca531..45b44bc 100644 --- a/tests/utils/mock-contract-calls.ts +++ b/tests/utils/mock-contract-calls.ts @@ -267,8 +267,7 @@ export function mockGetAuctionInfo(borrower: Address, pool: Address, expectedInf ethereum.Value.fromUnsignedBigInt(expectedInfo.neutralPrice), ethereum.Value.fromAddress(expectedInfo.head), ethereum.Value.fromAddress(expectedInfo.next), - ethereum.Value.fromAddress(expectedInfo.prev), - ethereum.Value.fromBoolean(expectedInfo.alreadyTaken) + ethereum.Value.fromAddress(expectedInfo.prev) ]) } From 646c667384351323403c9adbdfb2ab465fb3035e Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 18 Oct 2023 15:34:45 -0400 Subject: [PATCH 04/19] update ganache addresses --- networks.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/networks.json b/networks.json index a46238a..ed0418f 100644 --- a/networks.json +++ b/networks.json @@ -105,26 +105,26 @@ }, "ganache": { "ERC20PoolFactory": { - "address": "0x9617ABE221F9A9c492D5348be56aef4Db75A692d", + "address": "0x6C3ff638Ad7D4CA25600b5236CeFcb41B3895F8e", "startBlock": 0 }, "ERC721PoolFactory": { - "address": "0x4f05DA51eAAB00e5812c54e370fB95D4C9c51F21", + "address": "0x6fE7DEB17CC00A3d65f3CDf852Bb17DddEddf8E7", "startBlock": 0 }, "PositionManager": { - "address": "0x6548dF23A854f72335902e58a1e59B50bb3f11F1", + "address": "0x502dD41556B128C23F8B715dBEEBB73D1F1Feb67", "startBlock": 0 }, "GrantFund": { - "address": "0x0b3A0ea1Fc7207d3e3ed9973025dA9d0e8fb0F3f", + "address": "0x6F985d253b1Be2a2c9267A447F74fE44F413F2a6", "startBlock": 0 }, "AjnaToken": { - "address": "0x25Af17eF4E2E6A4A2CE586C9D25dF87FD84D4a7d" + "address": "0x3c55A1F2Dde70ce9481621c67Eb4F6d1d1CB8dBc" }, "BurnWrappedAjna": { - "address": "0xE340B87CEd1af1AbE1CE8D617c84B7f168e3b18b" + "address": "0x19FCc2FFFc1AB0f56f3e706a76021560F557241d" } } } \ No newline at end of file From 07790881f3cbf353b48def97b301f1e6ad24b842 Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 18 Oct 2023 15:38:07 -0400 Subject: [PATCH 05/19] fix mock interface --- tests/utils/mock-contract-calls.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/utils/mock-contract-calls.ts b/tests/utils/mock-contract-calls.ts index 45b44bc..b125be2 100644 --- a/tests/utils/mock-contract-calls.ts +++ b/tests/utils/mock-contract-calls.ts @@ -256,7 +256,7 @@ export function mockGetPoolUtilizationInfo(pool: Address, expectedInfo: PoolUtil // mock auctionInfo contract calls export function mockGetAuctionInfo(borrower: Address, pool: Address, expectedInfo: AuctionInfo): void { - createMockedFunction(pool, 'auctionInfo', 'auctionInfo(address):(address,uint256,uint256,uint256,uint256,uint256,address,address,address,bool)') + createMockedFunction(pool, 'auctionInfo', 'auctionInfo(address):(address,uint256,uint256,uint256,uint256,uint256,address,address,address)') .withArgs([ethereum.Value.fromAddress(borrower)]) .returns([ ethereum.Value.fromAddress(expectedInfo.kicker), From 814814b804f7e597b09ed0aed40ffecfe1b3b904 Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 18 Oct 2023 16:10:25 -0400 Subject: [PATCH 06/19] update start block --- networks.json | 6 +++--- subgraph.yaml | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/networks.json b/networks.json index ed0418f..21a7182 100644 --- a/networks.json +++ b/networks.json @@ -54,15 +54,15 @@ "goerli": { "ERC20PoolFactory": { "address": "0x14F2474fB5ea9DF82059053c4F85A8C803Ab10C9", - "startBlock": 9289397 + "startBlock": 9888337 }, "ERC721PoolFactory": { "address": "0xb0d1c875B240EE9f6C2c3284a31b10f1EC6De7d2", - "startBlock": 9289397 + "startBlock": 9888337 }, "PositionManager": { "address": "0xC4114D90F51960854ab574297Cf7CC131d445F29", - "startBlock": 9289397 + "startBlock": 9888337 }, "GrantFund": { "address": "0x881b4dFF6C72babA6f5eA60f34A61410c1EA1ec2", diff --git a/subgraph.yaml b/subgraph.yaml index 02d7d08..ed57de3 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -6,8 +6,8 @@ dataSources: name: PositionManager source: abi: PositionManager - address: "0x23E2EFF19bd50BfCF0364B7dCA01004D5cce41f9" - startBlock: 9289397 + address: "0xC4114D90F51960854ab574297Cf7CC131d445F29" + startBlock: 9888337 mapping: kind: ethereum/events apiVersion: 0.0.7 @@ -51,8 +51,8 @@ dataSources: name: ERC20PoolFactory source: abi: ERC20PoolFactory - address: "0x01Da8a85A5B525D476cA2b51e44fe7087fFafaFF" - startBlock: 9289397 + address: "0x14F2474fB5ea9DF82059053c4F85A8C803Ab10C9" + startBlock: 9888337 mapping: kind: ethereum/events apiVersion: 0.0.7 @@ -77,8 +77,8 @@ dataSources: name: ERC721PoolFactory source: abi: ERC721PoolFactory - address: "0x37048D43A65748409B04f4051eEd9480BEf68c82" - startBlock: 9289397 + address: "0xb0d1c875B240EE9f6C2c3284a31b10f1EC6De7d2" + startBlock: 9888337 mapping: kind: ethereum/events apiVersion: 0.0.7 From 86553bd02d12c714cc417083863f5680e8bc0c17 Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 18 Oct 2023 16:14:30 -0400 Subject: [PATCH 07/19] update remaining addresses --- src/utils/constants.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 1accb19..edad0ab 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -31,12 +31,12 @@ export const MAX_BUCKET_INDEX = 4156; export const poolInfoUtilsAddressTable = new TypedMap() poolInfoUtilsAddressTable.set('mainnet', Address.fromString('0x154FFf344f426F99E328bacf70f4Eb632210ecdc')) poolInfoUtilsAddressTable.set('matic', Address.fromString('0xA9Ada58DD3c820b30D3bf5B490226F2ef92107bA')) -poolInfoUtilsAddressTable.set('goerli', Address.fromString('0xBB61407715cDf92b2784E9d2F1675c4B8505cBd8')) +poolInfoUtilsAddressTable.set('goerli', Address.fromString('0x08F304cBeA7FAF48C93C27ae1305E220913a571d')) poolInfoUtilsAddressTable.set('mumbai', Address.fromString('0x39250241CC84Dadb1cDFE3A1a717631e2aA603eB')) -poolInfoUtilsAddressTable.set('ganache', Address.fromString('0x6c5c7fD98415168ada1930d44447790959097482')) +poolInfoUtilsAddressTable.set('ganache', Address.fromString('0xab56A77bDFe82b36875e92CE717fE533C1709A9D')) export const positionManagerAddressTable = new TypedMap() -positionManagerAddressTable.set('goerli', Address.fromString('0x23E2EFF19bd50BfCF0364B7dCA01004D5cce41f9')) -positionManagerAddressTable.set('ganache', Address.fromString('0x6548dF23A854f72335902e58a1e59B50bb3f11F1')) +positionManagerAddressTable.set('goerli', Address.fromString('0xC4114D90F51960854ab574297Cf7CC131d445F29')) +positionManagerAddressTable.set('ganache', Address.fromString('0x502dD41556B128C23F8B715dBEEBB73D1F1Feb67')) // GrantFund constants export const CHALLENGE_PERIOD_LENGTH = BigInt.fromI32(50400) From c85d2874f0fe8768c5ad54604ff528f0acbfe23a Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 18 Oct 2023 16:16:01 -0400 Subject: [PATCH 08/19] nit fix new line --- abis/ERC20Pool.json | 2 +- abis/PoolInfoUtils.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/abis/ERC20Pool.json b/abis/ERC20Pool.json index 328b2ad..3a99e08 100644 --- a/abis/ERC20Pool.json +++ b/abis/ERC20Pool.json @@ -2441,4 +2441,4 @@ "stateMutability": "nonpayable", "type": "function" } -] \ No newline at end of file +] diff --git a/abis/PoolInfoUtils.json b/abis/PoolInfoUtils.json index 1c996c2..f4792e6 100644 --- a/abis/PoolInfoUtils.json +++ b/abis/PoolInfoUtils.json @@ -678,4 +678,4 @@ "stateMutability": "view", "type": "function" } -] \ No newline at end of file +] From 2482d50051dd8c629f0aa7b860ee260a484f0fed Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 18 Oct 2023 16:19:32 -0400 Subject: [PATCH 09/19] update local env version --- local/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local/docker-compose.yml b/local/docker-compose.yml index e90ee03..49eaf8e 100644 --- a/local/docker-compose.yml +++ b/local/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.7' services: ajna-testnet: - image: ghcr.io/ajna-finance/ajna-testnet:rc7 + image: ghcr.io/ajna-finance/ajna-testnet:rc8b ports: - 8555:8555 container_name: ajna-testnet-devenv From 1cf05f8ce7ad94f2a324e6136df17f9c4104fd83 Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 20 Oct 2023 16:11:18 -0400 Subject: [PATCH 10/19] add initial PoolInfoUtilsMulti support --- abis/PoolInfoUtilsMulticall.json | 231 +++++++++++++++++++++++++++++++ src/utils/constants.ts | 3 + src/utils/pool/pool.ts | 97 +++++++++++++ subgraph.yaml | 4 + 4 files changed, 335 insertions(+) create mode 100644 abis/PoolInfoUtilsMulticall.json diff --git a/abis/PoolInfoUtilsMulticall.json b/abis/PoolInfoUtilsMulticall.json new file mode 100644 index 0000000..4c10ca8 --- /dev/null +++ b/abis/PoolInfoUtilsMulticall.json @@ -0,0 +1,231 @@ +[ + { + "inputs": [ + { + "internalType": "contract PoolInfoUtils", + "name": "poolInfoUtils_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "functionSignatures_", + "type": "string[]" + }, + { + "internalType": "string[]", + "name": "args_", + "type": "string[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results_", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "bucketIndex_", + "type": "uint256" + } + ], + "name": "poolDetailsAndBucketInfo", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "hpb", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "hpbIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "htp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "htpIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lup", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lupIndex", + "type": "uint256" + } + ], + "internalType": "struct PoolInfoUtilsMulticall.PoolPriceInfo", + "name": "poolPriceInfo_", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "reserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "claimableReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "claimableReservesRemaining", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "auctionPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeRemaining", + "type": "uint256" + } + ], + "internalType": "struct PoolInfoUtilsMulticall.PoolReservesInfo", + "name": "poolReservesInfo_", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "poolMinDebtAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "poolCollateralization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "poolActualUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "poolTargetUtilization", + "type": "uint256" + } + ], + "internalType": "struct PoolInfoUtilsMulticall.PoolUtilizationInfo", + "name": "poolUtilizationInfo_", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "quoteTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateral", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bucketLP", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "scale", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "exchangeRate", + "type": "uint256" + } + ], + "internalType": "struct PoolInfoUtilsMulticall.BucketInfo", + "name": "bucketInfo_", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolInfoUtils", + "outputs": [ + { + "internalType": "contract PoolInfoUtils", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], + "name": "poolRatesAndFees", + "outputs": [ + { + "internalType": "uint256", + "name": "lenderInterestMargin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowFeeRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "depositFeeRate", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/src/utils/constants.ts b/src/utils/constants.ts index edad0ab..7f22c24 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -34,6 +34,9 @@ poolInfoUtilsAddressTable.set('matic', Address.fromString('0xA9Ada58DD3c820b30D3 poolInfoUtilsAddressTable.set('goerli', Address.fromString('0x08F304cBeA7FAF48C93C27ae1305E220913a571d')) poolInfoUtilsAddressTable.set('mumbai', Address.fromString('0x39250241CC84Dadb1cDFE3A1a717631e2aA603eB')) poolInfoUtilsAddressTable.set('ganache', Address.fromString('0xab56A77bDFe82b36875e92CE717fE533C1709A9D')) +export const poolInfoUtilsMulticallAddressTable = new TypedMap() +poolInfoUtilsMulticallAddressTable.set('goerli', Address.fromString('0x12874db433dBF1D0f3c73B39F96B009093A56E0E')) +poolInfoUtilsMulticallAddressTable.set('ganache', Address.fromString('0x1d00b2f5861457F8503a481774903E36872Ea17d')) export const positionManagerAddressTable = new TypedMap() positionManagerAddressTable.set('goerli', Address.fromString('0xC4114D90F51960854ab574297Cf7CC131d445F29')) positionManagerAddressTable.set('ganache', Address.fromString('0x502dD41556B128C23F8B715dBEEBB73D1F1Feb67')) diff --git a/src/utils/pool/pool.ts b/src/utils/pool/pool.ts index 6b0e850..499d511 100644 --- a/src/utils/pool/pool.ts +++ b/src/utils/pool/pool.ts @@ -11,6 +11,7 @@ import { getTokenBalance } from '../token-erc20' import { getTokenBalance as getERC721TokenBalance } from '../token-erc721' import { wmul, wdiv } from '../math' import { ERC721PoolFactory } from '../../../generated/ERC721PoolFactory/ERC721PoolFactory' +import { BucketInfo } from './bucket'; export function getPoolAddress(poolId: Bytes): Address { @@ -275,6 +276,102 @@ export function updatePool(pool: Pool): void { pool.depositFeeRate = wadToDecimal(ratesAndFees.depositFeeRate) } +export function updatePoolMulticall(pool: Pool): void { + // get pool details and bucket info + const poolDetailsAndBucketInfo = getPoolDetailsAndBucketInfo(pool) + + // update pool loan information + const poolLoansInfo = getPoolLoansInfo(pool) + pool.poolSize = wadToDecimal(poolLoansInfo.poolSize) + pool.loansCount = poolLoansInfo.loansCount + pool.maxBorrower = poolLoansInfo.maxBorrower + pool.inflator = wadToDecimal(poolLoansInfo.pendingInflator) + + + // update pool prices information + const poolPricesInfo = poolDetailsAndBucketInfo.poolPricesInfo + pool.hpb = wadToDecimal(poolPricesInfo.hpb) + pool.hpbIndex = poolPricesInfo.hpbIndex.toU32() + pool.htp = wadToDecimal(poolPricesInfo.htp) + pool.htpIndex = poolPricesInfo.htpIndex.toU32() + pool.lup = wadToDecimal(poolPricesInfo.lup) + pool.lupIndex = poolPricesInfo.lupIndex.toU32() + + // update reserve auction information + const poolReservesInfo = poolDetailsAndBucketInfo.reservesInfo + pool.reserves = wadToDecimal(poolReservesInfo.reserves) + pool.claimableReserves = wadToDecimal(poolReservesInfo.claimableReserves) + pool.claimableReservesRemaining = wadToDecimal(poolReservesInfo.claimableReservesRemaining) + + // update pool utilization information + const poolUtilizationInfo = poolDetailsAndBucketInfo.poolUtilizationInfo + pool.minDebtAmount = wadToDecimal(poolUtilizationInfo.minDebtAmount) + pool.actualUtilization = wadToDecimal(poolUtilizationInfo.actualUtilization) + pool.targetUtilization = wadToDecimal(poolUtilizationInfo.targetUtilization) + + + // update pool token balances + // update quote token balances, this is common between all pool types + const poolAddress = Address.fromBytes(pool.id) + let token = Token.load(pool.quoteToken)! + let scaleFactor = TEN_BI.pow(18 - token.decimals as u8) + let unnormalizedTokenBalance = getTokenBalance(Address.fromBytes(pool.quoteToken), poolAddress) + pool.quoteTokenBalance = wadToDecimal(unnormalizedTokenBalance.times(scaleFactor)) + // update collateral token balances + // use the appropriate contract for querying balanceOf the pool + if (pool.poolType == 'Fungible') { + token = Token.load(pool.collateralToken)! + scaleFactor = TEN_BI.pow(18 - token.decimals as u8) + unnormalizedTokenBalance = getTokenBalance(Address.fromBytes(pool.collateralToken), poolAddress) + } else { + scaleFactor = TEN_BI.pow(18) // assume 18 decimal factor for ERC721 + unnormalizedTokenBalance = getERC721TokenBalance(Address.fromBytes(pool.collateralToken), poolAddress) + } + pool.collateralBalance = wadToDecimal(unnormalizedTokenBalance.times(scaleFactor)) + + // update rates and fees which change irrespective of borrow rate + const ratesAndFees = getRatesAndFees(poolAddress) + pool.lendRate = calculateLendRate( + poolAddress, + decimalToWad(pool.borrowRate), + ratesAndFees.lenderInterestMargin, + poolPricesInfo, + debtInfo.pendingDebt) + pool.borrowFeeRate = wadToDecimal(ratesAndFees.borrowFeeRate) + pool.depositFeeRate = wadToDecimal(ratesAndFees.depositFeeRate) +} + +export class PoolDetailsAndBucketInfo { + poolPricesInfo: PoolPricesInfo + reservesInfo: ReservesInfo + poolUtilizationInfo: PoolUtilizationInfo + bucketInfo: BucketInfo + constructor(poolPricesInfo: PoolPricesInfo, reservesInfo: ReservesInfo, poolUtilizationInfo: PoolUtilizationInfo, bucketInfo: BucketInfo) { + this.poolPricesInfo = poolPricesInfo + this.reservesInfo = reservesInfo + this.poolUtilizationInfo = poolUtilizationInfo + this.bucketInfo = bucketInfo + } +} +export function getPoolDetailsAndBucketInfo(pool: Pool): PoolDetailsAndBucketInfo { + const poolInfoUtilsMulticallAddress = poolInfoUtilsMulticallAddressTable.get(dataSource.network())! + const poolInfoUtilsMulticallContract = PoolInfoUtilsMulticall.bind(poolInfoUtilsMulticallAddress) + const poolDetailsAndBucketInfoResult = poolInfoUtilsMulticallContract.poolUtilizationInfo(Address.fromBytes(pool.id)) + + const poolDetailsAndBucketInfo = new PoolDetailsAndBucketInfo( + new PoolPricesInfo(poolDetailsAndBucketInfoResult.value0), + new ReservesInfo(poolDetailsAndBucketInfoResult.value1), + new PoolUtilizationInfo(poolDetailsAndBucketInfoResult.value2), + new BucketInfo(poolDetailsAndBucketInfoResult.value3) + ) + return poolDetailsAndBucketInfo +} + + // TODO: rearrange into organized sections + /****************/ + /*** Pointers ***/ + /****************/ + // if absent, add a liquidation auction to the pool's collection of active liquidations export function addLiquidationToPool(pool: Pool, liquidationAuction: LiquidationAuction): void { const liquidationAuctions = pool.liquidationAuctions diff --git a/subgraph.yaml b/subgraph.yaml index ed57de3..e6bc1ce 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -227,6 +227,8 @@ templates: file: ./abis/ERC20Pool.json - name: PoolInfoUtils file: ./abis/PoolInfoUtils.json + - name: PoolInfoUtilsMulticall + file: ./abis/PoolInfoUtilsMulticall.json eventHandlers: - event: AddCollateral(indexed address,indexed uint256,uint256,uint256) handler: handleAddCollateral @@ -332,6 +334,8 @@ templates: file: ./abis/ERC721Pool.json - name: PoolInfoUtils file: ./abis/PoolInfoUtils.json + - name: PoolInfoUtilsMulticall + file: ./abis/PoolInfoUtilsMulticall.json eventHandlers: - event: AddCollateralNFT(indexed address,indexed uint256,uint256[],uint256) handler: handleAddCollateralNFT From dc8a6881f24a174e5afd23d1797cd3ee43ed4b00 Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 20 Oct 2023 17:06:16 -0400 Subject: [PATCH 11/19] update handleAddQuoteToken to use updatePoolMulticall: --- src/mappings/base/base-pool.ts | 4 +-- src/utils/pool/pool.ts | 48 +++++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/mappings/base/base-pool.ts b/src/mappings/base/base-pool.ts index 9e9e765..58c7ddb 100644 --- a/src/mappings/base/base-pool.ts +++ b/src/mappings/base/base-pool.ts @@ -18,7 +18,7 @@ import { ONE_BI, TEN_BI, ZERO_BD } from "../../utils/constants" import { addressToBytes, bigIntArrayToIntArray, wadToDecimal } from "../../utils/convert" import { getBucketId, getBucketInfo, loadOrCreateBucket, updateBucketLends } from "../../utils/pool/bucket" import { getDepositTime, getLendId, loadOrCreateLend, lpbValueInQuote, saveOrRemoveLend } from "../../utils/pool/lend" -import { addReserveAuctionToPool, getBurnInfo, getLenderInfo, isERC20Pool, updatePool } from "../../utils/pool/pool" +import { addReserveAuctionToPool, getBurnInfo, getLenderInfo, isERC20Pool, updatePool, updatePoolMulticall } from '../../utils/pool/pool'; import { incrementTokenTxCount as incrementTokenTxCountERC20Pool } from "../../utils/token-erc20" import { incrementTokenTxCount as incrementTokenTxCountERC721Pool } from "../../utils/token-erc721" import { loadOrCreateReserveAuction } from "../../utils/pool/reserve-auction" @@ -131,7 +131,7 @@ export function _handleAddQuoteToken(erc20Event: AddQuoteTokenERC20Event | null, addQuoteToken.transactionHash = transactionHash // update pool entity - updatePool(pool) + updatePoolMulticall(pool) pool.txCount = pool.txCount.plus(ONE_BI) // update bucket state diff --git a/src/utils/pool/pool.ts b/src/utils/pool/pool.ts index 499d511..a08f324 100644 --- a/src/utils/pool/pool.ts +++ b/src/utils/pool/pool.ts @@ -1,11 +1,12 @@ -import { BigDecimal, BigInt, Bytes, Address, dataSource, log } from '@graphprotocol/graph-ts' +import { BigDecimal, BigInt, Bytes, Address, dataSource, ethereum, log } from '@graphprotocol/graph-ts' import { LiquidationAuction, Pool, ReserveAuction, Token } from "../../../generated/schema" import { ERC20Pool } from '../../../generated/templates/ERC20Pool/ERC20Pool' import { ERC721Pool } from '../../../generated/templates/ERC721Pool/ERC721Pool' import { PoolInfoUtils } from '../../../generated/templates/ERC20Pool/PoolInfoUtils' +import { PoolInfoUtilsMulticall, PoolInfoUtilsMulticall__poolDetailsAndBucketInfoResultPoolPriceInfo_Struct } from '../../../generated/templates/ERC20Pool/PoolInfoUtilsMulticall' -import { MAX_PRICE, MAX_PRICE_INDEX, ONE_BD, poolInfoUtilsAddressTable, TEN_BI, ZERO_ADDRESS, ZERO_BD, ZERO_BI } from "../constants" +import { MAX_PRICE, MAX_PRICE_INDEX, ONE_BD, poolInfoUtilsAddressTable, poolInfoUtilsMulticallAddressTable, TEN_BI, ZERO_ADDRESS, ZERO_BD, ZERO_BI } from "../constants" import { addressToBytes, decimalToWad, wadToDecimal } from '../convert' import { getTokenBalance } from '../token-erc20' import { getTokenBalance as getERC721TokenBalance } from '../token-erc721' @@ -287,6 +288,10 @@ export function updatePoolMulticall(pool: Pool): void { pool.maxBorrower = poolLoansInfo.maxBorrower pool.inflator = wadToDecimal(poolLoansInfo.pendingInflator) + // update amount of debt in pool + const debtInfo = isERC20Pool(pool) ? getDebtInfo(pool) : getDebtInfoERC721Pool(pool) + pool.t0debt = wadToDecimal(wdiv(debtInfo.pendingDebt, poolLoansInfo.pendingInflator)) + // update pool prices information const poolPricesInfo = poolDetailsAndBucketInfo.poolPricesInfo @@ -341,28 +346,51 @@ export function updatePoolMulticall(pool: Pool): void { pool.depositFeeRate = wadToDecimal(ratesAndFees.depositFeeRate) } +// convert from internal struct to PoolPricesInfo +export function buildPoolPricesInfo(poolPricesInfoInternal: PoolInfoUtilsMulticall__poolDetailsAndBucketInfoResultPoolPriceInfo_Struct): PoolPricesInfo { + const poolPricesInfo = new PoolPricesInfo( + poolPricesInfoInternal.hpb, + poolPricesInfoInternal.hpbIndex, + poolPricesInfoInternal.htp, + poolPricesInfoInternal.htpIndex, + poolPricesInfoInternal.lup, + poolPricesInfoInternal.lupIndex + ) + return poolPricesInfo +} + export class PoolDetailsAndBucketInfo { poolPricesInfo: PoolPricesInfo reservesInfo: ReservesInfo poolUtilizationInfo: PoolUtilizationInfo - bucketInfo: BucketInfo - constructor(poolPricesInfo: PoolPricesInfo, reservesInfo: ReservesInfo, poolUtilizationInfo: PoolUtilizationInfo, bucketInfo: BucketInfo) { + constructor(poolPricesInfo: PoolPricesInfo, reservesInfo: ReservesInfo, poolUtilizationInfo: PoolUtilizationInfo) { this.poolPricesInfo = poolPricesInfo this.reservesInfo = reservesInfo this.poolUtilizationInfo = poolUtilizationInfo - this.bucketInfo = bucketInfo } } export function getPoolDetailsAndBucketInfo(pool: Pool): PoolDetailsAndBucketInfo { const poolInfoUtilsMulticallAddress = poolInfoUtilsMulticallAddressTable.get(dataSource.network())! const poolInfoUtilsMulticallContract = PoolInfoUtilsMulticall.bind(poolInfoUtilsMulticallAddress) - const poolDetailsAndBucketInfoResult = poolInfoUtilsMulticallContract.poolUtilizationInfo(Address.fromBytes(pool.id)) + // TODO: replace current hardcoded bucket index with a dynamic one + const poolDetailsAndBucketInfoResult = poolInfoUtilsMulticallContract.poolDetailsAndBucketInfo(Address.fromBytes(pool.id), BigInt.fromI32(2000)) + // FIXME: currently ignoring BucketInfo const poolDetailsAndBucketInfo = new PoolDetailsAndBucketInfo( - new PoolPricesInfo(poolDetailsAndBucketInfoResult.value0), - new ReservesInfo(poolDetailsAndBucketInfoResult.value1), - new PoolUtilizationInfo(poolDetailsAndBucketInfoResult.value2), - new BucketInfo(poolDetailsAndBucketInfoResult.value3) + buildPoolPricesInfo(poolDetailsAndBucketInfoResult.value0), + new ReservesInfo( + poolDetailsAndBucketInfoResult.value1.reserves, + poolDetailsAndBucketInfoResult.value1.claimableReserves, + poolDetailsAndBucketInfoResult.value1.claimableReservesRemaining, + poolDetailsAndBucketInfoResult.value1.auctionPrice, + poolDetailsAndBucketInfoResult.value1.timeRemaining + ), + new PoolUtilizationInfo( + poolDetailsAndBucketInfoResult.value2.poolMinDebtAmount, + poolDetailsAndBucketInfoResult.value2.poolCollateralization, + poolDetailsAndBucketInfoResult.value2.poolActualUtilization, + poolDetailsAndBucketInfoResult.value2.poolTargetUtilization + ) ) return poolDetailsAndBucketInfo } From c048fc241b54ec08fb65b98f073a6c5b16d44717 Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 26 Oct 2023 14:45:43 -0400 Subject: [PATCH 12/19] expand pool details multicall --- abis/PoolInfoUtilsMulticall.json | 470 ++++++++++++++++--------------- src/utils/pool/pool.ts | 88 +++--- 2 files changed, 288 insertions(+), 270 deletions(-) diff --git a/abis/PoolInfoUtilsMulticall.json b/abis/PoolInfoUtilsMulticall.json index 4c10ca8..852bb43 100644 --- a/abis/PoolInfoUtilsMulticall.json +++ b/abis/PoolInfoUtilsMulticall.json @@ -1,231 +1,243 @@ [ - { - "inputs": [ - { - "internalType": "contract PoolInfoUtils", - "name": "poolInfoUtils_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "string[]", - "name": "functionSignatures_", - "type": "string[]" - }, - { - "internalType": "string[]", - "name": "args_", - "type": "string[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results_", - "type": "bytes[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "ajnaPool_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "bucketIndex_", - "type": "uint256" - } - ], - "name": "poolDetailsAndBucketInfo", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "hpb", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "hpbIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "htp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "htpIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lup", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lupIndex", - "type": "uint256" - } - ], - "internalType": "struct PoolInfoUtilsMulticall.PoolPriceInfo", - "name": "poolPriceInfo_", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "reserves", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimableReserves", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimableReservesRemaining", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "auctionPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timeRemaining", - "type": "uint256" - } - ], - "internalType": "struct PoolInfoUtilsMulticall.PoolReservesInfo", - "name": "poolReservesInfo_", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "poolMinDebtAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "poolCollateralization", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "poolActualUtilization", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "poolTargetUtilization", - "type": "uint256" - } - ], - "internalType": "struct PoolInfoUtilsMulticall.PoolUtilizationInfo", - "name": "poolUtilizationInfo_", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "price", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "quoteTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bucketLP", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "scale", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "exchangeRate", - "type": "uint256" - } - ], - "internalType": "struct PoolInfoUtilsMulticall.BucketInfo", - "name": "bucketInfo_", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "poolInfoUtils", - "outputs": [ - { - "internalType": "contract PoolInfoUtils", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "ajnaPool_", - "type": "address" - } - ], - "name": "poolRatesAndFees", - "outputs": [ - { - "internalType": "uint256", - "name": "lenderInterestMargin", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowFeeRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "depositFeeRate", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + { + "inputs": [ + { + "internalType": "contract PoolInfoUtils", + "name": "poolInfoUtils_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "functionSignatures_", + "type": "string[]" + }, + { + "internalType": "string[]", + "name": "args_", + "type": "string[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results_", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], + "name": "poolDetailsMulticall", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "poolSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "loansCount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "maxBorrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "pendingInflator", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "pendingInterestFactor", + "type": "uint256" + } + ], + "internalType": "struct PoolInfoUtilsMulticall.PoolLoansInfo", + "name": "poolLoansInfo_", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "hpb", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "hpbIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "htp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "htpIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lup", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lupIndex", + "type": "uint256" + } + ], + "internalType": "struct PoolInfoUtilsMulticall.PoolPriceInfo", + "name": "poolPriceInfo_", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lenderInterestMargin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowFeeRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "depositFeeRate", + "type": "uint256" + } + ], + "internalType": "struct PoolInfoUtilsMulticall.PoolRatesAndFees", + "name": "poolRatesAndFees_", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "reserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "claimableReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "claimableReservesRemaining", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "auctionPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeRemaining", + "type": "uint256" + } + ], + "internalType": "struct PoolInfoUtilsMulticall.PoolReservesInfo", + "name": "poolReservesInfo_", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "poolMinDebtAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "poolCollateralization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "poolActualUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "poolTargetUtilization", + "type": "uint256" + } + ], + "internalType": "struct PoolInfoUtilsMulticall.PoolUtilizationInfo", + "name": "poolUtilizationInfo_", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "poolInfoUtils", + "outputs": [ + { + "internalType": "contract PoolInfoUtils", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], + "name": "poolRatesAndFeesMulticall", + "outputs": [ + { + "internalType": "uint256", + "name": "lenderInterestMargin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowFeeRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "depositFeeRate", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } ] diff --git a/src/utils/pool/pool.ts b/src/utils/pool/pool.ts index a08f324..4d6fa19 100644 --- a/src/utils/pool/pool.ts +++ b/src/utils/pool/pool.ts @@ -4,7 +4,7 @@ import { LiquidationAuction, Pool, ReserveAuction, Token } from "../../../genera import { ERC20Pool } from '../../../generated/templates/ERC20Pool/ERC20Pool' import { ERC721Pool } from '../../../generated/templates/ERC721Pool/ERC721Pool' import { PoolInfoUtils } from '../../../generated/templates/ERC20Pool/PoolInfoUtils' -import { PoolInfoUtilsMulticall, PoolInfoUtilsMulticall__poolDetailsAndBucketInfoResultPoolPriceInfo_Struct } from '../../../generated/templates/ERC20Pool/PoolInfoUtilsMulticall' +import { PoolInfoUtilsMulticall } from '../../../generated/templates/ERC20Pool/PoolInfoUtilsMulticall' import { MAX_PRICE, MAX_PRICE_INDEX, ONE_BD, poolInfoUtilsAddressTable, poolInfoUtilsMulticallAddressTable, TEN_BI, ZERO_ADDRESS, ZERO_BD, ZERO_BI } from "../constants" import { addressToBytes, decimalToWad, wadToDecimal } from '../convert' @@ -279,10 +279,10 @@ export function updatePool(pool: Pool): void { export function updatePoolMulticall(pool: Pool): void { // get pool details and bucket info - const poolDetailsAndBucketInfo = getPoolDetailsAndBucketInfo(pool) + const poolDetails = getPoolDetailsMulticall(pool) // update pool loan information - const poolLoansInfo = getPoolLoansInfo(pool) + const poolLoansInfo = poolDetails.poolLoansInfo pool.poolSize = wadToDecimal(poolLoansInfo.poolSize) pool.loansCount = poolLoansInfo.loansCount pool.maxBorrower = poolLoansInfo.maxBorrower @@ -292,9 +292,8 @@ export function updatePoolMulticall(pool: Pool): void { const debtInfo = isERC20Pool(pool) ? getDebtInfo(pool) : getDebtInfoERC721Pool(pool) pool.t0debt = wadToDecimal(wdiv(debtInfo.pendingDebt, poolLoansInfo.pendingInflator)) - // update pool prices information - const poolPricesInfo = poolDetailsAndBucketInfo.poolPricesInfo + const poolPricesInfo = poolDetails.poolPricesInfo pool.hpb = wadToDecimal(poolPricesInfo.hpb) pool.hpbIndex = poolPricesInfo.hpbIndex.toU32() pool.htp = wadToDecimal(poolPricesInfo.htp) @@ -303,18 +302,17 @@ export function updatePoolMulticall(pool: Pool): void { pool.lupIndex = poolPricesInfo.lupIndex.toU32() // update reserve auction information - const poolReservesInfo = poolDetailsAndBucketInfo.reservesInfo + const poolReservesInfo = poolDetails.reservesInfo pool.reserves = wadToDecimal(poolReservesInfo.reserves) pool.claimableReserves = wadToDecimal(poolReservesInfo.claimableReserves) pool.claimableReservesRemaining = wadToDecimal(poolReservesInfo.claimableReservesRemaining) // update pool utilization information - const poolUtilizationInfo = poolDetailsAndBucketInfo.poolUtilizationInfo + const poolUtilizationInfo = poolDetails.poolUtilizationInfo pool.minDebtAmount = wadToDecimal(poolUtilizationInfo.minDebtAmount) pool.actualUtilization = wadToDecimal(poolUtilizationInfo.actualUtilization) pool.targetUtilization = wadToDecimal(poolUtilizationInfo.targetUtilization) - // update pool token balances // update quote token balances, this is common between all pool types const poolAddress = Address.fromBytes(pool.id) @@ -335,7 +333,7 @@ export function updatePoolMulticall(pool: Pool): void { pool.collateralBalance = wadToDecimal(unnormalizedTokenBalance.times(scaleFactor)) // update rates and fees which change irrespective of borrow rate - const ratesAndFees = getRatesAndFees(poolAddress) + const ratesAndFees = poolDetails.ratesAndFeesInfo pool.lendRate = calculateLendRate( poolAddress, decimalToWad(pool.borrowRate), @@ -346,53 +344,61 @@ export function updatePoolMulticall(pool: Pool): void { pool.depositFeeRate = wadToDecimal(ratesAndFees.depositFeeRate) } -// convert from internal struct to PoolPricesInfo -export function buildPoolPricesInfo(poolPricesInfoInternal: PoolInfoUtilsMulticall__poolDetailsAndBucketInfoResultPoolPriceInfo_Struct): PoolPricesInfo { - const poolPricesInfo = new PoolPricesInfo( - poolPricesInfoInternal.hpb, - poolPricesInfoInternal.hpbIndex, - poolPricesInfoInternal.htp, - poolPricesInfoInternal.htpIndex, - poolPricesInfoInternal.lup, - poolPricesInfoInternal.lupIndex - ) - return poolPricesInfo -} - -export class PoolDetailsAndBucketInfo { +export class PoolDetails { + poolLoansInfo: LoansInfo poolPricesInfo: PoolPricesInfo + ratesAndFeesInfo: RatesAndFees reservesInfo: ReservesInfo poolUtilizationInfo: PoolUtilizationInfo - constructor(poolPricesInfo: PoolPricesInfo, reservesInfo: ReservesInfo, poolUtilizationInfo: PoolUtilizationInfo) { + constructor(poolLoansInfo: LoansInfo, poolPricesInfo: PoolPricesInfo, ratesAndFeesInfo: RatesAndFees, reservesInfo: ReservesInfo, poolUtilizationInfo: PoolUtilizationInfo) { + this.poolLoansInfo = poolLoansInfo this.poolPricesInfo = poolPricesInfo + this.ratesAndFeesInfo = ratesAndFeesInfo this.reservesInfo = reservesInfo this.poolUtilizationInfo = poolUtilizationInfo } } -export function getPoolDetailsAndBucketInfo(pool: Pool): PoolDetailsAndBucketInfo { +export function getPoolDetailsMulticall(pool: Pool): PoolDetails { const poolInfoUtilsMulticallAddress = poolInfoUtilsMulticallAddressTable.get(dataSource.network())! const poolInfoUtilsMulticallContract = PoolInfoUtilsMulticall.bind(poolInfoUtilsMulticallAddress) - // TODO: replace current hardcoded bucket index with a dynamic one - const poolDetailsAndBucketInfoResult = poolInfoUtilsMulticallContract.poolDetailsAndBucketInfo(Address.fromBytes(pool.id), BigInt.fromI32(2000)) - - // FIXME: currently ignoring BucketInfo - const poolDetailsAndBucketInfo = new PoolDetailsAndBucketInfo( - buildPoolPricesInfo(poolDetailsAndBucketInfoResult.value0), + const poolDetailsMulticallResult = poolInfoUtilsMulticallContract.poolDetailsMulticall(Address.fromBytes(pool.id)) + + const poolDetails = new PoolDetails( + new LoansInfo( + poolDetailsMulticallResult.value0.poolSize, + poolDetailsMulticallResult.value0.loansCount, + poolDetailsMulticallResult.value0.maxBorrower, + poolDetailsMulticallResult.value0.pendingInflator, + poolDetailsMulticallResult.value0.pendingInterestFactor + ), + new PoolPricesInfo( + poolDetailsMulticallResult.value1.hpb, + poolDetailsMulticallResult.value1.hpbIndex, + poolDetailsMulticallResult.value1.htp, + poolDetailsMulticallResult.value1.htpIndex, + poolDetailsMulticallResult.value1.lup, + poolDetailsMulticallResult.value1.lupIndex + ), + new RatesAndFees( + poolDetailsMulticallResult.value2.lenderInterestMargin, + poolDetailsMulticallResult.value2.borrowFeeRate, + poolDetailsMulticallResult.value2.depositFeeRate + ), new ReservesInfo( - poolDetailsAndBucketInfoResult.value1.reserves, - poolDetailsAndBucketInfoResult.value1.claimableReserves, - poolDetailsAndBucketInfoResult.value1.claimableReservesRemaining, - poolDetailsAndBucketInfoResult.value1.auctionPrice, - poolDetailsAndBucketInfoResult.value1.timeRemaining + poolDetailsMulticallResult.value3.reserves, + poolDetailsMulticallResult.value3.claimableReserves, + poolDetailsMulticallResult.value3.claimableReservesRemaining, + poolDetailsMulticallResult.value3.auctionPrice, + poolDetailsMulticallResult.value3.timeRemaining ), new PoolUtilizationInfo( - poolDetailsAndBucketInfoResult.value2.poolMinDebtAmount, - poolDetailsAndBucketInfoResult.value2.poolCollateralization, - poolDetailsAndBucketInfoResult.value2.poolActualUtilization, - poolDetailsAndBucketInfoResult.value2.poolTargetUtilization + poolDetailsMulticallResult.value4.poolMinDebtAmount, + poolDetailsMulticallResult.value4.poolCollateralization, + poolDetailsMulticallResult.value4.poolActualUtilization, + poolDetailsMulticallResult.value4.poolTargetUtilization ) ) - return poolDetailsAndBucketInfo + return poolDetails } // TODO: rearrange into organized sections From b9d15665e0390d40c615c123038133c7f08ae0ee Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 26 Oct 2023 17:55:07 -0400 Subject: [PATCH 13/19] add initial mock pool details call --- tests/utils/mock-contract-calls.ts | 51 ++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/tests/utils/mock-contract-calls.ts b/tests/utils/mock-contract-calls.ts index b125be2..5c2d508 100644 --- a/tests/utils/mock-contract-calls.ts +++ b/tests/utils/mock-contract-calls.ts @@ -2,8 +2,8 @@ import { Address, BigInt, Bytes, ethereum, dataSource, log, BigDecimal } from "@ import { createMockedFunction } from "matchstick-as" import { BucketInfo } from "../../src/utils/pool/bucket" -import { positionManagerAddressTable, poolInfoUtilsAddressTable, ZERO_BI, ONE_BI } from "../../src/utils/constants" -import { BurnInfo, DebtInfo, LoansInfo, PoolPricesInfo, PoolUtilizationInfo, ReservesInfo } from "../../src/utils/pool/pool" +import { positionManagerAddressTable, poolInfoUtilsAddressTable, ZERO_BI, ONE_BI, poolInfoUtilsMulticallAddressTable } from '../../src/utils/constants'; +import { BurnInfo, DebtInfo, LoansInfo, PoolPricesInfo, PoolUtilizationInfo, ReservesInfo, PoolDetails } from '../../src/utils/pool/pool'; import { AuctionInfo, AuctionStatus } from "../../src/utils/pool/liquidation" import { BorrowerInfo } from "../../src/utils/pool/loan" import { wdiv, wmin, wmul } from "../../src/utils/math" @@ -254,6 +254,53 @@ export function mockGetPoolUtilizationInfo(pool: Address, expectedInfo: PoolUtil ]) } +// https://github.com/LimeChain/matchstick/issues/376 +export function mockGetPoolDetailsMulticall(pool: Address, expectedPoolDetails: PoolDetails): void { + const expectedPoolLoansInfo = new ethereum.tuple(); + expectedPoolLoansInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolLoansInfo.poolSize)); + expectedPoolLoansInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolLoansInfo.loansCount)); + expectedPoolLoansInfo.push(ethereum.Value.fromAddress(expectedPoolDetails.poolLoansInfo.maxBorrower)); + expectedPoolLoansInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolLoansInfo.pendingInflator)); + expectedPoolLoansInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolLoansInfo.pendingInterestFactor)); + + const expectedPoolPricesInfo = new ethereum.tuple(); + expectedPoolPricesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolPricesInfo.hpb)); + expectedPoolPricesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolPricesInfo.hpbIndex)); + expectedPoolPricesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolPricesInfo.htp)); + expectedPoolPricesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolPricesInfo.htpIndex)); + expectedPoolPricesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolPricesInfo.lup)); + expectedPoolPricesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolPricesInfo.lupIndex)); + + const expectedRatesAndFeesInfo = new ethereum.tuple(); + expectedRatesAndFeesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.ratesAndFeesInfo.lenderInterestMargin)); + expectedRatesAndFeesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.ratesAndFeesInfo.borrowFeeRate)); + expectedRatesAndFeesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.ratesAndFeesInfo.depositFeeRate)); + + const expectedPoolReservesInfo = new ethereum.tuple(); + expectedPoolReservesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.reservesInfo.reserves)); + expectedPoolReservesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.reservesInfo.claimableReserves)); + expectedPoolReservesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.reservesInfo.claimableReservesRemaining)); + expectedPoolReservesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.reservesInfo.reserveAuctionPrice)); + expectedPoolReservesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.reservesInfo.reserveAuctionTimeRemaining)); + + const expectedPoolUtilizationInfo = new ethereum.tuple(); + expectedPoolUtilizationInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolUtilizationInfo.minDebtAmount)); + expectedPoolUtilizationInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolUtilizationInfo.collateralization)); + expectedPoolUtilizationInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolUtilizationInfo.actualUtilization)); + expectedPoolUtilizationInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolUtilizationInfo.targetUtilization)); + + createMockedFunction(poolInfoUtilsMulticallAddressTable.get(dataSource.network())!, 'poolDetailsMulticall', 'poolDetailsMulticall(address):((uint256,uint256,address,uint256,uint256),(uint256,uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256))') + .withArgs([ethereum.Value.fromAddress(pool)]) + // TODO: create new expecte tuple containings the retrieved params from each struct + .returns([ + ethereum.Value.fromTuple(expectedPoolLoansInfo), + ethereum.Value.fromTuple(expectedPoolPricesInfo), + ethereum.Value.fromTuple(expectedRatesAndFeesInfo), + ethereum.Value.fromTuple(expectedPoolReservesInfo), + ethereum.Value.fromTuple(expectedPoolUtilizationInfo) + ]) +} + // mock auctionInfo contract calls export function mockGetAuctionInfo(borrower: Address, pool: Address, expectedInfo: AuctionInfo): void { createMockedFunction(pool, 'auctionInfo', 'auctionInfo(address):(address,uint256,uint256,uint256,uint256,uint256,address,address,address)') From f7e4479cbc3bcddfccb7b4d26917d150bdb5fa02 Mon Sep 17 00:00:00 2001 From: Mike Date: Sat, 28 Oct 2023 16:49:56 -0400 Subject: [PATCH 14/19] use new updatePool method for all events; update mocks and fix tests --- src/mappings/base/base-pool.ts | 4 +- src/utils/pool/pool.ts | 64 ------------------------------ tests/utils/mock-contract-calls.ts | 48 ++++++++++++---------- 3 files changed, 28 insertions(+), 88 deletions(-) diff --git a/src/mappings/base/base-pool.ts b/src/mappings/base/base-pool.ts index 58c7ddb..4a9c7c3 100644 --- a/src/mappings/base/base-pool.ts +++ b/src/mappings/base/base-pool.ts @@ -18,7 +18,7 @@ import { ONE_BI, TEN_BI, ZERO_BD } from "../../utils/constants" import { addressToBytes, bigIntArrayToIntArray, wadToDecimal } from "../../utils/convert" import { getBucketId, getBucketInfo, loadOrCreateBucket, updateBucketLends } from "../../utils/pool/bucket" import { getDepositTime, getLendId, loadOrCreateLend, lpbValueInQuote, saveOrRemoveLend } from "../../utils/pool/lend" -import { addReserveAuctionToPool, getBurnInfo, getLenderInfo, isERC20Pool, updatePool, updatePoolMulticall } from '../../utils/pool/pool'; +import { addReserveAuctionToPool, getBurnInfo, getLenderInfo, isERC20Pool, updatePool } from '../../utils/pool/pool'; import { incrementTokenTxCount as incrementTokenTxCountERC20Pool } from "../../utils/token-erc20" import { incrementTokenTxCount as incrementTokenTxCountERC721Pool } from "../../utils/token-erc721" import { loadOrCreateReserveAuction } from "../../utils/pool/reserve-auction" @@ -131,7 +131,7 @@ export function _handleAddQuoteToken(erc20Event: AddQuoteTokenERC20Event | null, addQuoteToken.transactionHash = transactionHash // update pool entity - updatePoolMulticall(pool) + updatePool(pool) pool.txCount = pool.txCount.plus(ONE_BI) // update bucket state diff --git a/src/utils/pool/pool.ts b/src/utils/pool/pool.ts index 4d6fa19..c223cdc 100644 --- a/src/utils/pool/pool.ts +++ b/src/utils/pool/pool.ts @@ -214,70 +214,6 @@ export function getPoolUtilizationInfo(pool: Pool): PoolUtilizationInfo { // TODO: investigate checking blockHeight to avoid duplicate calls on same block export function updatePool(pool: Pool): void { - // update pool loan information - const poolLoansInfo = getPoolLoansInfo(pool) - pool.poolSize = wadToDecimal(poolLoansInfo.poolSize) - pool.loansCount = poolLoansInfo.loansCount - pool.maxBorrower = poolLoansInfo.maxBorrower - pool.inflator = wadToDecimal(poolLoansInfo.pendingInflator) - - // update amount of debt in pool - const debtInfo = isERC20Pool(pool) ? getDebtInfo(pool) : getDebtInfoERC721Pool(pool) - pool.t0debt = wadToDecimal(wdiv(debtInfo.pendingDebt, poolLoansInfo.pendingInflator)) - - // update pool prices information - const poolPricesInfo = getPoolPricesInfo(pool) - pool.hpb = wadToDecimal(poolPricesInfo.hpb) - pool.hpbIndex = poolPricesInfo.hpbIndex.toU32() - pool.htp = wadToDecimal(poolPricesInfo.htp) - pool.htpIndex = poolPricesInfo.htpIndex.toU32() - pool.lup = wadToDecimal(poolPricesInfo.lup) - pool.lupIndex = poolPricesInfo.lupIndex.toU32() - - // update reserve auction information - const poolReservesInfo = getPoolReservesInfo(pool) - pool.reserves = wadToDecimal(poolReservesInfo.reserves) - pool.claimableReserves = wadToDecimal(poolReservesInfo.claimableReserves) - pool.claimableReservesRemaining = wadToDecimal(poolReservesInfo.claimableReservesRemaining) - - // update pool utilization information - const poolUtilizationInfo = getPoolUtilizationInfo(pool) - pool.minDebtAmount = wadToDecimal(poolUtilizationInfo.minDebtAmount) - pool.actualUtilization = wadToDecimal(poolUtilizationInfo.actualUtilization) - pool.targetUtilization = wadToDecimal(poolUtilizationInfo.targetUtilization) - - // update pool token balances - // update quote token balances, this is common between all pool types - const poolAddress = Address.fromBytes(pool.id) - let token = Token.load(pool.quoteToken)! - let scaleFactor = TEN_BI.pow(18 - token.decimals as u8) - let unnormalizedTokenBalance = getTokenBalance(Address.fromBytes(pool.quoteToken), poolAddress) - pool.quoteTokenBalance = wadToDecimal(unnormalizedTokenBalance.times(scaleFactor)) - // update collateral token balances - // use the appropriate contract for querying balanceOf the pool - if (pool.poolType == 'Fungible') { - token = Token.load(pool.collateralToken)! - scaleFactor = TEN_BI.pow(18 - token.decimals as u8) - unnormalizedTokenBalance = getTokenBalance(Address.fromBytes(pool.collateralToken), poolAddress) - } else { - scaleFactor = TEN_BI.pow(18) // assume 18 decimal factor for ERC721 - unnormalizedTokenBalance = getERC721TokenBalance(Address.fromBytes(pool.collateralToken), poolAddress) - } - pool.collateralBalance = wadToDecimal(unnormalizedTokenBalance.times(scaleFactor)) - - // update rates and fees which change irrespective of borrow rate - const ratesAndFees = getRatesAndFees(poolAddress) - pool.lendRate = calculateLendRate( - poolAddress, - decimalToWad(pool.borrowRate), - ratesAndFees.lenderInterestMargin, - poolPricesInfo, - debtInfo.pendingDebt) - pool.borrowFeeRate = wadToDecimal(ratesAndFees.borrowFeeRate) - pool.depositFeeRate = wadToDecimal(ratesAndFees.depositFeeRate) -} - -export function updatePoolMulticall(pool: Pool): void { // get pool details and bucket info const poolDetails = getPoolDetailsMulticall(pool) diff --git a/tests/utils/mock-contract-calls.ts b/tests/utils/mock-contract-calls.ts index 5c2d508..1eb9d57 100644 --- a/tests/utils/mock-contract-calls.ts +++ b/tests/utils/mock-contract-calls.ts @@ -3,7 +3,7 @@ import { createMockedFunction } from "matchstick-as" import { BucketInfo } from "../../src/utils/pool/bucket" import { positionManagerAddressTable, poolInfoUtilsAddressTable, ZERO_BI, ONE_BI, poolInfoUtilsMulticallAddressTable } from '../../src/utils/constants'; -import { BurnInfo, DebtInfo, LoansInfo, PoolPricesInfo, PoolUtilizationInfo, ReservesInfo, PoolDetails } from '../../src/utils/pool/pool'; +import { BurnInfo, DebtInfo, LoansInfo, PoolPricesInfo, PoolUtilizationInfo, ReservesInfo, PoolDetails, RatesAndFees } from '../../src/utils/pool/pool'; import { AuctionInfo, AuctionStatus } from "../../src/utils/pool/liquidation" import { BorrowerInfo } from "../../src/utils/pool/loan" import { wdiv, wmin, wmul } from "../../src/utils/math" @@ -256,14 +256,14 @@ export function mockGetPoolUtilizationInfo(pool: Address, expectedInfo: PoolUtil // https://github.com/LimeChain/matchstick/issues/376 export function mockGetPoolDetailsMulticall(pool: Address, expectedPoolDetails: PoolDetails): void { - const expectedPoolLoansInfo = new ethereum.tuple(); + const expectedPoolLoansInfo = new ethereum.Tuple(); expectedPoolLoansInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolLoansInfo.poolSize)); expectedPoolLoansInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolLoansInfo.loansCount)); expectedPoolLoansInfo.push(ethereum.Value.fromAddress(expectedPoolDetails.poolLoansInfo.maxBorrower)); expectedPoolLoansInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolLoansInfo.pendingInflator)); expectedPoolLoansInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolLoansInfo.pendingInterestFactor)); - const expectedPoolPricesInfo = new ethereum.tuple(); + const expectedPoolPricesInfo = new ethereum.Tuple(); expectedPoolPricesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolPricesInfo.hpb)); expectedPoolPricesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolPricesInfo.hpbIndex)); expectedPoolPricesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolPricesInfo.htp)); @@ -271,19 +271,19 @@ export function mockGetPoolDetailsMulticall(pool: Address, expectedPoolDetails: expectedPoolPricesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolPricesInfo.lup)); expectedPoolPricesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolPricesInfo.lupIndex)); - const expectedRatesAndFeesInfo = new ethereum.tuple(); + const expectedRatesAndFeesInfo = new ethereum.Tuple(); expectedRatesAndFeesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.ratesAndFeesInfo.lenderInterestMargin)); expectedRatesAndFeesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.ratesAndFeesInfo.borrowFeeRate)); expectedRatesAndFeesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.ratesAndFeesInfo.depositFeeRate)); - const expectedPoolReservesInfo = new ethereum.tuple(); + const expectedPoolReservesInfo = new ethereum.Tuple(); expectedPoolReservesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.reservesInfo.reserves)); expectedPoolReservesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.reservesInfo.claimableReserves)); expectedPoolReservesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.reservesInfo.claimableReservesRemaining)); expectedPoolReservesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.reservesInfo.reserveAuctionPrice)); expectedPoolReservesInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.reservesInfo.reserveAuctionTimeRemaining)); - const expectedPoolUtilizationInfo = new ethereum.tuple(); + const expectedPoolUtilizationInfo = new ethereum.Tuple(); expectedPoolUtilizationInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolUtilizationInfo.minDebtAmount)); expectedPoolUtilizationInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolUtilizationInfo.collateralization)); expectedPoolUtilizationInfo.push(ethereum.Value.fromUnsignedBigInt(expectedPoolDetails.poolUtilizationInfo.actualUtilization)); @@ -383,6 +383,7 @@ export function mockDepositUpToIndex(pool: Address, index: BigInt, expectedInfo: ]) } +// TODO: reuse this for PoolDetails? export class PoolMockParams { // loans info mock params poolSize: BigInt @@ -413,6 +414,7 @@ export class PoolMockParams { // quoteTokenBalance: BigInt // TODO: add quoteBalance and collateralBalance } + // mock all pool poolInfoUtilis contract calls export function mockPoolInfoUtilsPoolUpdateCalls(pool: Address, params: PoolMockParams): void { const expectedPoolLoansInfo = new LoansInfo( @@ -422,11 +424,6 @@ export function mockPoolInfoUtilsPoolUpdateCalls(pool: Address, params: PoolMock params.inflator, ONE_BI ) - mockGetPoolLoansInfo(pool, expectedPoolLoansInfo) - - const expectedPoolDebtInfo = new DebtInfo(params.debt, ZERO_BI, ZERO_BI, ZERO_BI) - mockGetDebtInfo(pool, expectedPoolDebtInfo) - const expectedPoolPricesInfo = new PoolPricesInfo( params.hpb, params.hpbIndex, @@ -435,8 +432,12 @@ export function mockPoolInfoUtilsPoolUpdateCalls(pool: Address, params: PoolMock params.lup, params.lupIndex ) - mockGetPoolPricesInfo(pool, expectedPoolPricesInfo) - + const expectedRatesAndFeesInfo = new RatesAndFees( + // FIXME: set correct lim value here + BigInt.fromString("10000000000000000"), // 0.01 * 1e18 + BigInt.fromString("850000000000000000"), // 0.85 * 1e18 + BigInt.fromString("50000000000000000") // 0.05 * 1e18 + ) const expectedPoolReservesInfo = new ReservesInfo( params.reserves, params.claimableReserves, @@ -444,15 +445,24 @@ export function mockPoolInfoUtilsPoolUpdateCalls(pool: Address, params: PoolMock params.reserveAuctionPrice, params.reserveAuctionTimeRemaining ) - mockGetPoolReserves(pool, expectedPoolReservesInfo) - const expectedPoolUtilizationInfo = new PoolUtilizationInfo( params.minDebtAmount, params.collateralization, params.actualUtilization, params.targetUtilization ) - mockGetPoolUtilizationInfo(pool, expectedPoolUtilizationInfo) + + const expectedPoolDetails = new PoolDetails( + expectedPoolLoansInfo, + expectedPoolPricesInfo, + expectedRatesAndFeesInfo, + expectedPoolReservesInfo, + expectedPoolUtilizationInfo + ) + mockGetPoolDetailsMulticall(pool, expectedPoolDetails) + + const expectedPoolDebtInfo = new DebtInfo(params.debt, ZERO_BI, ZERO_BI, ZERO_BI) + mockGetDebtInfo(pool, expectedPoolDebtInfo) // TODO: pass expected balance to mock balance calls // load pool instance @@ -461,12 +471,6 @@ export function mockPoolInfoUtilsPoolUpdateCalls(pool: Address, params: PoolMock mockTokenBalance(Address.fromBytes(poolInstance.collateralToken), pool, decimalToWad(poolInstance.collateralBalance)) mockTokenBalance(Address.fromBytes(poolInstance.quoteToken), pool, decimalToWad(poolInstance.quoteTokenBalance)) - mockGetRatesAndFees( - pool, - BigInt.fromString("850000000000000000"), // 0.85 * 1e18 - BigInt.fromString("50000000000000000"), // 0.05 * 1e18 - ) - mockDepositUpToIndex(pool, params.lupIndex, wmul(params.poolSize, params.actualUtilization)) } From 4ded726de14e906a58425e70d2bfa6d6b6c624a2 Mon Sep 17 00:00:00 2001 From: Mike Hathaway Date: Mon, 30 Oct 2023 18:02:01 -0400 Subject: [PATCH 15/19] add poolBalanceDetails to updatePool (#78) * add poolBalanceDetails to updatePool * update tests for usage of poolBalanceDetails * fix remaining tests --------- Co-authored-by: Mike --- abis/PoolInfoUtilsMulticall.json | 76 ++++++++++++++++++++++++++++ src/utils/pool/pool.ts | 81 ++++++++++++++++++------------ tests/erc-20-pool.test.ts | 31 ++++++++++-- tests/erc-721-pool.test.ts | 30 +++++++++-- tests/utils/mock-contract-calls.ts | 57 ++++++++++++++++----- 5 files changed, 224 insertions(+), 51 deletions(-) diff --git a/abis/PoolInfoUtilsMulticall.json b/abis/PoolInfoUtilsMulticall.json index 852bb43..3ba3b1a 100644 --- a/abis/PoolInfoUtilsMulticall.json +++ b/abis/PoolInfoUtilsMulticall.json @@ -34,6 +34,82 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + }, + { + "internalType": "address", + "name": "quoteTokenAddress_", + "type": "address" + }, + { + "internalType": "address", + "name": "collateralTokenAddress_", + "type": "address" + }, + { + "internalType": "bool", + "name": "isNFT_", + "type": "bool" + } + ], + "name": "poolBalanceDetails", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "debt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accruedDebt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "debtInAuction", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "t0Debt2ToCollateral", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "depositUpToIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "quoteTokenBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralTokenBalance", + "type": "uint256" + } + ], + "internalType": "struct PoolInfoUtilsMulticall.PoolBalanceDetails", + "name": "poolBalanceDetails_", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { diff --git a/src/utils/pool/pool.ts b/src/utils/pool/pool.ts index c223cdc..b652b9f 100644 --- a/src/utils/pool/pool.ts +++ b/src/utils/pool/pool.ts @@ -7,7 +7,7 @@ import { PoolInfoUtils } from '../../../generated/templates/ERC20Pool/PoolInfoUt import { PoolInfoUtilsMulticall } from '../../../generated/templates/ERC20Pool/PoolInfoUtilsMulticall' import { MAX_PRICE, MAX_PRICE_INDEX, ONE_BD, poolInfoUtilsAddressTable, poolInfoUtilsMulticallAddressTable, TEN_BI, ZERO_ADDRESS, ZERO_BD, ZERO_BI } from "../constants" -import { addressToBytes, decimalToWad, wadToDecimal } from '../convert' +import { addressToBytes, decimalToWad, wadToDecimal } from '../convert'; import { getTokenBalance } from '../token-erc20' import { getTokenBalance as getERC721TokenBalance } from '../token-erc721' import { wmul, wdiv } from '../math' @@ -83,17 +83,14 @@ export function getRatesAndFees(poolId: Bytes): RatesAndFees { } export function calculateLendRate( - poolAddress: Address, borrowRate: BigInt, - lenderInterestMargin: BigInt, - poolPricesInfo: PoolPricesInfo, + lenderInterestMargin: BigInt, + meaningfulDeposit: BigInt, debt: BigInt ): BigDecimal { - const meaningfulPriceIndex = max(poolPricesInfo.lupIndex.toU32(), poolPricesInfo.htpIndex.toU32()) - const meaningfulDeposit = depositUpToIndex(poolAddress, meaningfulPriceIndex) if (meaningfulDeposit.equals(ZERO_BI)) return ZERO_BD const utilization = wdiv(debt, meaningfulDeposit) - return wadToDecimal(wmul(wmul(borrowRate,lenderInterestMargin), utilization)) + return wadToDecimal(wmul(wmul(borrowRate, lenderInterestMargin), utilization)) } export class LoansInfo { @@ -224,10 +221,6 @@ export function updatePool(pool: Pool): void { pool.maxBorrower = poolLoansInfo.maxBorrower pool.inflator = wadToDecimal(poolLoansInfo.pendingInflator) - // update amount of debt in pool - const debtInfo = isERC20Pool(pool) ? getDebtInfo(pool) : getDebtInfoERC721Pool(pool) - pool.t0debt = wadToDecimal(wdiv(debtInfo.pendingDebt, poolLoansInfo.pendingInflator)) - // update pool prices information const poolPricesInfo = poolDetails.poolPricesInfo pool.hpb = wadToDecimal(poolPricesInfo.hpb) @@ -250,32 +243,22 @@ export function updatePool(pool: Pool): void { pool.targetUtilization = wadToDecimal(poolUtilizationInfo.targetUtilization) // update pool token balances - // update quote token balances, this is common between all pool types - const poolAddress = Address.fromBytes(pool.id) - let token = Token.load(pool.quoteToken)! - let scaleFactor = TEN_BI.pow(18 - token.decimals as u8) - let unnormalizedTokenBalance = getTokenBalance(Address.fromBytes(pool.quoteToken), poolAddress) - pool.quoteTokenBalance = wadToDecimal(unnormalizedTokenBalance.times(scaleFactor)) - // update collateral token balances - // use the appropriate contract for querying balanceOf the pool - if (pool.poolType == 'Fungible') { - token = Token.load(pool.collateralToken)! - scaleFactor = TEN_BI.pow(18 - token.decimals as u8) - unnormalizedTokenBalance = getTokenBalance(Address.fromBytes(pool.collateralToken), poolAddress) - } else { - scaleFactor = TEN_BI.pow(18) // assume 18 decimal factor for ERC721 - unnormalizedTokenBalance = getERC721TokenBalance(Address.fromBytes(pool.collateralToken), poolAddress) - } - pool.collateralBalance = wadToDecimal(unnormalizedTokenBalance.times(scaleFactor)) + const meaningfulPriceIndex = max(poolPricesInfo.lupIndex.toU32(), poolPricesInfo.htpIndex.toU32()) + const poolBalanceDetails = getPoolBalanceDetails(pool, BigInt.fromI32(meaningfulPriceIndex)) + pool.quoteTokenBalance = wadToDecimal(poolBalanceDetails.quoteTokenBalance) + // FIXME: If isNFT then don't convert wadToDecimal? + pool.collateralBalance = wadToDecimal(poolBalanceDetails.collateralTokenBalance) + // FIXME: update t0debt -> need to take into account pending debt? + // update pool debt info + pool.t0debt = wadToDecimal(poolBalanceDetails.debt) // update rates and fees which change irrespective of borrow rate const ratesAndFees = poolDetails.ratesAndFeesInfo pool.lendRate = calculateLendRate( - poolAddress, decimalToWad(pool.borrowRate), ratesAndFees.lenderInterestMargin, - poolPricesInfo, - debtInfo.pendingDebt) + poolBalanceDetails.depositUpToIndex, + poolBalanceDetails.debt) pool.borrowFeeRate = wadToDecimal(ratesAndFees.borrowFeeRate) pool.depositFeeRate = wadToDecimal(ratesAndFees.depositFeeRate) } @@ -337,6 +320,41 @@ export function getPoolDetailsMulticall(pool: Pool): PoolDetails { return poolDetails } +export class PoolBalanceDetails { + debt: BigInt + accruedDebt: BigInt + debtInAuction: BigInt + t0Debt2ToCollateral: BigInt + depositUpToIndex: BigInt + quoteTokenBalance: BigInt + collateralTokenBalance: BigInt + constructor(debt: BigInt, accruedDebt: BigInt, debtInAuction: BigInt, t0Debt2ToCollateral: BigInt, depositUpToIndex: BigInt, quoteTokenBalance: BigInt, collateralTokenBalance: BigInt) { + this.debt = debt + this.accruedDebt = accruedDebt + this.debtInAuction = debtInAuction + this.t0Debt2ToCollateral = t0Debt2ToCollateral + this.depositUpToIndex = depositUpToIndex + this.quoteTokenBalance = quoteTokenBalance + this.collateralTokenBalance = collateralTokenBalance + } +} +export function getPoolBalanceDetails(pool: Pool, meaningFulIndex: BigInt): PoolBalanceDetails { + const poolInfoUtilsMulticallAddress = poolInfoUtilsMulticallAddressTable.get(dataSource.network())! + const poolInfoUtilsMulticallContract = PoolInfoUtilsMulticall.bind(poolInfoUtilsMulticallAddress) + const poolBalanceDetailsResult = poolInfoUtilsMulticallContract.poolBalanceDetails(Address.fromBytes(pool.id), meaningFulIndex, Address.fromBytes(pool.quoteToken), Address.fromBytes(pool.collateralToken), pool.poolType != 'Fungible') + + const poolBalanceDetails = new PoolBalanceDetails( + poolBalanceDetailsResult.debt, + poolBalanceDetailsResult.accruedDebt, + poolBalanceDetailsResult.debtInAuction, + poolBalanceDetailsResult.t0Debt2ToCollateral, + poolBalanceDetailsResult.depositUpToIndex, + poolBalanceDetailsResult.quoteTokenBalance, + poolBalanceDetailsResult.collateralTokenBalance + ) + return poolBalanceDetails +} + // TODO: rearrange into organized sections /****************/ /*** Pointers ***/ @@ -414,6 +432,7 @@ export function getBurnInfoERC721Pool(pool: Pool, burnEpoch: BigInt): BurnInfo { return burnInfo } +// FIXME: this needs to be updated export class DebtInfo { pendingDebt: BigInt accruedDebt: BigInt diff --git a/tests/erc-20-pool.test.ts b/tests/erc-20-pool.test.ts index c876f19..54711ec 100644 --- a/tests/erc-20-pool.test.ts +++ b/tests/erc-20-pool.test.ts @@ -21,7 +21,7 @@ import { import { mockGetAuctionInfo, mockGetAuctionStatus, mockGetBorrowerInfo, mockGetBucketInfo, mockGetBurnInfo, mockGetCurrentBurnEpoch, mockGetDebtInfo, mockGetLPBValueInQuote, mockGetLenderInfo, mockGetRatesAndFees, mockPoolInfoUtilsPoolUpdateCalls, mockTokenBalance } from "./utils/mock-contract-calls" import { BucketInfo, getBucketId } from "../src/utils/pool/bucket" import { addressToBytes, wadToDecimal } from "../src/utils/convert" -import { FIVE_PERCENT_BI, MAX_PRICE, MAX_PRICE_BI, MAX_PRICE_INDEX, ONE_BI, ONE_PERCENT_BI, ONE_WAD_BI, TWO_BI, ZERO_ADDRESS, ZERO_BD, ZERO_BI } from "../src/utils/constants" +import { FIVE_PERCENT_BI, MAX_PRICE, MAX_PRICE_BI, MAX_PRICE_INDEX, ONE_BI, ONE_PERCENT_BI, ONE_WAD_BI, TWO_BI, ZERO_ADDRESS, ZERO_BD, ZERO_BI } from '../src/utils/constants'; import { Account, Lend, Loan, Pool } from "../generated/schema" import { getLendId } from "../src/utils/pool/lend" import { BorrowerInfo, getLoanId } from "../src/utils/pool/loan" @@ -467,11 +467,34 @@ describe("ERC20Pool assertions", () => { const amountBorrowed = BigInt.fromString("567529276179422528643") // 567.529276179422528643 * 1e18 const collateralPledged = BigInt.fromI32(1067) const lup = BigInt.fromString("9529276179422528643") // 9.529276179422528643 * 1e18 - - const expectedPoolDebtInfo = new DebtInfo(amountBorrowed, ZERO_BI, ZERO_BI, ZERO_BI) - mockGetDebtInfo(poolAddress, expectedPoolDebtInfo) + const index = BigInt.fromI32(234) const inflator = BigInt.fromString("1002804000000000000") + + mockPoolInfoUtilsPoolUpdateCalls(poolAddress, { + poolSize: ZERO_BI, + debt: amountBorrowed, + loansCount: ONE_BI, + maxBorrower: borrower, + inflator: inflator, + hpb: ZERO_BI, //TODO: indexToPrice(price) + hpbIndex: index, + htp: ZERO_BI, //TODO: indexToPrice(price) + htpIndex: ZERO_BI, + lup: lup, + lupIndex: BigInt.fromU32(MAX_PRICE_INDEX), + reserves: ZERO_BI, + claimableReserves: ZERO_BI, + claimableReservesRemaining: ZERO_BI, + reserveAuctionPrice: ZERO_BI, + currentBurnEpoch: BigInt.fromI32(9998102), + reserveAuctionTimeRemaining: ZERO_BI, + minDebtAmount: ZERO_BI, + collateralization: ONE_WAD_BI, + actualUtilization: ZERO_BI, + targetUtilization: ONE_WAD_BI + }) + const expectedBorrowerInfo = new BorrowerInfo( wdiv(amountBorrowed, inflator), collateralPledged, diff --git a/tests/erc-721-pool.test.ts b/tests/erc-721-pool.test.ts index f94f81d..817d70d 100644 --- a/tests/erc-721-pool.test.ts +++ b/tests/erc-721-pool.test.ts @@ -256,12 +256,34 @@ describe("Describe entity assertions", () => { const tokenIdsPledged = [BigInt.fromI32(234), BigInt.fromI32(345)] const amountPledged = BigInt.fromString("2000000000000000000") const lup = BigInt.fromString("9529276179422528643") // 9.529276179422528643 * 1e18 - - // mock required contract calls - const expectedPoolDebtInfo = new DebtInfo(amountBorrowed, ZERO_BI, ZERO_BI, ZERO_BI) - mockGetDebtInfo(poolAddress, expectedPoolDebtInfo) + const index = BigInt.fromI32(123) const inflator = BigInt.fromString("1002804000000000000") + + mockPoolInfoUtilsPoolUpdateCalls(poolAddress, { + poolSize: ZERO_BI, + debt: amountBorrowed, + loansCount: ONE_BI, + maxBorrower: borrower, + inflator: inflator, + hpb: ZERO_BI, //TODO: indexToPrice(price) + hpbIndex: index, + htp: ZERO_BI, //TODO: indexToPrice(price) + htpIndex: ZERO_BI, + lup: lup, + lupIndex: BigInt.fromU32(MAX_PRICE_INDEX), + reserves: ZERO_BI, + claimableReserves: ZERO_BI, + claimableReservesRemaining: ZERO_BI, + reserveAuctionPrice: ZERO_BI, + currentBurnEpoch: BigInt.fromI32(9998102), + reserveAuctionTimeRemaining: ZERO_BI, + minDebtAmount: ZERO_BI, + collateralization: ONE_WAD_BI, + actualUtilization: ZERO_BI, + targetUtilization: ONE_WAD_BI + }) + const expectedBorrowerInfo = new BorrowerInfo( wdiv(amountBorrowed, inflator), amountPledged, diff --git a/tests/utils/mock-contract-calls.ts b/tests/utils/mock-contract-calls.ts index 1eb9d57..ad2d650 100644 --- a/tests/utils/mock-contract-calls.ts +++ b/tests/utils/mock-contract-calls.ts @@ -3,7 +3,7 @@ import { createMockedFunction } from "matchstick-as" import { BucketInfo } from "../../src/utils/pool/bucket" import { positionManagerAddressTable, poolInfoUtilsAddressTable, ZERO_BI, ONE_BI, poolInfoUtilsMulticallAddressTable } from '../../src/utils/constants'; -import { BurnInfo, DebtInfo, LoansInfo, PoolPricesInfo, PoolUtilizationInfo, ReservesInfo, PoolDetails, RatesAndFees } from '../../src/utils/pool/pool'; +import { BurnInfo, DebtInfo, LoansInfo, PoolPricesInfo, PoolUtilizationInfo, ReservesInfo, PoolDetails, RatesAndFees, PoolBalanceDetails, depositUpToIndex } from '../../src/utils/pool/pool'; import { AuctionInfo, AuctionStatus } from "../../src/utils/pool/liquidation" import { BorrowerInfo } from "../../src/utils/pool/loan" import { wdiv, wmin, wmul } from "../../src/utils/math" @@ -291,7 +291,6 @@ export function mockGetPoolDetailsMulticall(pool: Address, expectedPoolDetails: createMockedFunction(poolInfoUtilsMulticallAddressTable.get(dataSource.network())!, 'poolDetailsMulticall', 'poolDetailsMulticall(address):((uint256,uint256,address,uint256,uint256),(uint256,uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256))') .withArgs([ethereum.Value.fromAddress(pool)]) - // TODO: create new expecte tuple containings the retrieved params from each struct .returns([ ethereum.Value.fromTuple(expectedPoolLoansInfo), ethereum.Value.fromTuple(expectedPoolPricesInfo), @@ -301,6 +300,30 @@ export function mockGetPoolDetailsMulticall(pool: Address, expectedPoolDetails: ]) } +// https://github.com/LimeChain/matchstick/issues/376 +export function mockGetPoolBalanceDetails(pool: Address, meaningfulIndex: BigInt, quoteToken: Address, collateralToken: Address, isNFT: bool, expectedPoolBalanceDetails: PoolBalanceDetails): void { + const expectedPoolBalanceDetailsTuple = new ethereum.Tuple(); + expectedPoolBalanceDetailsTuple.push(ethereum.Value.fromUnsignedBigInt(expectedPoolBalanceDetails.debt)); + expectedPoolBalanceDetailsTuple.push(ethereum.Value.fromUnsignedBigInt(expectedPoolBalanceDetails.accruedDebt)); + expectedPoolBalanceDetailsTuple.push(ethereum.Value.fromUnsignedBigInt(expectedPoolBalanceDetails.debtInAuction)); + expectedPoolBalanceDetailsTuple.push(ethereum.Value.fromUnsignedBigInt(expectedPoolBalanceDetails.t0Debt2ToCollateral)); + expectedPoolBalanceDetailsTuple.push(ethereum.Value.fromUnsignedBigInt(expectedPoolBalanceDetails.depositUpToIndex)); + expectedPoolBalanceDetailsTuple.push(ethereum.Value.fromUnsignedBigInt(expectedPoolBalanceDetails.quoteTokenBalance)); + expectedPoolBalanceDetailsTuple.push(ethereum.Value.fromUnsignedBigInt(expectedPoolBalanceDetails.collateralTokenBalance)); + + createMockedFunction(poolInfoUtilsMulticallAddressTable.get(dataSource.network())!, 'poolBalanceDetails', 'poolBalanceDetails(address,uint256,address,address,bool):((uint256,uint256,uint256,uint256,uint256,uint256,uint256))') + .withArgs([ + ethereum.Value.fromAddress(pool), + ethereum.Value.fromUnsignedBigInt(meaningfulIndex), + ethereum.Value.fromAddress(quoteToken), + ethereum.Value.fromAddress(collateralToken), + ethereum.Value.fromBoolean(isNFT) + ]) + .returns([ + ethereum.Value.fromTuple(expectedPoolBalanceDetailsTuple) + ]) +} + // mock auctionInfo contract calls export function mockGetAuctionInfo(borrower: Address, pool: Address, expectedInfo: AuctionInfo): void { createMockedFunction(pool, 'auctionInfo', 'auctionInfo(address):(address,uint256,uint256,uint256,uint256,uint256,address,address,address)') @@ -383,7 +406,6 @@ export function mockDepositUpToIndex(pool: Address, index: BigInt, expectedInfo: ]) } -// TODO: reuse this for PoolDetails? export class PoolMockParams { // loans info mock params poolSize: BigInt @@ -461,17 +483,28 @@ export function mockPoolInfoUtilsPoolUpdateCalls(pool: Address, params: PoolMock ) mockGetPoolDetailsMulticall(pool, expectedPoolDetails) - const expectedPoolDebtInfo = new DebtInfo(params.debt, ZERO_BI, ZERO_BI, ZERO_BI) - mockGetDebtInfo(pool, expectedPoolDebtInfo) - - // TODO: pass expected balance to mock balance calls // load pool instance const poolInstance = Pool.load(addressToBytes(pool))! - // mock token balance calls - mockTokenBalance(Address.fromBytes(poolInstance.collateralToken), pool, decimalToWad(poolInstance.collateralBalance)) - mockTokenBalance(Address.fromBytes(poolInstance.quoteToken), pool, decimalToWad(poolInstance.quoteTokenBalance)) - - mockDepositUpToIndex(pool, params.lupIndex, wmul(params.poolSize, params.actualUtilization)) + const depositUpToIndex = wmul(params.poolSize, params.actualUtilization) + const meaningfulIndex = BigInt.fromI32(max(params.lupIndex.toI32(), params.htpIndex.toI32())) + const isNFT = poolInstance.poolType != 'Fungible' + + mockGetPoolBalanceDetails( + pool, + meaningfulIndex, + Address.fromBytes(poolInstance.quoteToken), + Address.fromBytes(poolInstance.collateralToken), + isNFT, + new PoolBalanceDetails( + params.debt, + ZERO_BI, + ZERO_BI, + ZERO_BI, + depositUpToIndex, + decimalToWad(poolInstance.quoteTokenBalance), + decimalToWad(poolInstance.collateralBalance) + ) + ) } /****************************/ From 2739272c47c10e96431df9dc796678721f3b3c78 Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 6 Dec 2023 19:02:19 -0500 Subject: [PATCH 16/19] remove dead comments; update goerli poolinfoutils multi address --- src/utils/constants.ts | 2 +- src/utils/pool/pool.ts | 2 -- tests/utils/mock-contract-calls.ts | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 7f22c24..f3b72a0 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -35,7 +35,7 @@ poolInfoUtilsAddressTable.set('goerli', Address.fromString('0x08F304cBeA7FAF48C9 poolInfoUtilsAddressTable.set('mumbai', Address.fromString('0x39250241CC84Dadb1cDFE3A1a717631e2aA603eB')) poolInfoUtilsAddressTable.set('ganache', Address.fromString('0xab56A77bDFe82b36875e92CE717fE533C1709A9D')) export const poolInfoUtilsMulticallAddressTable = new TypedMap() -poolInfoUtilsMulticallAddressTable.set('goerli', Address.fromString('0x12874db433dBF1D0f3c73B39F96B009093A56E0E')) +poolInfoUtilsMulticallAddressTable.set('goerli', Address.fromString('0xc0374Fd9d3824C6ad9866df4043469CE6fe45d8D')) poolInfoUtilsMulticallAddressTable.set('ganache', Address.fromString('0x1d00b2f5861457F8503a481774903E36872Ea17d')) export const positionManagerAddressTable = new TypedMap() positionManagerAddressTable.set('goerli', Address.fromString('0xC4114D90F51960854ab574297Cf7CC131d445F29')) diff --git a/src/utils/pool/pool.ts b/src/utils/pool/pool.ts index b652b9f..2b0f35d 100644 --- a/src/utils/pool/pool.ts +++ b/src/utils/pool/pool.ts @@ -246,9 +246,7 @@ export function updatePool(pool: Pool): void { const meaningfulPriceIndex = max(poolPricesInfo.lupIndex.toU32(), poolPricesInfo.htpIndex.toU32()) const poolBalanceDetails = getPoolBalanceDetails(pool, BigInt.fromI32(meaningfulPriceIndex)) pool.quoteTokenBalance = wadToDecimal(poolBalanceDetails.quoteTokenBalance) - // FIXME: If isNFT then don't convert wadToDecimal? pool.collateralBalance = wadToDecimal(poolBalanceDetails.collateralTokenBalance) - // FIXME: update t0debt -> need to take into account pending debt? // update pool debt info pool.t0debt = wadToDecimal(poolBalanceDetails.debt) diff --git a/tests/utils/mock-contract-calls.ts b/tests/utils/mock-contract-calls.ts index ad2d650..25375ce 100644 --- a/tests/utils/mock-contract-calls.ts +++ b/tests/utils/mock-contract-calls.ts @@ -455,7 +455,6 @@ export function mockPoolInfoUtilsPoolUpdateCalls(pool: Address, params: PoolMock params.lupIndex ) const expectedRatesAndFeesInfo = new RatesAndFees( - // FIXME: set correct lim value here BigInt.fromString("10000000000000000"), // 0.01 * 1e18 BigInt.fromString("850000000000000000"), // 0.85 * 1e18 BigInt.fromString("50000000000000000") // 0.05 * 1e18 From da9e59a33535c85d50c6428ddb76b7b8b6e42b82 Mon Sep 17 00:00:00 2001 From: Mike Hathaway Date: Wed, 20 Dec 2023 15:15:23 -0500 Subject: [PATCH 17/19] RC9 Updates (#81) * wip rc9 updates * update abis * update borrowerInfo interface; update comments and tests * fix test issues * add latest rc9 updates; fix tests --------- Co-authored-by: Mike --- .gitignore | 3 +- abis/AjnaToken.json | 448 +++- abis/ERC20.json | 278 +-- abis/ERC20Pool.json | 3482 +++++++++++++------------- abis/ERC20PoolFactory.json | 240 +- abis/ERC721.json | 396 ++- abis/ERC721Pool.json | 3620 ++++++++++++++-------------- abis/ERC721PoolFactory.json | 300 +-- abis/GrantFund.json | 5 - abis/PoolInfoUtils.json | 721 +++--- abis/PositionManager.json | 1211 +++++----- copy-abis.sh | 10 +- schema.graphql | 5 + src/mappings/erc-20-pool.ts | 10 +- src/mappings/erc-721-pool.ts | 18 +- src/utils/pool/liquidation.ts | 24 +- src/utils/pool/loan.ts | 25 +- subgraph.yaml | 4 +- tests/erc-20-pool.test.ts | 45 +- tests/erc-721-pool.test.ts | 47 +- tests/utils/mock-contract-calls.ts | 29 +- 21 files changed, 5805 insertions(+), 5116 deletions(-) diff --git a/.gitignore b/.gitignore index e85605d..65d1ea4 100644 --- a/.gitignore +++ b/.gitignore @@ -70,4 +70,5 @@ data/ # matchstick test files tests/.bin/ -tests/.latest.json \ No newline at end of file +tests/.latest.json +tests/.docker/ \ No newline at end of file diff --git a/abis/AjnaToken.json b/abis/AjnaToken.json index ce4a58c..b23d1e4 100644 --- a/abis/AjnaToken.json +++ b/abis/AjnaToken.json @@ -1,7 +1,11 @@ [ { "inputs": [ - { "internalType": "address", "name": "tokenReceiver_", "type": "address" } + { + "internalType": "address", + "name": "tokenReceiver_", + "type": "address" + } ], "stateMutability": "nonpayable", "type": "constructor" @@ -28,7 +32,7 @@ "type": "uint256" } ], - "name": "AjnaTokenApproval", + "name": "Approval", "type": "event" }, { @@ -103,48 +107,96 @@ "type": "uint256" } ], - "name": "AjnaTokenTransfer", + "name": "Transfer", "type": "event" }, { "inputs": [], "name": "DOMAIN_SEPARATOR", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } ], "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "name": "burn", "outputs": [], @@ -153,8 +205,16 @@ }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "name": "burnFrom", "outputs": [], @@ -163,15 +223,31 @@ }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" }, - { "internalType": "uint32", "name": "pos", "type": "uint32" } + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint32", + "name": "pos", + "type": "uint32" + } ], "name": "checkpoints", "outputs": [ { "components": [ - { "internalType": "uint32", "name": "fromBlock", "type": "uint32" }, - { "internalType": "uint224", "name": "votes", "type": "uint224" } + { + "internalType": "uint32", + "name": "fromBlock", + "type": "uint32" + }, + { + "internalType": "uint224", + "name": "votes", + "type": "uint224" + } ], "internalType": "struct ERC20Votes.Checkpoint", "name": "", @@ -184,13 +260,23 @@ { "inputs": [], "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, { "internalType": "uint256", "name": "subtractedValue", @@ -198,13 +284,23 @@ } ], "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "delegatee", "type": "address" } + { + "internalType": "address", + "name": "delegatee", + "type": "address" + } ], "name": "delegate", "outputs": [], @@ -213,12 +309,36 @@ }, { "inputs": [ - { "internalType": "address", "name": "delegatee", "type": "address" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, - { "internalType": "uint256", "name": "expiry", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } + { + "internalType": "address", + "name": "delegatee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } ], "name": "delegateBySig", "outputs": [], @@ -227,85 +347,197 @@ }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "delegates", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "blockNumber", "type": "uint256" } + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } ], "name": "getPastTotalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" }, - { "internalType": "uint256", "name": "blockNumber", "type": "uint256" } + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } ], "name": "getPastVotes", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "getVotes", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } ], "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" } + { + "internalType": "address", + "name": "owner", + "type": "address" + } ], "name": "nonces", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "numCheckpoints", - "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } ], "name": "permit", "outputs": [], @@ -315,48 +547,124 @@ { "inputs": [], "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "from_", "type": "address" }, - { "internalType": "address", "name": "to_", "type": "address" }, - { "internalType": "address", "name": "spender_", "type": "address" }, - { "internalType": "uint256", "name": "value_", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline_", "type": "uint256" }, - { "internalType": "uint8", "name": "v_", "type": "uint8" }, - { "internalType": "bytes32", "name": "r_", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s_", "type": "bytes32" } + { + "internalType": "address", + "name": "from_", + "type": "address" + }, + { + "internalType": "address", + "name": "to_", + "type": "address" + }, + { + "internalType": "address", + "name": "spender_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline_", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v_", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r_", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s_", + "type": "bytes32" + } ], "name": "transferFromWithPermit", "outputs": [], diff --git a/abis/ERC20.json b/abis/ERC20.json index e1f61ef..d1bf1cf 100644 --- a/abis/ERC20.json +++ b/abis/ERC20.json @@ -1,288 +1,288 @@ [ { + "type": "constructor", "inputs": [ { - "internalType": "string", "name": "name_", - "type": "string" + "type": "string", + "internalType": "string" }, { - "internalType": "string", "name": "symbol_", - "type": "string" + "type": "string", + "internalType": "string" } ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "allowance", "inputs": [ { - "internalType": "address", "name": "owner", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "spender", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "allowance", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "approve", "inputs": [ { - "internalType": "address", "name": "spender", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "amount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "approve", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "balanceOf", "inputs": [ { - "internalType": "address", "name": "account", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "balanceOf", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "decimals", + "inputs": [], "outputs": [ { - "internalType": "uint8", "name": "", - "type": "uint8" + "type": "uint8", + "internalType": "uint8" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "decreaseAllowance", "inputs": [ { - "internalType": "address", "name": "spender", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "subtractedValue", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "decreaseAllowance", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "increaseAllowance", "inputs": [ { - "internalType": "address", "name": "spender", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "addedValue", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "increaseAllowance", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { - "inputs": [], + "type": "function", "name": "name", + "inputs": [], "outputs": [ { - "internalType": "string", "name": "", - "type": "string" + "type": "string", + "internalType": "string" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "symbol", + "inputs": [], "outputs": [ { - "internalType": "string", "name": "", - "type": "string" + "type": "string", + "internalType": "string" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "totalSupply", + "inputs": [], "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "transfer", "inputs": [ { - "internalType": "address", "name": "to", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "amount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "transfer", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "transferFrom", "inputs": [ { - "internalType": "address", "name": "from", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "to", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "amount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "transferFrom", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "Approval", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "spender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "value", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Transfer", + "inputs": [ + { + "name": "from", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "value", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false } ] diff --git a/abis/ERC20Pool.json b/abis/ERC20Pool.json index 3a99e08..bd0adbf 100644 --- a/abis/ERC20Pool.json +++ b/abis/ERC20Pool.json @@ -1,2444 +1,2472 @@ [ { - "inputs": [], - "name": "AllowanceAlreadySet", - "type": "error" - }, - { - "inputs": [], - "name": "AlreadyInitialized", - "type": "error" - }, - { - "inputs": [], - "name": "AmountLTMinDebt", - "type": "error" - }, - { - "inputs": [], - "name": "AuctionActive", - "type": "error" - }, - { - "inputs": [], - "name": "AuctionNotClearable", - "type": "error" - }, - { - "inputs": [], - "name": "AuctionNotCleared", - "type": "error" - }, - { - "inputs": [], - "name": "AuctionNotCleared", - "type": "error" - }, - { - "inputs": [], - "name": "AuctionNotTakeable", - "type": "error" - }, - { - "inputs": [], - "name": "AuctionPriceGtBucketPrice", - "type": "error" - }, - { - "inputs": [], - "name": "BorrowerNotSender", - "type": "error" - }, - { - "inputs": [], - "name": "BorrowerOk", - "type": "error" - }, - { - "inputs": [], - "name": "BorrowerUnderCollateralized", - "type": "error" - }, - { - "inputs": [], - "name": "BucketBankruptcyBlock", - "type": "error" - }, - { - "inputs": [], - "name": "BucketIndexOutOfBounds", - "type": "error" - }, - { - "inputs": [], - "name": "CannotMergeToHigherPrice", - "type": "error" - }, - { - "inputs": [], - "name": "DustAmountNotExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "FlashloanCallbackFailed", - "type": "error" - }, - { - "inputs": [], - "name": "FlashloanIncorrectBalance", - "type": "error" - }, - { - "inputs": [], - "name": "FlashloanUnavailableForToken", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientCollateral", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientLP", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientLiquidity", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidAllowancesInput", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidAmount", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidIndex", - "type": "error" - }, - { - "inputs": [], - "name": "LUPBelowHTP", - "type": "error" - }, - { - "inputs": [], - "name": "LUPGreaterThanTP", - "type": "error" - }, - { - "inputs": [], - "name": "LimitIndexExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "MoveToSameIndex", - "type": "error" - }, - { - "inputs": [], - "name": "NoAllowance", - "type": "error" - }, - { - "inputs": [], - "name": "NoAuction", - "type": "error" - }, - { - "inputs": [], - "name": "NoClaim", - "type": "error" - }, - { - "inputs": [], - "name": "NoDebt", - "type": "error" - }, - { - "inputs": [], - "name": "NoReserves", - "type": "error" - }, - { - "inputs": [], - "name": "NoReservesAuction", - "type": "error" - }, - { - "inputs": [], - "name": "PRBMathSD59x18__DivInputTooSmall", - "type": "error" - }, - { + "type": "function", + "name": "addCollateral", "inputs": [ { - "internalType": "uint256", - "name": "rAbs", - "type": "uint256" + "name": "amountToAdd_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "index_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "expiry_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "PRBMathSD59x18__DivOverflow", - "type": "error" + "outputs": [ + { + "name": "bucketLP_", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "addQuoteToken", "inputs": [ { - "internalType": "int256", - "name": "x", - "type": "int256" + "name": "amount_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "index_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "expiry_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "PRBMathSD59x18__Exp2InputTooBig", - "type": "error" + "outputs": [ + { + "name": "bucketLP_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "addedAmount_", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "approveLPTransferors", "inputs": [ { - "internalType": "int256", - "name": "x", - "type": "int256" + "name": "transferors_", + "type": "address[]", + "internalType": "address[]" } ], - "name": "PRBMathSD59x18__FromIntOverflow", - "type": "error" + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "approvedTransferors", "inputs": [ { - "internalType": "int256", - "name": "x", - "type": "int256" + "name": "", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "address", + "internalType": "address" } ], - "name": "PRBMathSD59x18__FromIntUnderflow", - "type": "error" + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "auctionInfo", "inputs": [ { - "internalType": "int256", - "name": "x", - "type": "int256" + "name": "borrower_", + "type": "address", + "internalType": "address" } ], - "name": "PRBMathSD59x18__LogInputTooSmall", - "type": "error" - }, - { - "inputs": [], - "name": "PRBMathSD59x18__MulInputTooSmall", - "type": "error" + "outputs": [ + { + "name": "kicker_", + "type": "address", + "internalType": "address" + }, + { + "name": "bondFactor_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "bondSize_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "kickTime_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "referencePrice_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "neutralPrice_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "debtToCollateral_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "head_", + "type": "address", + "internalType": "address" + }, + { + "name": "next_", + "type": "address", + "internalType": "address" + }, + { + "name": "prev_", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "borrowerInfo", "inputs": [ { - "internalType": "uint256", - "name": "rAbs", - "type": "uint256" + "name": "borrower_", + "type": "address", + "internalType": "address" } ], - "name": "PRBMathSD59x18__MulOverflow", - "type": "error" + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "bucketCollateralDust", "inputs": [ { - "internalType": "int256", - "name": "x", - "type": "int256" + "name": "bucketIndex_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "PRBMathSD59x18__SqrtNegativeInput", - "type": "error" + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "pure" }, { + "type": "function", + "name": "bucketExchangeRate", "inputs": [ { - "internalType": "int256", - "name": "x", - "type": "int256" + "name": "index_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "PRBMathSD59x18__SqrtOverflow", - "type": "error" + "outputs": [ + { + "name": "exchangeRate_", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "bucketInfo", "inputs": [ { - "internalType": "uint256", - "name": "prod1", - "type": "uint256" + "name": "index_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "PRBMath__MulDivFixedPointOverflow", - "type": "error" + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "bucketTake", "inputs": [ { - "internalType": "uint256", - "name": "prod1", - "type": "uint256" + "name": "borrowerAddress_", + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", - "name": "denominator", - "type": "uint256" + "name": "depositTake_", + "type": "bool", + "internalType": "bool" + }, + { + "name": "index_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "PRBMath__MulDivOverflow", - "type": "error" - }, - { - "inputs": [], - "name": "PoolUnderCollateralized", - "type": "error" - }, - { - "inputs": [], - "name": "PriceBelowLUP", - "type": "error" - }, - { - "inputs": [], - "name": "RemoveDepositLockedByAuctionDebt", - "type": "error" - }, - { - "inputs": [], - "name": "RemoveDepositLockedByAuctionDebt", - "type": "error" - }, - { - "inputs": [], - "name": "ReserveAuctionTooSoon", - "type": "error" - }, - { - "inputs": [], - "name": "TransactionExpired", - "type": "error" + "outputs": [], + "stateMutability": "nonpayable" }, { - "inputs": [], - "name": "TransactionExpired", - "type": "error" + "type": "function", + "name": "burnInfo", + "inputs": [ + { + "name": "burnEventEpoch_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "collateralAddress", "inputs": [], - "name": "TransferToSameOwner", - "type": "error" + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "pure" }, { + "type": "function", + "name": "collateralScale", "inputs": [], - "name": "TransferorNotApproved", - "type": "error" + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "pure" }, { + "type": "function", + "name": "currentBurnEpoch", "inputs": [], - "name": "ZeroThresholdPrice", - "type": "error" + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { - "anonymous": false, - "inputs": [ + "type": "function", + "name": "debtInfo", + "inputs": [], + "outputs": [ { - "indexed": true, - "internalType": "address", - "name": "actor", - "type": "address" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": true, - "internalType": "uint256", - "name": "index", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "lpAwarded", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "AddCollateral", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "decreaseLPAllowance", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "name": "spender_", + "type": "address", + "internalType": "address" }, { - "indexed": false, - "internalType": "uint256", - "name": "lpAwarded", - "type": "uint256" + "name": "indexes_", + "type": "uint256[]", + "internalType": "uint256[]" }, { - "indexed": false, - "internalType": "uint256", - "name": "lup", - "type": "uint256" + "name": "amounts_", + "type": "uint256[]", + "internalType": "uint256[]" } ], - "name": "AddQuoteToken", - "type": "event" + "outputs": [], + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "depositIndex", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, + "name": "debt_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "address[]", - "name": "transferors", - "type": "address[]" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "ApproveLPTransferors", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "depositScale", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "lp", - "type": "uint256" - }, + "name": "index_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "index", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "AuctionNFTSettle", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" - }, + "type": "function", + "name": "depositSize", + "inputs": [], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "AuctionSettle", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "depositUpToIndex", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "kicker", - "type": "address" - }, + "name": "index_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ { - "indexed": true, - "internalType": "address", - "name": "reciever", - "type": "address" - }, + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "depositUtilization", + "inputs": [], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "BondWithdrawn", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "drawDebt", "inputs": [ { - "indexed": true, - "internalType": "uint256", - "name": "index", - "type": "uint256" + "name": "borrowerAddress_", + "type": "address", + "internalType": "address" }, { - "indexed": false, - "internalType": "uint256", - "name": "lpForfeited", - "type": "uint256" + "name": "amountToBorrow_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "limitIndex_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "collateralToPledge_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "BucketBankruptcy", - "type": "event" + "outputs": [], + "stateMutability": "nonpayable" }, { - "anonymous": false, - "inputs": [ + "type": "function", + "name": "emasInfo", + "inputs": [], + "outputs": [ { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "index", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "flashFee", + "inputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "bondChange", - "type": "uint256" + "name": "token_", + "type": "address", + "internalType": "address" }, { - "indexed": false, - "internalType": "bool", - "name": "isReward", - "type": "bool" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "BucketTake", - "type": "event" + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "flashLoan", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "taker", - "type": "address" + "name": "receiver_", + "type": "address", + "internalType": "contract IERC3156FlashBorrower" }, { - "indexed": true, - "internalType": "address", - "name": "kicker", - "type": "address" + "name": "token_", + "type": "address", + "internalType": "address" }, { - "indexed": false, - "internalType": "uint256", - "name": "lpAwardedTaker", - "type": "uint256" + "name": "amount_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "lpAwardedKicker", - "type": "uint256" + "name": "data_", + "type": "bytes", + "internalType": "bytes" } ], - "name": "BucketTakeLPAwarded", - "type": "event" + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "increaseLPAllowance", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" + "name": "spender_", + "type": "address", + "internalType": "address" }, { - "indexed": false, - "internalType": "uint256[]", - "name": "indexes", - "type": "uint256[]" + "name": "indexes_", + "type": "uint256[]", + "internalType": "uint256[]" }, { - "indexed": false, - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" + "name": "amounts_", + "type": "uint256[]", + "internalType": "uint256[]" } ], - "name": "DecreaseLPAllowance", - "type": "event" + "outputs": [], + "stateMutability": "nonpayable" }, { - "anonymous": false, - "inputs": [ + "type": "function", + "name": "inflatorInfo", + "inputs": [], + "outputs": [ { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "amountBorrowed", - "type": "uint256" - }, + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "initialize", + "inputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "collateralPledged", - "type": "uint256" + "name": "rate_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "interestRateInfo", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "lup", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "DrawDebt", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "kick", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "token", - "type": "address" + "name": "borrower_", + "type": "address", + "internalType": "address" }, { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "name": "npLimitIndex_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "Flashloan", - "type": "event" + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "kickReserveAuction", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "kickerInfo", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, + "name": "kicker_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256[]", - "name": "indexes", - "type": "uint256[]" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "IncreaseLPAllowance", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "lenderInfo", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" + "name": "index_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "debt", - "type": "uint256" - }, + "name": "lender_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" + "name": "lpBalance_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "bond", - "type": "uint256" + "name": "depositTime_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "Kick", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "lenderKick", "inputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "claimableReservesRemaining", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "auctionPrice", - "type": "uint256" + "name": "index_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "currentBurnEpoch", - "type": "uint256" + "name": "npLimitIndex_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "KickReserveAuction", - "type": "event" + "outputs": [], + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "loanInfo", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" + "name": "loanId_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "LoanStamped", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "from", - "type": "uint256" - }, + "outputs": [ { - "indexed": true, - "internalType": "uint256", - "name": "to", - "type": "uint256" + "name": "", + "type": "address", + "internalType": "address" }, { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "loansInfo", + "inputs": [], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "lpRedeemedFrom", - "type": "uint256" + "name": "", + "type": "address", + "internalType": "address" }, { - "indexed": false, - "internalType": "uint256", - "name": "lpAwardedTo", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "lup", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "MoveQuoteToken", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "lpAllowance", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "claimer", - "type": "address" + "name": "index_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": true, - "internalType": "uint256", - "name": "index", - "type": "uint256" + "name": "spender_", + "type": "address", + "internalType": "address" }, { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, + "name": "owner_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "lpRedeemed", - "type": "uint256" + "name": "allowance_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "RemoveCollateral", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "maxFlashLoan", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "lpRedeemed", - "type": "uint256" - }, + "name": "token_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "lup", - "type": "uint256" + "name": "maxLoan_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "RemoveQuoteToken", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "moveQuoteToken", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" + "name": "maxAmount_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "quoteRepaid", - "type": "uint256" + "name": "fromIndex_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "collateralPulled", - "type": "uint256" + "name": "toIndex_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "lup", - "type": "uint256" + "name": "expiry_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "RepayDebt", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "claimableReservesRemaining", - "type": "uint256" + "name": "fromBucketLP_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "auctionPrice", - "type": "uint256" + "name": "toBucketLP_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "currentBurnEpoch", - "type": "uint256" + "name": "movedAmount_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "ReserveAuction", - "type": "event" + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "multicall", "inputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "oldRate", - "type": "uint256" - }, + "name": "data", + "type": "bytes[]", + "internalType": "bytes[]" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "newRate", - "type": "uint256" + "name": "results", + "type": "bytes[]", + "internalType": "bytes[]" } ], - "name": "ResetInterestRate", - "type": "event" + "stateMutability": "nonpayable" }, { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, + "type": "function", + "name": "pledgedCollateral", + "inputs": [], + "outputs": [ { - "indexed": false, - "internalType": "uint256[]", - "name": "indexes", - "type": "uint256[]" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "RevokeLPAllowance", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, + "type": "function", + "name": "poolType", + "inputs": [], + "outputs": [ { - "indexed": false, - "internalType": "address[]", - "name": "transferors", - "type": "address[]" + "name": "", + "type": "uint8", + "internalType": "uint8" } ], - "name": "RevokeLPTransferors", - "type": "event" + "stateMutability": "pure" }, { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" - }, + "type": "function", + "name": "quoteTokenAddress", + "inputs": [], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "settledDebt", - "type": "uint256" + "name": "", + "type": "address", + "internalType": "address" } ], - "name": "Settle", - "type": "event" + "stateMutability": "pure" }, { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "bondChange", - "type": "uint256" - }, + "type": "function", + "name": "quoteTokenScale", + "inputs": [], + "outputs": [ { - "indexed": false, - "internalType": "bool", - "name": "isReward", - "type": "bool" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "Take", - "type": "event" + "stateMutability": "pure" }, { - "anonymous": false, + "type": "function", + "name": "removeCollateral", "inputs": [ { - "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" + "name": "maxAmount_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "address", - "name": "newOwner", - "type": "address" - }, + "name": "index_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256[]", - "name": "indexes", - "type": "uint256[]" + "name": "removedAmount_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "lp", - "type": "uint256" + "name": "redeemedLP_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "TransferLP", - "type": "event" + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "removeQuoteToken", "inputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "oldRate", - "type": "uint256" + "name": "maxAmount_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "newRate", - "type": "uint256" + "name": "index_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "UpdateInterestRate", - "type": "event" + "outputs": [ + { + "name": "removedAmount_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "redeemedLP_", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "repayDebt", "inputs": [ { - "internalType": "uint256", - "name": "amountToAdd_", - "type": "uint256" + "name": "borrowerAddress_", + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", - "name": "index_", - "type": "uint256" + "name": "maxQuoteTokenAmountToRepay_", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "expiry_", - "type": "uint256" + "name": "collateralAmountToPull_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "collateralReceiver_", + "type": "address", + "internalType": "address" + }, + { + "name": "limitIndex_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "addCollateral", "outputs": [ { - "internalType": "uint256", - "name": "bucketLP_", - "type": "uint256" + "name": "amountRepaid_", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { - "inputs": [ + "type": "function", + "name": "reservesInfo", + "inputs": [], + "outputs": [ { - "internalType": "uint256", - "name": "amount_", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "index_", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "expiry_", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "bool", - "name": "revertIfBelowLup_", - "type": "bool" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "addQuoteToken", - "outputs": [ + "stateMutability": "view" + }, + { + "type": "function", + "name": "revokeLPAllowance", + "inputs": [ { - "internalType": "uint256", - "name": "bucketLP_", - "type": "uint256" + "name": "spender_", + "type": "address", + "internalType": "address" + }, + { + "name": "indexes_", + "type": "uint256[]", + "internalType": "uint256[]" } ], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "revokeLPTransferors", "inputs": [ { - "internalType": "address[]", "name": "transferors_", - "type": "address[]" + "type": "address[]", + "internalType": "address[]" } ], - "name": "approveLPTransferors", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "settle", "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" + "name": "borrowerAddress_", + "type": "address", + "internalType": "address" }, { - "internalType": "address", - "name": "", - "type": "address" + "name": "maxDepth_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "approvedTransferors", "outputs": [ { - "internalType": "bool", - "name": "", - "type": "bool" + "name": "collateralSettled_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "isBorrowerSettled_", + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "stampLoan", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "take", "inputs": [ { - "internalType": "address", - "name": "borrower_", - "type": "address" - } - ], - "name": "auctionInfo", - "outputs": [ - { - "internalType": "address", - "name": "kicker_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "bondFactor_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bondSize_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "kickTime_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "referencePrice_", - "type": "uint256" + "name": "borrowerAddress_", + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", - "name": "neutralPrice_", - "type": "uint256" + "name": "maxAmount_", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "address", - "name": "head_", - "type": "address" + "name": "callee_", + "type": "address", + "internalType": "address" }, { - "internalType": "address", - "name": "next_", - "type": "address" - }, + "name": "data_", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ { - "internalType": "address", - "name": "prev_", - "type": "address" + "name": "collateralTaken_", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "takeReserves", "inputs": [ { - "internalType": "address", - "name": "borrower_", - "type": "address" + "name": "maxAmount_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "borrowerInfo", "outputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "amount_", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "nonpayable" }, { - "inputs": [ - { - "internalType": "uint256", - "name": "bucketIndex_", - "type": "uint256" - } - ], - "name": "bucketCollateralDust", + "type": "function", + "name": "totalAuctionsInPool", + "inputs": [], "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "pure", - "type": "function" + "stateMutability": "view" }, { - "inputs": [ - { - "internalType": "uint256", - "name": "index_", - "type": "uint256" - } - ], - "name": "bucketExchangeRate", + "type": "function", + "name": "totalT0Debt", + "inputs": [], "outputs": [ { - "internalType": "uint256", - "name": "exchangeRate_", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [ - { - "internalType": "uint256", - "name": "index_", - "type": "uint256" - } - ], - "name": "bucketInfo", + "type": "function", + "name": "totalT0DebtInAuction", + "inputs": [], "outputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "transferLP", "inputs": [ { - "internalType": "address", - "name": "borrowerAddress_", - "type": "address" + "name": "owner_", + "type": "address", + "internalType": "address" }, { - "internalType": "bool", - "name": "depositTake_", - "type": "bool" + "name": "newOwner_", + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", - "name": "index_", - "type": "uint256" + "name": "indexes_", + "type": "uint256[]", + "internalType": "uint256[]" } ], - "name": "bucketTake", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "updateInterest", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "withdrawBonds", "inputs": [ { - "internalType": "uint256", - "name": "burnEventEpoch_", - "type": "uint256" - } - ], - "name": "burnInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "recipient_", + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "maxAmount_", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "collateralAddress", "outputs": [ { - "internalType": "address", - "name": "", - "type": "address" + "name": "withdrawnAmount_", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "pure", - "type": "function" + "stateMutability": "nonpayable" }, { - "inputs": [], - "name": "collateralScale", - "outputs": [ + "type": "event", + "name": "AddCollateral", + "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "actor", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "index", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lpAwarded", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "pure", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "currentBurnEpoch", - "outputs": [ + "type": "event", + "name": "AddQuoteToken", + "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "lender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "index", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lpAwarded", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lup", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "debtInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, + "type": "event", + "name": "ApproveLPTransferors", + "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "lender", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "transferors", + "type": "address[]", + "indexed": false, + "internalType": "address[]" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "AuctionNFTSettle", "inputs": [ { - "internalType": "address", - "name": "spender_", - "type": "address" + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256[]", - "name": "indexes_", - "type": "uint256[]" + "name": "collateral", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256[]", - "name": "amounts_", - "type": "uint256[]" + "name": "lp", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "index", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "name": "decreaseLPAllowance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "AuctionSettle", "inputs": [ { - "internalType": "uint256", - "name": "debt_", - "type": "uint256" - } - ], - "name": "depositIndex", - "outputs": [ + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "collateral", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "BondWithdrawn", "inputs": [ { - "internalType": "uint256", - "name": "index_", - "type": "uint256" - } - ], - "name": "depositScale", - "outputs": [ + "name": "kicker", + "type": "address", + "indexed": true, + "internalType": "address" + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "reciever", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "depositSize", - "outputs": [ + "type": "event", + "name": "BucketBankruptcy", + "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "index", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "lpForfeited", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "BucketTake", "inputs": [ { - "internalType": "uint256", - "name": "index_", - "type": "uint256" - } - ], - "name": "depositUpToIndex", - "outputs": [ + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "index", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "collateral", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "bondChange", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "isReward", + "type": "bool", + "indexed": false, + "internalType": "bool" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "depositUtilization", - "outputs": [ + "type": "event", + "name": "BucketTakeLPAwarded", + "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "taker", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "kicker", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "lpAwardedTaker", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lpAwardedKicker", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "DecreaseLPAllowance", "inputs": [ { - "internalType": "address", - "name": "borrowerAddress_", - "type": "address" + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "amountToBorrow_", - "type": "uint256" + "name": "spender", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "limitIndex_", - "type": "uint256" + "name": "indexes", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" }, { - "internalType": "uint256", - "name": "collateralToPledge_", - "type": "uint256" + "name": "amounts", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" } ], - "name": "drawDebt", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "emasInfo", - "outputs": [ + "type": "event", + "name": "DrawDebt", + "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "amountBorrowed", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "collateralPledged", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "lup", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "Flashloan", "inputs": [ { - "internalType": "address", - "name": "token_", - "type": "address" + "name": "receiver", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "flashFee", - "outputs": [ + "name": "token", + "type": "address", + "indexed": true, + "internalType": "address" + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "IncreaseLPAllowance", "inputs": [ { - "internalType": "contract IERC3156FlashBorrower", - "name": "receiver_", - "type": "address" + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "address", - "name": "token_", - "type": "address" + "name": "spender", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "amount_", - "type": "uint256" + "name": "indexes", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" }, { - "internalType": "bytes", - "name": "data_", - "type": "bytes" - } - ], - "name": "flashLoan", - "outputs": [ - { - "internalType": "bool", - "name": "success_", - "type": "bool" + "name": "amounts", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" } ], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false + }, + { + "type": "event", + "name": "InterestUpdateFailure", + "inputs": [], + "anonymous": false }, { + "type": "event", + "name": "Kick", "inputs": [ { - "internalType": "address", - "name": "spender_", - "type": "address" + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256[]", - "name": "indexes_", - "type": "uint256[]" + "name": "debt", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256[]", - "name": "amounts_", - "type": "uint256[]" + "name": "collateral", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "bond", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "name": "increaseLPAllowance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "inflatorInfo", - "outputs": [ + "type": "event", + "name": "KickReserveAuction", + "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "claimableReservesRemaining", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "auctionPrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "currentBurnEpoch", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "LoanStamped", "inputs": [ { - "internalType": "uint256", - "name": "rate_", - "type": "uint256" + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" } ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "interestRateInfo", - "outputs": [ + "type": "event", + "name": "MoveQuoteToken", + "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "lender", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "from", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "to", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lpRedeemedFrom", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lpAwardedTo", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lup", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "RemoveCollateral", "inputs": [ { - "internalType": "address", - "name": "borrower_", - "type": "address" + "name": "claimer", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "npLimitIndex_", - "type": "uint256" + "name": "index", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lpRedeemed", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "name": "kick", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "kickReserveAuction", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "RemoveQuoteToken", "inputs": [ { - "internalType": "address", - "name": "kicker_", - "type": "address" - } - ], - "name": "kickerInfo", - "outputs": [ + "name": "lender", + "type": "address", + "indexed": true, + "internalType": "address" + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "index", + "type": "uint256", + "indexed": true, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lpRedeemed", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lup", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "RepayDebt", "inputs": [ { - "internalType": "uint256", - "name": "index_", - "type": "uint256" + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "address", - "name": "lender_", - "type": "address" - } - ], - "name": "lenderInfo", - "outputs": [ + "name": "quoteRepaid", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, { - "internalType": "uint256", - "name": "lpBalance_", - "type": "uint256" + "name": "collateralPulled", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "depositTime_", - "type": "uint256" + "name": "lup", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "ReserveAuction", "inputs": [ { - "internalType": "uint256", - "name": "index_", - "type": "uint256" + "name": "claimableReservesRemaining", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "npLimitIndex_", - "type": "uint256" + "name": "auctionPrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "currentBurnEpoch", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "name": "lenderKick", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "ResetInterestRate", "inputs": [ { - "internalType": "uint256", - "name": "loanId_", - "type": "uint256" - } - ], - "name": "loanInfo", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" + "name": "oldRate", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "newRate", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "loansInfo", - "outputs": [ + "type": "event", + "name": "RevokeLPAllowance", + "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "spender", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "indexes", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "RevokeLPTransferors", "inputs": [ { - "internalType": "uint256", - "name": "index_", - "type": "uint256" - }, - { - "internalType": "address", - "name": "spender_", - "type": "address" + "name": "lender", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "name": "lpAllowance", - "outputs": [ - { - "internalType": "uint256", - "name": "allowance_", - "type": "uint256" + "name": "transferors", + "type": "address[]", + "indexed": false, + "internalType": "address[]" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "Settle", "inputs": [ { - "internalType": "address", - "name": "token_", - "type": "address" - } - ], - "name": "maxFlashLoan", - "outputs": [ + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" + }, { - "internalType": "uint256", - "name": "maxLoan_", - "type": "uint256" + "name": "settledDebt", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "Take", "inputs": [ { - "internalType": "uint256", - "name": "maxAmount_", - "type": "uint256" + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "fromIndex_", - "type": "uint256" + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "toIndex_", - "type": "uint256" + "name": "collateral", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "expiry_", - "type": "uint256" + "name": "bondChange", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "bool", - "name": "revertIfBelowLup_", - "type": "bool" + "name": "isReward", + "type": "bool", + "indexed": false, + "internalType": "bool" } ], - "name": "moveQuoteToken", - "outputs": [ + "anonymous": false + }, + { + "type": "event", + "name": "TransferLP", + "inputs": [ { - "internalType": "uint256", - "name": "fromBucketLP_", - "type": "uint256" + "name": "owner", + "type": "address", + "indexed": false, + "internalType": "address" }, { - "internalType": "uint256", - "name": "toBucketLP_", - "type": "uint256" + "name": "newOwner", + "type": "address", + "indexed": false, + "internalType": "address" }, { - "internalType": "uint256", - "name": "movedAmount_", - "type": "uint256" + "name": "indexes", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" + }, + { + "name": "lp", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "UpdateInterestRate", + "inputs": [ + { + "name": "oldRate", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "newRate", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false + }, + { + "type": "error", + "name": "AddAboveAuctionPrice", + "inputs": [] + }, + { + "type": "error", + "name": "AddAboveAuctionPrice", + "inputs": [] + }, + { + "type": "error", + "name": "AlreadyInitialized", + "inputs": [] + }, + { + "type": "error", + "name": "AmountLTMinDebt", + "inputs": [] + }, + { + "type": "error", + "name": "AuctionActive", + "inputs": [] + }, + { + "type": "error", + "name": "AuctionActive", + "inputs": [] + }, + { + "type": "error", + "name": "AuctionNotClearable", + "inputs": [] + }, + { + "type": "error", + "name": "AuctionNotCleared", + "inputs": [] + }, + { + "type": "error", + "name": "AuctionNotCleared", + "inputs": [] + }, + { + "type": "error", + "name": "AuctionNotTakeable", + "inputs": [] + }, + { + "type": "error", + "name": "AuctionPriceGtBucketPrice", + "inputs": [] + }, + { + "type": "error", + "name": "BorrowerNotSender", + "inputs": [] + }, + { + "type": "error", + "name": "BorrowerOk", + "inputs": [] + }, + { + "type": "error", + "name": "BorrowerUnderCollateralized", + "inputs": [] + }, + { + "type": "error", + "name": "BucketBankruptcyBlock", + "inputs": [] + }, + { + "type": "error", + "name": "BucketIndexOutOfBounds", + "inputs": [] + }, + { + "type": "error", + "name": "CannotMergeToHigherPrice", + "inputs": [] + }, + { + "type": "error", + "name": "DustAmountNotExceeded", + "inputs": [] + }, + { + "type": "error", + "name": "FlashloanCallbackFailed", + "inputs": [] + }, + { + "type": "error", + "name": "FlashloanIncorrectBalance", + "inputs": [] + }, + { + "type": "error", + "name": "FlashloanUnavailableForToken", + "inputs": [] + }, + { + "type": "error", + "name": "InsufficientCollateral", + "inputs": [] + }, + { + "type": "error", + "name": "InsufficientLP", + "inputs": [] + }, + { + "type": "error", + "name": "InsufficientLiquidity", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidAllowancesInput", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidAmount", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidIndex", + "inputs": [] }, { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" + "type": "error", + "name": "LUPBelowHTP", + "inputs": [] }, { - "inputs": [], - "name": "pledgedCollateral", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" + "type": "error", + "name": "LimitIndexExceeded", + "inputs": [] }, { - "inputs": [], - "name": "poolType", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "pure", - "type": "function" + "type": "error", + "name": "MoveToSameIndex", + "inputs": [] }, { - "inputs": [], - "name": "quoteTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "pure", - "type": "function" + "type": "error", + "name": "NoAllowance", + "inputs": [] }, { - "inputs": [], - "name": "quoteTokenScale", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" + "type": "error", + "name": "NoAuction", + "inputs": [] + }, + { + "type": "error", + "name": "NoClaim", + "inputs": [] + }, + { + "type": "error", + "name": "NoDebt", + "inputs": [] + }, + { + "type": "error", + "name": "NoReserves", + "inputs": [] + }, + { + "type": "error", + "name": "NoReservesAuction", + "inputs": [] + }, + { + "type": "error", + "name": "PRBMathSD59x18__DivInputTooSmall", + "inputs": [] }, { + "type": "error", + "name": "PRBMathSD59x18__DivOverflow", "inputs": [ { - "internalType": "uint256", - "name": "maxAmount_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "index_", - "type": "uint256" + "name": "rAbs", + "type": "uint256", + "internalType": "uint256" } - ], - "name": "removeCollateral", - "outputs": [ - { - "internalType": "uint256", - "name": "removedAmount_", - "type": "uint256" - }, + ] + }, + { + "type": "error", + "name": "PRBMathSD59x18__Exp2InputTooBig", + "inputs": [ { - "internalType": "uint256", - "name": "redeemedLP_", - "type": "uint256" + "name": "x", + "type": "int256", + "internalType": "int256" } - ], - "stateMutability": "nonpayable", - "type": "function" + ] }, { + "type": "error", + "name": "PRBMathSD59x18__FromIntOverflow", "inputs": [ { - "internalType": "uint256", - "name": "maxAmount_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "index_", - "type": "uint256" + "name": "x", + "type": "int256", + "internalType": "int256" } - ], - "name": "removeQuoteToken", - "outputs": [ - { - "internalType": "uint256", - "name": "removedAmount_", - "type": "uint256" - }, + ] + }, + { + "type": "error", + "name": "PRBMathSD59x18__FromIntUnderflow", + "inputs": [ { - "internalType": "uint256", - "name": "redeemedLP_", - "type": "uint256" + "name": "x", + "type": "int256", + "internalType": "int256" } - ], - "stateMutability": "nonpayable", - "type": "function" + ] }, { + "type": "error", + "name": "PRBMathSD59x18__LogInputTooSmall", "inputs": [ { - "internalType": "address", - "name": "borrowerAddress_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "maxQuoteTokenAmountToRepay_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateralAmountToPull_", - "type": "uint256" - }, - { - "internalType": "address", - "name": "collateralReceiver_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "limitIndex_", - "type": "uint256" + "name": "x", + "type": "int256", + "internalType": "int256" } - ], - "name": "repayDebt", - "outputs": [ + ] + }, + { + "type": "error", + "name": "PRBMathSD59x18__MulInputTooSmall", + "inputs": [] + }, + { + "type": "error", + "name": "PRBMathSD59x18__MulOverflow", + "inputs": [ { - "internalType": "uint256", - "name": "amountRepaid_", - "type": "uint256" + "name": "rAbs", + "type": "uint256", + "internalType": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" + ] }, { - "inputs": [], - "name": "reservesInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, + "type": "error", + "name": "PRBMathSD59x18__SqrtNegativeInput", + "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "x", + "type": "int256", + "internalType": "int256" } - ], - "stateMutability": "view", - "type": "function" + ] }, { + "type": "error", + "name": "PRBMathSD59x18__SqrtOverflow", "inputs": [ { - "internalType": "address", - "name": "spender_", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "indexes_", - "type": "uint256[]" + "name": "x", + "type": "int256", + "internalType": "int256" } - ], - "name": "revokeLPAllowance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + ] }, { + "type": "error", + "name": "PRBMath__MulDivFixedPointOverflow", "inputs": [ { - "internalType": "address[]", - "name": "transferors_", - "type": "address[]" + "name": "prod1", + "type": "uint256", + "internalType": "uint256" } - ], - "name": "revokeLPTransferors", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + ] }, { + "type": "error", + "name": "PRBMath__MulDivOverflow", "inputs": [ { - "internalType": "address", - "name": "borrowerAddress_", - "type": "address" + "name": "prod1", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "maxDepth_", - "type": "uint256" + "name": "denominator", + "type": "uint256", + "internalType": "uint256" } - ], - "name": "settle", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + ] }, { - "inputs": [], - "name": "stampLoan", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "type": "error", + "name": "PriceBelowLUP", + "inputs": [] }, { - "inputs": [ - { - "internalType": "address", - "name": "borrowerAddress_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "maxAmount_", - "type": "uint256" - }, - { - "internalType": "address", - "name": "callee_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data_", - "type": "bytes" - } - ], - "name": "take", - "outputs": [ - { - "internalType": "uint256", - "name": "collateralTaken_", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" + "type": "error", + "name": "RemoveDepositLockedByAuctionDebt", + "inputs": [] }, { - "inputs": [ - { - "internalType": "uint256", - "name": "maxAmount_", - "type": "uint256" - } - ], - "name": "takeReserves", - "outputs": [ - { - "internalType": "uint256", - "name": "amount_", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" + "type": "error", + "name": "RemoveDepositLockedByAuctionDebt", + "inputs": [] }, { - "inputs": [], - "name": "totalAuctionsInPool", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" + "type": "error", + "name": "ReserveAuctionTooSoon", + "inputs": [] }, { - "inputs": [], - "name": "totalT0Debt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" + "type": "error", + "name": "TransactionExpired", + "inputs": [] }, { - "inputs": [], - "name": "totalT0DebtInAuction", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" + "type": "error", + "name": "TransactionExpired", + "inputs": [] }, { - "inputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - }, - { - "internalType": "address", - "name": "newOwner_", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "indexes_", - "type": "uint256[]" - } - ], - "name": "transferLP", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "type": "error", + "name": "TransferToSameOwner", + "inputs": [] }, { - "inputs": [], - "name": "updateInterest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "type": "error", + "name": "TransferorNotApproved", + "inputs": [] }, { - "inputs": [ - { - "internalType": "address", - "name": "recipient_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "maxAmount_", - "type": "uint256" - } - ], - "name": "withdrawBonds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "type": "error", + "name": "ZeroDebtToCollateral", + "inputs": [] } ] diff --git a/abis/ERC20PoolFactory.json b/abis/ERC20PoolFactory.json index a4032d0..6958753 100644 --- a/abis/ERC20PoolFactory.json +++ b/abis/ERC20PoolFactory.json @@ -1,230 +1,236 @@ [ { + "type": "constructor", "inputs": [ { - "internalType": "address", "name": "ajna_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "nonpayable", - "type": "constructor" + "stateMutability": "nonpayable" }, { - "inputs": [], - "name": "CreateFail", - "type": "error" - }, - { - "inputs": [], - "name": "DecimalsNotCompliant", - "type": "error" - }, - { - "inputs": [], - "name": "DeployQuoteCollateralSameToken", - "type": "error" - }, - { - "inputs": [], - "name": "DeployWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "pool_", - "type": "address" - } - ], - "name": "PoolAlreadyExists", - "type": "error" - }, - { - "inputs": [], - "name": "PoolInterestRateInvalid", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "pool_", - "type": "address" - } - ], - "name": "PoolCreated", - "type": "event" - }, - { - "inputs": [], + "type": "function", "name": "ERC20_NON_SUBSET_HASH", + "inputs": [], "outputs": [ { - "internalType": "bytes32", "name": "", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "MAX_RATE", + "inputs": [], "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "MIN_RATE", + "inputs": [], "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "ajna", + "inputs": [], "outputs": [ { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "deployPool", "inputs": [ { - "internalType": "address", "name": "collateral_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "quote_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "interestRate_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "deployPool", "outputs": [ { - "internalType": "address", "name": "pool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "deployedPools", "inputs": [ { - "internalType": "bytes32", "name": "", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" }, { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "deployedPools", "outputs": [ { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "deployedPoolsList", "inputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "deployedPoolsList", "outputs": [ { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "getDeployedPoolsList", + "inputs": [], "outputs": [ { - "internalType": "address[]", "name": "", - "type": "address[]" + "type": "address[]", + "internalType": "address[]" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "getNumberOfDeployedPools", + "inputs": [], "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "implementation", + "inputs": [], "outputs": [ { - "internalType": "contract ERC20Pool", "name": "", - "type": "address" + "type": "address", + "internalType": "contract ERC20Pool" + } + ], + "stateMutability": "view" + }, + { + "type": "event", + "name": "PoolCreated", + "inputs": [ + { + "name": "pool_", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "subsetHash_", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false + }, + { + "type": "error", + "name": "CreateFail", + "inputs": [] + }, + { + "type": "error", + "name": "DecimalsNotCompliant", + "inputs": [] + }, + { + "type": "error", + "name": "DeployQuoteCollateralSameToken", + "inputs": [] + }, + { + "type": "error", + "name": "DeployWithZeroAddress", + "inputs": [] + }, + { + "type": "error", + "name": "PoolAlreadyExists", + "inputs": [ + { + "name": "pool_", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "PoolInterestRateInvalid", + "inputs": [] } ] diff --git a/abis/ERC721.json b/abis/ERC721.json index 616eeb5..152eb74 100644 --- a/abis/ERC721.json +++ b/abis/ERC721.json @@ -1,208 +1,348 @@ [ { + "type": "constructor", "inputs": [ - { "internalType": "string", "name": "name_", "type": "string" }, - { "internalType": "string", "name": "symbol_", "type": "string" } + { + "name": "name_", + "type": "string", + "internalType": "string" + }, + { + "name": "symbol_", + "type": "string", + "internalType": "string" + } ], - "stateMutability": "nonpayable", - "type": "constructor" + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "approve", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" + "name": "to", + "type": "address", + "internalType": "address" }, { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "balanceOf", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getApproved", + "inputs": [ { - "indexed": true, - "internalType": "uint256", "name": "tokenId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" } ], - "name": "ERC721Approval", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "isApprovedForAll", "inputs": [ { - "indexed": true, - "internalType": "address", "name": "owner", - "type": "address" + "type": "address", + "internalType": "address" }, { - "indexed": true, - "internalType": "address", "name": "operator", - "type": "address" - }, + "type": "address", + "internalType": "address" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" + "name": "", + "type": "bool", + "internalType": "bool" } ], - "name": "ERC721ApprovalForAll", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "name", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "ownerOf", + "inputs": [ + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "safeTransferFrom", "inputs": [ { - "indexed": true, - "internalType": "address", "name": "from", - "type": "address" + "type": "address", + "internalType": "address" }, { - "indexed": true, - "internalType": "address", "name": "to", - "type": "address" + "type": "address", + "internalType": "address" }, { - "indexed": true, - "internalType": "uint256", "name": "tokenId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "ERC721Transfer", - "type": "event" + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "safeTransferFrom", "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + { + "name": "from", + "type": "address", + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } ], - "name": "approve", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "setApprovalForAll", "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" } + { + "name": "operator", + "type": "address", + "internalType": "address" + }, + { + "name": "approved", + "type": "bool", + "internalType": "bool" + } ], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "supportsInterface", "inputs": [ - { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + { + "name": "interfaceId", + "type": "bytes4", + "internalType": "bytes4" + } ], - "name": "getApproved", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "operator", "type": "address" } + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } ], - "name": "isApprovedForAll", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "symbol", "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } ], - "name": "ownerOf", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "tokenURI", "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + } ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "transferFrom", "inputs": [ - { "internalType": "address", "name": "operator", "type": "address" }, - { "internalType": "bool", "name": "approved", "type": "bool" } + { + "name": "from", + "type": "address", + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + } ], - "name": "setApprovalForAll", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "event", + "name": "Approval", "inputs": [ - { "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" } + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "approved", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } ], - "name": "supportsInterface", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "ApprovalForAll", "inputs": [ - { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "operator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "approved", + "type": "bool", + "indexed": false, + "internalType": "bool" + } ], - "name": "tokenURI", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "Transfer", "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + { + "name": "from", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false } ] diff --git a/abis/ERC721Pool.json b/abis/ERC721Pool.json index 34ae7d6..27f244e 100644 --- a/abis/ERC721Pool.json +++ b/abis/ERC721Pool.json @@ -1,2534 +1,2562 @@ [ { - "inputs": [], - "name": "AllowanceAlreadySet", - "type": "error" - }, - { - "inputs": [], - "name": "AlreadyInitialized", - "type": "error" - }, - { - "inputs": [], - "name": "AmountLTMinDebt", - "type": "error" - }, - { - "inputs": [], - "name": "AuctionActive", - "type": "error" - }, - { - "inputs": [], - "name": "AuctionNotClearable", - "type": "error" - }, - { - "inputs": [], - "name": "AuctionNotCleared", - "type": "error" - }, - { - "inputs": [], - "name": "AuctionNotCleared", - "type": "error" - }, - { - "inputs": [], - "name": "AuctionNotTakeable", - "type": "error" - }, - { - "inputs": [], - "name": "AuctionPriceGtBucketPrice", - "type": "error" - }, - { - "inputs": [], - "name": "BorrowerNotSender", - "type": "error" - }, - { - "inputs": [], - "name": "BorrowerOk", - "type": "error" - }, - { - "inputs": [], - "name": "BorrowerUnderCollateralized", - "type": "error" - }, - { - "inputs": [], - "name": "BucketBankruptcyBlock", - "type": "error" - }, - { - "inputs": [], - "name": "BucketIndexOutOfBounds", - "type": "error" - }, - { - "inputs": [], - "name": "CannotMergeToHigherPrice", - "type": "error" - }, - { - "inputs": [], - "name": "DustAmountNotExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "FlashloanCallbackFailed", - "type": "error" - }, - { - "inputs": [], - "name": "FlashloanIncorrectBalance", - "type": "error" - }, - { - "inputs": [], - "name": "FlashloanUnavailableForToken", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientCollateral", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientLP", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientLiquidity", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidAllowancesInput", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidAmount", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidIndex", - "type": "error" - }, - { - "inputs": [], - "name": "LUPBelowHTP", - "type": "error" - }, - { - "inputs": [], - "name": "LUPGreaterThanTP", - "type": "error" - }, - { - "inputs": [], - "name": "LimitIndexExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "MoveToSameIndex", - "type": "error" - }, - { - "inputs": [], - "name": "NoAllowance", - "type": "error" - }, - { - "inputs": [], - "name": "NoAuction", - "type": "error" - }, - { - "inputs": [], - "name": "NoClaim", - "type": "error" - }, - { - "inputs": [], - "name": "NoDebt", - "type": "error" + "type": "function", + "name": "addCollateral", + "inputs": [ + { + "name": "tokenIds_", + "type": "uint256[]", + "internalType": "uint256[]" + }, + { + "name": "index_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "expiry_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "bucketLP_", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" }, { - "inputs": [], - "name": "NoReserves", - "type": "error" + "type": "function", + "name": "addQuoteToken", + "inputs": [ + { + "name": "amount_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "index_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "expiry_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "bucketLP_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "addedAmount_", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" }, { - "inputs": [], - "name": "NoReservesAuction", - "type": "error" + "type": "function", + "name": "approveLPTransferors", + "inputs": [ + { + "name": "transferors_", + "type": "address[]", + "internalType": "address[]" + } + ], + "outputs": [], + "stateMutability": "nonpayable" }, { - "inputs": [], - "name": "OnlySubset", - "type": "error" + "type": "function", + "name": "approvedTransferors", + "inputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "auctionInfo", "inputs": [ { - "internalType": "int256", - "name": "x", - "type": "int256" + "name": "borrower_", + "type": "address", + "internalType": "address" } ], - "name": "PRBMathSD59x18__Exp2InputTooBig", - "type": "error" + "outputs": [ + { + "name": "kicker_", + "type": "address", + "internalType": "address" + }, + { + "name": "bondFactor_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "bondSize_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "kickTime_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "referencePrice_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "neutralPrice_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "debtToCollateral_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "head_", + "type": "address", + "internalType": "address" + }, + { + "name": "next_", + "type": "address", + "internalType": "address" + }, + { + "name": "prev_", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "borrowerInfo", "inputs": [ { - "internalType": "int256", - "name": "x", - "type": "int256" + "name": "borrower_", + "type": "address", + "internalType": "address" } ], - "name": "PRBMathSD59x18__FromIntOverflow", - "type": "error" + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "borrowerTokenIds", "inputs": [ { - "internalType": "int256", - "name": "x", - "type": "int256" + "name": "", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "PRBMathSD59x18__FromIntUnderflow", - "type": "error" + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "bucketExchangeRate", "inputs": [ { - "internalType": "int256", - "name": "x", - "type": "int256" + "name": "index_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "PRBMathSD59x18__LogInputTooSmall", - "type": "error" + "outputs": [ + { + "name": "exchangeRate_", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { - "inputs": [], - "name": "PRBMathSD59x18__MulInputTooSmall", - "type": "error" + "type": "function", + "name": "bucketInfo", + "inputs": [ + { + "name": "index_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "bucketTake", "inputs": [ { - "internalType": "uint256", - "name": "rAbs", - "type": "uint256" + "name": "borrowerAddress_", + "type": "address", + "internalType": "address" + }, + { + "name": "depositTake_", + "type": "bool", + "internalType": "bool" + }, + { + "name": "index_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "PRBMathSD59x18__MulOverflow", - "type": "error" + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "bucketTokenIds", "inputs": [ { - "internalType": "uint256", - "name": "prod1", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "PRBMath__MulDivFixedPointOverflow", - "type": "error" + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { - "inputs": [], - "name": "PoolUnderCollateralized", - "type": "error" + "type": "function", + "name": "burnInfo", + "inputs": [ + { + "name": "burnEventEpoch_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "collateralAddress", "inputs": [], - "name": "PriceBelowLUP", - "type": "error" + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "pure" }, { + "type": "function", + "name": "currentBurnEpoch", "inputs": [], - "name": "RemoveDepositLockedByAuctionDebt", - "type": "error" + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "debtInfo", "inputs": [], - "name": "RemoveDepositLockedByAuctionDebt", - "type": "error" + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { - "inputs": [], - "name": "ReserveAuctionTooSoon", - "type": "error" + "type": "function", + "name": "decreaseLPAllowance", + "inputs": [ + { + "name": "spender_", + "type": "address", + "internalType": "address" + }, + { + "name": "indexes_", + "type": "uint256[]", + "internalType": "uint256[]" + }, + { + "name": "amounts_", + "type": "uint256[]", + "internalType": "uint256[]" + } + ], + "outputs": [], + "stateMutability": "nonpayable" }, { - "inputs": [], - "name": "TransactionExpired", - "type": "error" + "type": "function", + "name": "depositIndex", + "inputs": [ + { + "name": "debt_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { - "inputs": [], - "name": "TransactionExpired", - "type": "error" + "type": "function", + "name": "depositScale", + "inputs": [ + { + "name": "index_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "depositSize", "inputs": [], - "name": "TransferToSameOwner", - "type": "error" + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { - "inputs": [], - "name": "TransferorNotApproved", - "type": "error" + "type": "function", + "name": "depositUpToIndex", + "inputs": [ + { + "name": "index_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "depositUtilization", "inputs": [], - "name": "ZeroThresholdPrice", - "type": "error" + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "drawDebt", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "actor", - "type": "address" + "name": "borrowerAddress_", + "type": "address", + "internalType": "address" }, { - "indexed": true, - "internalType": "uint256", - "name": "index", - "type": "uint256" + "name": "amountToBorrow_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256[]", - "name": "tokenIds", - "type": "uint256[]" + "name": "limitIndex_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "lpAwarded", - "type": "uint256" + "name": "tokenIdsToPledge_", + "type": "uint256[]", + "internalType": "uint256[]" } ], - "name": "AddCollateralNFT", - "type": "event" + "outputs": [], + "stateMutability": "nonpayable" }, { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, + "type": "function", + "name": "emasInfo", + "inputs": [], + "outputs": [ { - "indexed": true, - "internalType": "uint256", - "name": "index", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "lpAwarded", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "lup", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "AddQuoteToken", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "flashFee", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" + "name": "token_", + "type": "address", + "internalType": "address" }, { - "indexed": false, - "internalType": "address[]", - "name": "transferors", - "type": "address[]" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "ApproveLPTransferors", - "type": "event" + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "flashLoan", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" + "name": "receiver_", + "type": "address", + "internalType": "contract IERC3156FlashBorrower" }, { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" + "name": "token_", + "type": "address", + "internalType": "address" }, { - "indexed": false, - "internalType": "uint256", - "name": "lp", - "type": "uint256" + "name": "amount_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "index", - "type": "uint256" + "name": "data_", + "type": "bytes", + "internalType": "bytes" } ], - "name": "AuctionNFTSettle", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" - }, + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" + "name": "", + "type": "bool", + "internalType": "bool" } ], - "name": "AuctionSettle", - "type": "event" + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "getBorrowerTokenIds", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "kicker", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "reciever", - "type": "address" - }, + "name": "borrower_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "name": "", + "type": "uint256[]", + "internalType": "uint256[]" } ], - "name": "BondWithdrawn", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, + "type": "function", + "name": "getBucketTokenIds", + "inputs": [], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "lpForfeited", - "type": "uint256" + "name": "", + "type": "uint256[]", + "internalType": "uint256[]" } ], - "name": "BucketBankruptcy", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "increaseLPAllowance", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" + "name": "spender_", + "type": "address", + "internalType": "address" }, { - "indexed": false, - "internalType": "uint256", - "name": "bondChange", - "type": "uint256" + "name": "indexes_", + "type": "uint256[]", + "internalType": "uint256[]" }, { - "indexed": false, - "internalType": "bool", - "name": "isReward", - "type": "bool" + "name": "amounts_", + "type": "uint256[]", + "internalType": "uint256[]" } ], - "name": "BucketTake", - "type": "event" + "outputs": [], + "stateMutability": "nonpayable" }, { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "taker", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "kicker", - "type": "address" - }, + "type": "function", + "name": "inflatorInfo", + "inputs": [], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "lpAwardedTaker", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "lpAwardedKicker", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "BucketTakeLPAwarded", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "initialize", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "indexes", - "type": "uint256[]" + "name": "tokenIds_", + "type": "uint256[]", + "internalType": "uint256[]" }, { - "indexed": false, - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" + "name": "rate_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "DecreaseLPAllowance", - "type": "event" + "outputs": [], + "stateMutability": "nonpayable" }, { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" - }, + "type": "function", + "name": "interestRateInfo", + "inputs": [], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "amountBorrowed", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256[]", - "name": "tokenIdsPledged", - "type": "uint256[]" - }, + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isSubset", + "inputs": [], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "lup", - "type": "uint256" + "name": "", + "type": "bool", + "internalType": "bool" } ], - "name": "DrawDebtNFT", - "type": "event" + "stateMutability": "pure" }, { - "anonymous": false, + "type": "function", + "name": "kick", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "token", - "type": "address" + "name": "borrower_", + "type": "address", + "internalType": "address" }, { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "name": "npLimitIndex_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "Flashloan", - "type": "event" + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "kickReserveAuction", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "kickerInfo", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, + "name": "kicker_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256[]", - "name": "indexes", - "type": "uint256[]" + "name": "", + "type": "uint256", + "internalType": "uint256" }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" + { + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "IncreaseLPAllowance", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "lenderInfo", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" + "name": "index_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "debt", - "type": "uint256" - }, + "name": "lender_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" + "name": "lpBalance_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "bond", - "type": "uint256" + "name": "depositTime_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "Kick", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "lenderKick", "inputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "claimableReservesRemaining", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "auctionPrice", - "type": "uint256" + "name": "index_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "currentBurnEpoch", - "type": "uint256" + "name": "npLimitIndex_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "KickReserveAuction", - "type": "event" + "outputs": [], + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "loanInfo", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" + "name": "loanId_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "LoanStamped", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "actor", - "type": "address" - }, + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "collateralMerged", - "type": "uint256" + "name": "", + "type": "address", + "internalType": "address" }, { - "indexed": false, - "internalType": "uint256", - "name": "toIndexLps", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "MergeOrRemoveCollateralNFT", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, - "inputs": [ + "type": "function", + "name": "loansInfo", + "inputs": [], + "outputs": [ { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" + "name": "", + "type": "address", + "internalType": "address" }, { - "indexed": true, - "internalType": "uint256", - "name": "from", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": true, - "internalType": "uint256", - "name": "to", - "type": "uint256" - }, + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "lpAllowance", + "inputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "name": "index_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "lpRedeemedFrom", - "type": "uint256" + "name": "spender_", + "type": "address", + "internalType": "address" }, { - "indexed": false, - "internalType": "uint256", - "name": "lpAwardedTo", - "type": "uint256" - }, + "name": "owner_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "lup", - "type": "uint256" + "name": "allowance_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "MoveQuoteToken", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "maxFlashLoan", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "claimer", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, + "name": "token_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "lpRedeemed", - "type": "uint256" + "name": "maxLoan_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "RemoveCollateral", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "mergeOrRemoveCollateral", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" + "name": "removalIndexes_", + "type": "uint256[]", + "internalType": "uint256[]" }, { - "indexed": true, - "internalType": "uint256", - "name": "index", - "type": "uint256" + "name": "noOfNFTsToRemove_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, + "name": "toIndex_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "lpRedeemed", - "type": "uint256" + "name": "collateralMerged_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "lup", - "type": "uint256" + "name": "bucketLP_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "RemoveQuoteToken", - "type": "event" + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "moveQuoteToken", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" + "name": "maxAmount_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "quoteRepaid", - "type": "uint256" + "name": "fromIndex_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "collateralPulled", - "type": "uint256" + "name": "toIndex_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "lup", - "type": "uint256" + "name": "expiry_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "RepayDebt", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "claimableReservesRemaining", - "type": "uint256" + "name": "fromBucketLP_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "auctionPrice", - "type": "uint256" + "name": "toBucketLP_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "currentBurnEpoch", - "type": "uint256" + "name": "movedAmount_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "ReserveAuction", - "type": "event" + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "multicall", "inputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "oldRate", - "type": "uint256" - }, + "name": "data", + "type": "bytes[]", + "internalType": "bytes[]" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "newRate", - "type": "uint256" + "name": "results", + "type": "bytes[]", + "internalType": "bytes[]" } ], - "name": "ResetInterestRate", - "type": "event" + "stateMutability": "nonpayable" }, { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, + "type": "function", + "name": "pledgedCollateral", + "inputs": [], + "outputs": [ { - "indexed": false, - "internalType": "uint256[]", - "name": "indexes", - "type": "uint256[]" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "RevokeLPAllowance", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, + "type": "function", + "name": "poolType", + "inputs": [], + "outputs": [ { - "indexed": false, - "internalType": "address[]", - "name": "transferors", - "type": "address[]" + "name": "", + "type": "uint8", + "internalType": "uint8" } ], - "name": "RevokeLPTransferors", - "type": "event" + "stateMutability": "pure" }, { - "anonymous": false, - "inputs": [ + "type": "function", + "name": "quoteTokenAddress", + "inputs": [], + "outputs": [ { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" - }, + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "quoteTokenScale", + "inputs": [], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "settledDebt", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "Settle", - "type": "event" + "stateMutability": "pure" }, { - "anonymous": false, + "type": "function", + "name": "removeCollateral", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "name": "noOfNFTsToRemove_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, + "name": "index_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "bondChange", - "type": "uint256" + "name": "removedAmount_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "bool", - "name": "isReward", - "type": "bool" + "name": "redeemedLP_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "Take", - "type": "event" + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "removeQuoteToken", "inputs": [ { - "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "indexes", - "type": "uint256[]" + "name": "maxAmount_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "lp", - "type": "uint256" + "name": "index_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "TransferLP", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "oldRate", - "type": "uint256" + "name": "removedAmount_", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "newRate", - "type": "uint256" + "name": "redeemedLP_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "UpdateInterestRate", - "type": "event" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "repayDebt", "inputs": [ { - "internalType": "uint256[]", - "name": "tokenIds_", - "type": "uint256[]" + "name": "borrowerAddress_", + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", - "name": "index_", - "type": "uint256" + "name": "maxQuoteTokenAmountToRepay_", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "expiry_", - "type": "uint256" + "name": "noOfNFTsToPull_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "collateralReceiver_", + "type": "address", + "internalType": "address" + }, + { + "name": "limitIndex_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "addCollateral", "outputs": [ { - "internalType": "uint256", - "name": "bucketLP_", - "type": "uint256" + "name": "amountRepaid_", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { - "inputs": [ + "type": "function", + "name": "reservesInfo", + "inputs": [], + "outputs": [ { - "internalType": "uint256", - "name": "amount_", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "index_", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "expiry_", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "bool", - "name": "revertIfBelowLup_", - "type": "bool" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "addQuoteToken", - "outputs": [ + "stateMutability": "view" + }, + { + "type": "function", + "name": "revokeLPAllowance", + "inputs": [ { - "internalType": "uint256", - "name": "bucketLP_", - "type": "uint256" + "name": "spender_", + "type": "address", + "internalType": "address" + }, + { + "name": "indexes_", + "type": "uint256[]", + "internalType": "uint256[]" } ], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "revokeLPTransferors", "inputs": [ { - "internalType": "address[]", "name": "transferors_", - "type": "address[]" + "type": "address[]", + "internalType": "address[]" } ], - "name": "approveLPTransferors", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "settle", "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" + "name": "borrowerAddress_", + "type": "address", + "internalType": "address" }, { - "internalType": "address", - "name": "", - "type": "address" + "name": "maxDepth_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "approvedTransferors", "outputs": [ { - "internalType": "bool", - "name": "", - "type": "bool" + "name": "collateralSettled_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "isBorrowerSettled_", + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "stampLoan", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "take", "inputs": [ { - "internalType": "address", - "name": "borrower_", - "type": "address" - } - ], - "name": "auctionInfo", - "outputs": [ - { - "internalType": "address", - "name": "kicker_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "bondFactor_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bondSize_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "kickTime_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "referencePrice_", - "type": "uint256" + "name": "borrowerAddress_", + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", - "name": "neutralPrice_", - "type": "uint256" + "name": "collateral_", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "address", - "name": "head_", - "type": "address" + "name": "callee_", + "type": "address", + "internalType": "address" }, { - "internalType": "address", - "name": "next_", - "type": "address" - }, + "name": "data_", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ { - "internalType": "address", - "name": "prev_", - "type": "address" + "name": "collateralTaken_", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "takeReserves", "inputs": [ { - "internalType": "address", - "name": "borrower_", - "type": "address" + "name": "maxAmount_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "borrowerInfo", "outputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "amount_", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "tokenIdsAllowed", "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "tokenId_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "borrowerTokenIds", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [ - { - "internalType": "uint256", - "name": "index_", - "type": "uint256" - } - ], - "name": "bucketExchangeRate", + "type": "function", + "name": "totalAuctionsInPool", + "inputs": [], "outputs": [ { - "internalType": "uint256", - "name": "exchangeRate_", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [ + "type": "function", + "name": "totalT0Debt", + "inputs": [], + "outputs": [ { - "internalType": "uint256", - "name": "index_", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "bucketInfo", + "stateMutability": "view" + }, + { + "type": "function", + "name": "totalT0DebtInAuction", + "inputs": [], "outputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "transferLP", "inputs": [ { - "internalType": "address", - "name": "borrowerAddress_", - "type": "address" + "name": "owner_", + "type": "address", + "internalType": "address" }, { - "internalType": "bool", - "name": "depositTake_", - "type": "bool" + "name": "newOwner_", + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", - "name": "index_", - "type": "uint256" + "name": "indexes_", + "type": "uint256[]", + "internalType": "uint256[]" } ], - "name": "bucketTake", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "updateInterest", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "withdrawBonds", "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "recipient_", + "type": "address", + "internalType": "address" + }, + { + "name": "maxAmount_", + "type": "uint256", + "internalType": "uint256" } ], - "name": "bucketTokenIds", "outputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "withdrawnAmount_", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "event", + "name": "AddCollateralNFT", "inputs": [ { - "internalType": "uint256", - "name": "burnEventEpoch_", - "type": "uint256" - } - ], - "name": "burnInfo", - "outputs": [ + "name": "actor", + "type": "address", + "indexed": true, + "internalType": "address" + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "index", + "type": "uint256", + "indexed": true, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "tokenIds", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "lpAwarded", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "collateralAddress", - "outputs": [ + "type": "event", + "name": "AddQuoteToken", + "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" + "name": "lender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "index", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lpAwarded", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lup", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "pure", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "currentBurnEpoch", - "outputs": [ + "type": "event", + "name": "ApproveLPTransferors", + "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "lender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "transferors", + "type": "address[]", + "indexed": false, + "internalType": "address[]" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "debtInfo", - "outputs": [ + "type": "event", + "name": "AuctionNFTSettle", + "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "collateral", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "lp", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "index", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "AuctionSettle", + "inputs": [ + { + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "collateral", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "BondWithdrawn", "inputs": [ { - "internalType": "address", - "name": "spender_", - "type": "address" + "name": "kicker", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256[]", - "name": "indexes_", - "type": "uint256[]" + "name": "reciever", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256[]", - "name": "amounts_", - "type": "uint256[]" + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "name": "decreaseLPAllowance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "BucketBankruptcy", "inputs": [ { - "internalType": "uint256", - "name": "debt_", - "type": "uint256" - } - ], - "name": "depositIndex", - "outputs": [ + "name": "index", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "lpForfeited", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "BucketTake", "inputs": [ { - "internalType": "uint256", - "name": "index_", - "type": "uint256" - } - ], - "name": "depositScale", - "outputs": [ + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "depositSize", - "outputs": [ + "name": "index", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "collateral", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "bondChange", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "isReward", + "type": "bool", + "indexed": false, + "internalType": "bool" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "BucketTakeLPAwarded", "inputs": [ { - "internalType": "uint256", - "name": "index_", - "type": "uint256" - } - ], - "name": "depositUpToIndex", - "outputs": [ + "name": "taker", + "type": "address", + "indexed": true, + "internalType": "address" + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "depositUtilization", - "outputs": [ + "name": "kicker", + "type": "address", + "indexed": true, + "internalType": "address" + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "lpAwardedTaker", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lpAwardedKicker", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "DecreaseLPAllowance", "inputs": [ { - "internalType": "address", - "name": "borrowerAddress_", - "type": "address" + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "amountToBorrow_", - "type": "uint256" + "name": "spender", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "limitIndex_", - "type": "uint256" + "name": "indexes", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" }, { - "internalType": "uint256[]", - "name": "tokenIdsToPledge_", - "type": "uint256[]" + "name": "amounts", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" } ], - "name": "drawDebt", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "emasInfo", - "outputs": [ + "type": "event", + "name": "DrawDebtNFT", + "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "amountBorrowed", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "tokenIdsPledged", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "lup", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "Flashloan", "inputs": [ { - "internalType": "address", - "name": "token_", - "type": "address" + "name": "receiver", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "flashFee", - "outputs": [ + "name": "token", + "type": "address", + "indexed": true, + "internalType": "address" + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "IncreaseLPAllowance", "inputs": [ { - "internalType": "contract IERC3156FlashBorrower", - "name": "receiver_", - "type": "address" + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "address", - "name": "token_", - "type": "address" + "name": "spender", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "amount_", - "type": "uint256" + "name": "indexes", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" }, { - "internalType": "bytes", - "name": "data_", - "type": "bytes" - } - ], - "name": "flashLoan", - "outputs": [ - { - "internalType": "bool", - "name": "success_", - "type": "bool" + "name": "amounts", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" } ], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false + }, + { + "type": "event", + "name": "InterestUpdateFailure", + "inputs": [], + "anonymous": false }, { + "type": "event", + "name": "Kick", "inputs": [ { - "internalType": "address", - "name": "spender_", - "type": "address" + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256[]", - "name": "indexes_", - "type": "uint256[]" + "name": "debt", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256[]", - "name": "amounts_", - "type": "uint256[]" - } - ], - "name": "increaseLPAllowance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "inflatorInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "collateral", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "bond", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "KickReserveAuction", "inputs": [ { - "internalType": "uint256[]", - "name": "tokenIds_", - "type": "uint256[]" + "name": "claimableReservesRemaining", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "rate_", - "type": "uint256" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "interestRateInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "auctionPrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "currentBurnEpoch", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "isSubset", - "outputs": [ + "type": "event", + "name": "LoanStamped", + "inputs": [ { - "internalType": "bool", - "name": "", - "type": "bool" + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" } ], - "stateMutability": "pure", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "MergeOrRemoveCollateralNFT", "inputs": [ { - "internalType": "address", - "name": "borrower_", - "type": "address" + "name": "actor", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "npLimitIndex_", - "type": "uint256" + "name": "collateralMerged", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "toIndexLps", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "name": "kick", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "kickReserveAuction", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "MoveQuoteToken", "inputs": [ { - "internalType": "address", - "name": "kicker_", - "type": "address" - } - ], - "name": "kickerInfo", - "outputs": [ + "name": "lender", + "type": "address", + "indexed": true, + "internalType": "address" + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "from", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "to", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lpRedeemedFrom", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lpAwardedTo", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "lup", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "RemoveCollateral", "inputs": [ { - "internalType": "uint256", - "name": "index_", - "type": "uint256" + "name": "claimer", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "address", - "name": "lender_", - "type": "address" - } - ], - "name": "lenderInfo", - "outputs": [ + "name": "index", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, { - "internalType": "uint256", - "name": "lpBalance_", - "type": "uint256" + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "depositTime_", - "type": "uint256" + "name": "lpRedeemed", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "RemoveQuoteToken", "inputs": [ { - "internalType": "uint256", - "name": "index_", - "type": "uint256" + "name": "lender", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "npLimitIndex_", - "type": "uint256" - } - ], - "name": "lenderKick", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ + "name": "index", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, { - "internalType": "uint256", - "name": "loanId_", - "type": "uint256" - } - ], - "name": "loanInfo", - "outputs": [ + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, { - "internalType": "address", - "name": "", - "type": "address" + "name": "lpRedeemed", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "lup", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "loansInfo", - "outputs": [ + "type": "event", + "name": "RepayDebt", + "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "quoteRepaid", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "collateralPulled", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lup", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "ReserveAuction", "inputs": [ { - "internalType": "uint256", - "name": "index_", - "type": "uint256" + "name": "claimableReservesRemaining", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "address", - "name": "spender_", - "type": "address" + "name": "auctionPrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "address", - "name": "owner_", - "type": "address" + "name": "currentBurnEpoch", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "name": "lpAllowance", - "outputs": [ + "anonymous": false + }, + { + "type": "event", + "name": "ResetInterestRate", + "inputs": [ { - "internalType": "uint256", - "name": "allowance_", - "type": "uint256" + "name": "oldRate", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "newRate", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "RevokeLPAllowance", "inputs": [ { - "internalType": "address", - "name": "token_", - "type": "address" - } - ], - "name": "maxFlashLoan", - "outputs": [ + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, { - "internalType": "uint256", - "name": "maxLoan_", - "type": "uint256" + "name": "spender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "indexes", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "RevokeLPTransferors", "inputs": [ { - "internalType": "uint256[]", - "name": "removalIndexes_", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "noOfNFTsToRemove_", - "type": "uint256" + "name": "lender", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "toIndex_", - "type": "uint256" + "name": "transferors", + "type": "address[]", + "indexed": false, + "internalType": "address[]" } ], - "name": "mergeOrRemoveCollateral", - "outputs": [ + "anonymous": false + }, + { + "type": "event", + "name": "Settle", + "inputs": [ { - "internalType": "uint256", - "name": "collateralMerged_", - "type": "uint256" + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "bucketLP_", - "type": "uint256" + "name": "settledDebt", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "Take", "inputs": [ { - "internalType": "uint256", - "name": "maxAmount_", - "type": "uint256" + "name": "borrower", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "fromIndex_", - "type": "uint256" + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "toIndex_", - "type": "uint256" + "name": "collateral", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "expiry_", - "type": "uint256" + "name": "bondChange", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "bool", - "name": "revertIfBelowLup_", - "type": "bool" + "name": "isReward", + "type": "bool", + "indexed": false, + "internalType": "bool" } ], - "name": "moveQuoteToken", - "outputs": [ + "anonymous": false + }, + { + "type": "event", + "name": "TransferLP", + "inputs": [ { - "internalType": "uint256", - "name": "fromBucketLP_", - "type": "uint256" + "name": "owner", + "type": "address", + "indexed": false, + "internalType": "address" }, { - "internalType": "uint256", - "name": "toBucketLP_", - "type": "uint256" + "name": "newOwner", + "type": "address", + "indexed": false, + "internalType": "address" }, { - "internalType": "uint256", - "name": "movedAmount_", - "type": "uint256" + "name": "indexes", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" + }, + { + "name": "lp", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "UpdateInterestRate", "inputs": [ { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ + "name": "oldRate", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" + "name": "newRate", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false + }, + { + "type": "error", + "name": "AddAboveAuctionPrice", + "inputs": [] + }, + { + "type": "error", + "name": "AddAboveAuctionPrice", + "inputs": [] + }, + { + "type": "error", + "name": "AlreadyInitialized", + "inputs": [] + }, + { + "type": "error", + "name": "AmountLTMinDebt", + "inputs": [] + }, + { + "type": "error", + "name": "AuctionActive", + "inputs": [] + }, + { + "type": "error", + "name": "AuctionActive", + "inputs": [] + }, + { + "type": "error", + "name": "AuctionNotClearable", + "inputs": [] + }, + { + "type": "error", + "name": "AuctionNotCleared", + "inputs": [] + }, + { + "type": "error", + "name": "AuctionNotCleared", + "inputs": [] + }, + { + "type": "error", + "name": "AuctionNotTakeable", + "inputs": [] + }, + { + "type": "error", + "name": "AuctionPriceGtBucketPrice", + "inputs": [] + }, + { + "type": "error", + "name": "BorrowerNotSender", + "inputs": [] + }, + { + "type": "error", + "name": "BorrowerOk", + "inputs": [] + }, + { + "type": "error", + "name": "BorrowerUnderCollateralized", + "inputs": [] + }, + { + "type": "error", + "name": "BucketBankruptcyBlock", + "inputs": [] + }, + { + "type": "error", + "name": "BucketIndexOutOfBounds", + "inputs": [] + }, + { + "type": "error", + "name": "CannotMergeToHigherPrice", + "inputs": [] + }, + { + "type": "error", + "name": "DustAmountNotExceeded", + "inputs": [] + }, + { + "type": "error", + "name": "FlashloanCallbackFailed", + "inputs": [] + }, + { + "type": "error", + "name": "FlashloanIncorrectBalance", + "inputs": [] + }, + { + "type": "error", + "name": "FlashloanUnavailableForToken", + "inputs": [] + }, + { + "type": "error", + "name": "InsufficientCollateral", + "inputs": [] + }, + { + "type": "error", + "name": "InsufficientLP", + "inputs": [] + }, + { + "type": "error", + "name": "InsufficientLiquidity", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidAllowancesInput", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidAmount", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidIndex", + "inputs": [] + }, + { + "type": "error", + "name": "LUPBelowHTP", + "inputs": [] }, { - "inputs": [], - "name": "pledgedCollateral", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" + "type": "error", + "name": "LimitIndexExceeded", + "inputs": [] }, { - "inputs": [], - "name": "poolType", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "pure", - "type": "function" + "type": "error", + "name": "MoveToSameIndex", + "inputs": [] }, { - "inputs": [], - "name": "quoteTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "pure", - "type": "function" + "type": "error", + "name": "NoAllowance", + "inputs": [] }, { - "inputs": [], - "name": "quoteTokenScale", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" + "type": "error", + "name": "NoAuction", + "inputs": [] }, { - "inputs": [ - { - "internalType": "uint256", - "name": "noOfNFTsToRemove_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "index_", - "type": "uint256" - } - ], - "name": "removeCollateral", - "outputs": [ - { - "internalType": "uint256", - "name": "removedAmount_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "redeemedLP_", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" + "type": "error", + "name": "NoClaim", + "inputs": [] }, { - "inputs": [ - { - "internalType": "uint256", - "name": "maxAmount_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "index_", - "type": "uint256" - } - ], - "name": "removeQuoteToken", - "outputs": [ - { - "internalType": "uint256", - "name": "removedAmount_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "redeemedLP_", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" + "type": "error", + "name": "NoDebt", + "inputs": [] }, { - "inputs": [ - { - "internalType": "address", - "name": "borrowerAddress_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "maxQuoteTokenAmountToRepay_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "noOfNFTsToPull_", - "type": "uint256" - }, - { - "internalType": "address", - "name": "collateralReceiver_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "limitIndex_", - "type": "uint256" - } - ], - "name": "repayDebt", - "outputs": [ - { - "internalType": "uint256", - "name": "amountRepaid_", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" + "type": "error", + "name": "NoReserves", + "inputs": [] }, { - "inputs": [], - "name": "reservesInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, + "type": "error", + "name": "NoReservesAuction", + "inputs": [] + }, + { + "type": "error", + "name": "OnlySubset", + "inputs": [] + }, + { + "type": "error", + "name": "PRBMathSD59x18__Exp2InputTooBig", + "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "x", + "type": "int256", + "internalType": "int256" } - ], - "stateMutability": "view", - "type": "function" + ] }, { + "type": "error", + "name": "PRBMathSD59x18__FromIntOverflow", "inputs": [ { - "internalType": "address", - "name": "spender_", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "indexes_", - "type": "uint256[]" + "name": "x", + "type": "int256", + "internalType": "int256" } - ], - "name": "revokeLPAllowance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + ] }, { + "type": "error", + "name": "PRBMathSD59x18__FromIntUnderflow", "inputs": [ { - "internalType": "address[]", - "name": "transferors_", - "type": "address[]" + "name": "x", + "type": "int256", + "internalType": "int256" } - ], - "name": "revokeLPTransferors", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + ] }, { + "type": "error", + "name": "PRBMathSD59x18__LogInputTooSmall", "inputs": [ { - "internalType": "address", - "name": "borrowerAddress_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "maxDepth_", - "type": "uint256" + "name": "x", + "type": "int256", + "internalType": "int256" } - ], - "name": "settle", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + ] }, { - "inputs": [], - "name": "stampLoan", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "type": "error", + "name": "PRBMathSD59x18__MulInputTooSmall", + "inputs": [] }, { + "type": "error", + "name": "PRBMathSD59x18__MulOverflow", "inputs": [ { - "internalType": "address", - "name": "borrowerAddress_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "collateral_", - "type": "uint256" - }, - { - "internalType": "address", - "name": "callee_", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data_", - "type": "bytes" - } - ], - "name": "take", - "outputs": [ - { - "internalType": "uint256", - "name": "collateralTaken_", - "type": "uint256" + "name": "rAbs", + "type": "uint256", + "internalType": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" + ] }, { + "type": "error", + "name": "PRBMath__MulDivFixedPointOverflow", "inputs": [ { - "internalType": "uint256", - "name": "maxAmount_", - "type": "uint256" - } - ], - "name": "takeReserves", - "outputs": [ - { - "internalType": "uint256", - "name": "amount_", - "type": "uint256" + "name": "prod1", + "type": "uint256", + "internalType": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" + ] }, { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId_", - "type": "uint256" - } - ], - "name": "tokenIdsAllowed", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" + "type": "error", + "name": "PriceBelowLUP", + "inputs": [] }, { - "inputs": [], - "name": "totalAuctionsInPool", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" + "type": "error", + "name": "RemoveDepositLockedByAuctionDebt", + "inputs": [] }, { - "inputs": [ - { - "internalType": "address", - "name": "borrower_", - "type": "address" - } - ], - "name": "totalBorrowerTokens", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" + "type": "error", + "name": "RemoveDepositLockedByAuctionDebt", + "inputs": [] }, { - "inputs": [], - "name": "totalBucketTokens", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" + "type": "error", + "name": "ReserveAuctionTooSoon", + "inputs": [] }, { - "inputs": [], - "name": "totalT0Debt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" + "type": "error", + "name": "TransactionExpired", + "inputs": [] }, { - "inputs": [], - "name": "totalT0DebtInAuction", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" + "type": "error", + "name": "TransactionExpired", + "inputs": [] }, { - "inputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - }, - { - "internalType": "address", - "name": "newOwner_", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "indexes_", - "type": "uint256[]" - } - ], - "name": "transferLP", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "type": "error", + "name": "TransferToSameOwner", + "inputs": [] }, { - "inputs": [], - "name": "updateInterest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "type": "error", + "name": "TransferorNotApproved", + "inputs": [] }, { - "inputs": [ - { - "internalType": "address", - "name": "recipient_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "maxAmount_", - "type": "uint256" - } - ], - "name": "withdrawBonds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "type": "error", + "name": "ZeroDebtToCollateral", + "inputs": [] } -] \ No newline at end of file +] diff --git a/abis/ERC721PoolFactory.json b/abis/ERC721PoolFactory.json index 4cb105a..553b41b 100644 --- a/abis/ERC721PoolFactory.json +++ b/abis/ERC721PoolFactory.json @@ -1,293 +1,299 @@ [ { + "type": "constructor", "inputs": [ { - "internalType": "address", "name": "ajna_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "nonpayable", - "type": "constructor" + "stateMutability": "nonpayable" }, { - "inputs": [], - "name": "CreateFail", - "type": "error" - }, - { - "inputs": [], - "name": "DecimalsNotCompliant", - "type": "error" - }, - { - "inputs": [], - "name": "DeployQuoteCollateralSameToken", - "type": "error" - }, - { - "inputs": [], - "name": "DeployWithZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "NFTNotSupported", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "pool_", - "type": "address" - } - ], - "name": "PoolAlreadyExists", - "type": "error" - }, - { - "inputs": [], - "name": "PoolInterestRateInvalid", - "type": "error" - }, - { - "inputs": [], - "name": "TokenIdSubsetInvalid", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "pool_", - "type": "address" - } - ], - "name": "PoolCreated", - "type": "event" - }, - { - "inputs": [], + "type": "function", "name": "ERC721_NON_SUBSET_HASH", + "inputs": [], "outputs": [ { - "internalType": "bytes32", "name": "", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "MAX_RATE", + "inputs": [], "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "MIN_RATE", + "inputs": [], "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "ajna", + "inputs": [], "outputs": [ { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "deployPool", "inputs": [ { - "internalType": "address", "name": "collateral_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "quote_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "interestRate_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "deployPool", "outputs": [ { - "internalType": "address", "name": "pool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "deployPool", "inputs": [ { - "internalType": "address", "name": "collateral_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "quote_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256[]", "name": "tokenIds_", - "type": "uint256[]" + "type": "uint256[]", + "internalType": "uint256[]" }, { - "internalType": "uint256", "name": "interestRate_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "deployPool", "outputs": [ { - "internalType": "address", "name": "pool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "deployedPools", "inputs": [ { - "internalType": "bytes32", "name": "", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" }, { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "deployedPools", "outputs": [ { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "deployedPoolsList", "inputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "deployedPoolsList", "outputs": [ { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "getDeployedPoolsList", + "inputs": [], "outputs": [ { - "internalType": "address[]", "name": "", - "type": "address[]" + "type": "address[]", + "internalType": "address[]" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getNFTSubsetHash", "inputs": [ { - "internalType": "uint256[]", "name": "tokenIds_", - "type": "uint256[]" + "type": "uint256[]", + "internalType": "uint256[]" } ], - "name": "getNFTSubsetHash", "outputs": [ { - "internalType": "bytes32", "name": "", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "stateMutability": "pure", - "type": "function" + "stateMutability": "pure" }, { - "inputs": [], + "type": "function", "name": "getNumberOfDeployedPools", + "inputs": [], "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "implementation", + "inputs": [], "outputs": [ { - "internalType": "contract ERC721Pool", "name": "", - "type": "address" + "type": "address", + "internalType": "contract ERC721Pool" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" + }, + { + "type": "event", + "name": "PoolCreated", + "inputs": [ + { + "name": "pool_", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "subsetHash_", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "CreateFail", + "inputs": [] + }, + { + "type": "error", + "name": "DecimalsNotCompliant", + "inputs": [] + }, + { + "type": "error", + "name": "DeployQuoteCollateralSameToken", + "inputs": [] + }, + { + "type": "error", + "name": "DeployWithZeroAddress", + "inputs": [] + }, + { + "type": "error", + "name": "NFTNotSupported", + "inputs": [] + }, + { + "type": "error", + "name": "PoolAlreadyExists", + "inputs": [ + { + "name": "pool_", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "PoolInterestRateInvalid", + "inputs": [] + }, + { + "type": "error", + "name": "TokenIdSubsetInvalid", + "inputs": [] } ] diff --git a/abis/GrantFund.json b/abis/GrantFund.json index e4ea4b7..ba6636f 100644 --- a/abis/GrantFund.json +++ b/abis/GrantFund.json @@ -10,11 +10,6 @@ "stateMutability": "nonpayable", "type": "constructor" }, - { - "inputs": [], - "name": "AlreadyVoted", - "type": "error" - }, { "inputs": [], "name": "DelegateRewardInvalid", diff --git a/abis/PoolInfoUtils.json b/abis/PoolInfoUtils.json index f4792e6..f3c9baf 100644 --- a/abis/PoolInfoUtils.json +++ b/abis/PoolInfoUtils.json @@ -1,681 +1,770 @@ [ { - "inputs": [], - "name": "BucketIndexOutOfBounds", - "type": "error" - }, - { - "inputs": [], - "name": "BucketPriceOutOfBounds", - "type": "error" - }, - { + "type": "function", + "name": "auctionInfo", "inputs": [ { - "internalType": "int256", - "name": "x", - "type": "int256" - } - ], - "name": "PRBMathSD59x18__CeilOverflow", - "type": "error" - }, - { - "inputs": [], - "name": "PRBMathSD59x18__DivInputTooSmall", - "type": "error" - }, - { - "inputs": [ + "name": "ajnaPool_", + "type": "address", + "internalType": "address" + }, { - "internalType": "uint256", - "name": "rAbs", - "type": "uint256" + "name": "borrower_", + "type": "address", + "internalType": "address" } ], - "name": "PRBMathSD59x18__DivOverflow", - "type": "error" - }, - { - "inputs": [ + "outputs": [ { - "internalType": "int256", - "name": "x", - "type": "int256" - } - ], - "name": "PRBMathSD59x18__Exp2InputTooBig", - "type": "error" - }, - { - "inputs": [ + "name": "kicker_", + "type": "address", + "internalType": "address" + }, { - "internalType": "int256", - "name": "x", - "type": "int256" - } - ], - "name": "PRBMathSD59x18__FromIntOverflow", - "type": "error" - }, - { - "inputs": [ + "name": "bondFactor_", + "type": "uint256", + "internalType": "uint256" + }, { - "internalType": "int256", - "name": "x", - "type": "int256" - } - ], - "name": "PRBMathSD59x18__FromIntUnderflow", - "type": "error" - }, - { - "inputs": [ + "name": "bondSize_", + "type": "uint256", + "internalType": "uint256" + }, { - "internalType": "int256", - "name": "x", - "type": "int256" - } - ], - "name": "PRBMathSD59x18__LogInputTooSmall", - "type": "error" - }, - { - "inputs": [], - "name": "PRBMathSD59x18__MulInputTooSmall", - "type": "error" - }, - { - "inputs": [ + "name": "kickTime_", + "type": "uint256", + "internalType": "uint256" + }, { - "internalType": "uint256", - "name": "rAbs", - "type": "uint256" - } - ], - "name": "PRBMathSD59x18__MulOverflow", - "type": "error" - }, - { - "inputs": [ + "name": "referencePrice_", + "type": "uint256", + "internalType": "uint256" + }, { - "internalType": "uint256", - "name": "prod1", - "type": "uint256" - } - ], - "name": "PRBMath__MulDivFixedPointOverflow", - "type": "error" - }, - { - "inputs": [ + "name": "neutralPrice_", + "type": "uint256", + "internalType": "uint256" + }, { - "internalType": "uint256", - "name": "prod1", - "type": "uint256" + "name": "debtToCollateral_", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "denominator", - "type": "uint256" + "name": "head_", + "type": "address", + "internalType": "address" + }, + { + "name": "next_", + "type": "address", + "internalType": "address" + }, + { + "name": "prev_", + "type": "address", + "internalType": "address" } ], - "name": "PRBMath__MulDivOverflow", - "type": "error" + "stateMutability": "view" }, { + "type": "function", + "name": "auctionStatus", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "borrower_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "auctionStatus", "outputs": [ { - "internalType": "uint256", "name": "kickTime_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "collateral_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "debtToCover_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "bool", "name": "isCollateralized_", - "type": "bool" + "type": "bool", + "internalType": "bool" }, { - "internalType": "uint256", "name": "price_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "neutralPrice_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "referencePrice_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "debtToCollateral_", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "bondFactor_", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "availableQuoteTokenAmount", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "availableQuoteTokenAmount", "outputs": [ { - "internalType": "uint256", "name": "amount_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "borrowFeeRate", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "borrowFeeRate", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "borrowerInfo", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "borrower_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "borrowerInfo", "outputs": [ { - "internalType": "uint256", "name": "debt_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "collateral_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "t0Np_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "thresholdPrice_", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "bucketInfo", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "index_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "bucketInfo", "outputs": [ { - "internalType": "uint256", "name": "price_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "quoteTokens_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "collateral_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "bucketLP_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "scale_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "exchangeRate_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "hpb", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "hpb", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "hpbIndex", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "hpbIndex", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "htp", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "htp", "outputs": [ { - "internalType": "uint256", "name": "htp_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "indexToPrice", "inputs": [ { - "internalType": "uint256", "name": "index_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "indexToPrice", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "pure", - "type": "function" + "stateMutability": "pure" }, { + "type": "function", + "name": "lenderInterestMargin", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "lenderInterestMargin", "outputs": [ { - "internalType": "uint256", "name": "lenderInterestMargin_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "lpToCollateral", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "lp_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "index_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "lpToCollateral", "outputs": [ { - "internalType": "uint256", "name": "collateralAmount_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "lpToQuoteTokens", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "lp_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "index_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "lpToQuoteTokens", "outputs": [ { - "internalType": "uint256", "name": "quoteAmount_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "lup", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "lup", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "lupIndex", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "lupIndex", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "poolLoansInfo", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "poolLoansInfo", "outputs": [ { - "internalType": "uint256", "name": "poolSize_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "loansCount_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "address", "name": "maxBorrower_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "pendingInflator_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "pendingInterestFactor_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "poolPricesInfo", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "poolPricesInfo", "outputs": [ { - "internalType": "uint256", "name": "hpb_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "hpbIndex_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "htp_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "htpIndex_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "lup_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "lupIndex_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "poolReservesInfo", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "poolReservesInfo", "outputs": [ { - "internalType": "uint256", "name": "reserves_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "claimableReserves_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "claimableReservesRemaining_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "auctionPrice_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "timeRemaining_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "poolUtilizationInfo", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "poolUtilizationInfo", "outputs": [ { - "internalType": "uint256", "name": "poolMinDebtAmount_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "poolCollateralization_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "poolActualUtilization_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "poolTargetUtilization_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "priceToIndex", "inputs": [ { - "internalType": "uint256", "name": "price_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "priceToIndex", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "pure", - "type": "function" + "stateMutability": "pure" }, { + "type": "function", + "name": "unutilizedDepositFeeRate", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "unutilizedDepositFeeRate", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" + }, + { + "type": "error", + "name": "BucketIndexOutOfBounds", + "inputs": [] + }, + { + "type": "error", + "name": "BucketPriceOutOfBounds", + "inputs": [] + }, + { + "type": "error", + "name": "PRBMathSD59x18__CeilOverflow", + "inputs": [ + { + "name": "x", + "type": "int256", + "internalType": "int256" + } + ] + }, + { + "type": "error", + "name": "PRBMathSD59x18__DivInputTooSmall", + "inputs": [] + }, + { + "type": "error", + "name": "PRBMathSD59x18__DivOverflow", + "inputs": [ + { + "name": "rAbs", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "PRBMathSD59x18__Exp2InputTooBig", + "inputs": [ + { + "name": "x", + "type": "int256", + "internalType": "int256" + } + ] + }, + { + "type": "error", + "name": "PRBMathSD59x18__FromIntOverflow", + "inputs": [ + { + "name": "x", + "type": "int256", + "internalType": "int256" + } + ] + }, + { + "type": "error", + "name": "PRBMathSD59x18__FromIntUnderflow", + "inputs": [ + { + "name": "x", + "type": "int256", + "internalType": "int256" + } + ] + }, + { + "type": "error", + "name": "PRBMathSD59x18__LogInputTooSmall", + "inputs": [ + { + "name": "x", + "type": "int256", + "internalType": "int256" + } + ] + }, + { + "type": "error", + "name": "PRBMathSD59x18__MulInputTooSmall", + "inputs": [] + }, + { + "type": "error", + "name": "PRBMathSD59x18__MulOverflow", + "inputs": [ + { + "name": "rAbs", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "PRBMath__MulDivFixedPointOverflow", + "inputs": [ + { + "name": "prod1", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "PRBMath__MulDivOverflow", + "inputs": [ + { + "name": "prod1", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "denominator", + "type": "uint256", + "internalType": "uint256" + } + ] } ] diff --git a/abis/PositionManager.json b/abis/PositionManager.json index 2f71269..160201f 100644 --- a/abis/PositionManager.json +++ b/abis/PositionManager.json @@ -1,1026 +1,1021 @@ [ { + "type": "constructor", "inputs": [ { - "internalType": "contract ERC20PoolFactory", "name": "erc20Factory_", - "type": "address" + "type": "address", + "internalType": "contract ERC20PoolFactory" }, { - "internalType": "contract ERC721PoolFactory", "name": "erc721Factory_", - "type": "address" + "type": "address", + "internalType": "contract ERC721PoolFactory" } ], - "stateMutability": "nonpayable", - "type": "constructor" + "stateMutability": "nonpayable" }, { - "inputs": [], - "name": "AllowanceTooLow", - "type": "error" - }, - { - "inputs": [], - "name": "BucketBankrupt", - "type": "error" - }, - { - "inputs": [], - "name": "BucketIndexOutOfBounds", - "type": "error" - }, - { - "inputs": [], - "name": "DeployWithZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "LiquidityNotRemoved", - "type": "error" - }, - { - "inputs": [], - "name": "NoAuth", - "type": "error" - }, - { - "inputs": [], - "name": "NoToken", - "type": "error" - }, - { - "inputs": [], - "name": "NonExistentToken", - "type": "error" - }, - { - "inputs": [], - "name": "NotAjnaPool", - "type": "error" - }, - { - "inputs": [], - "name": "NotAuthorized", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "x", - "type": "int256" - } - ], - "name": "PRBMathSD59x18__Exp2InputTooBig", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "x", - "type": "int256" - } - ], - "name": "PRBMathSD59x18__FromIntOverflow", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "x", - "type": "int256" - } - ], - "name": "PRBMathSD59x18__FromIntUnderflow", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "x", - "type": "int256" - } - ], - "name": "PRBMathSD59x18__LogInputTooSmall", - "type": "error" - }, - { - "inputs": [], - "name": "PRBMathSD59x18__MulInputTooSmall", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "rAbs", - "type": "uint256" - } - ], - "name": "PRBMathSD59x18__MulOverflow", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "prod1", - "type": "uint256" - } - ], - "name": "PRBMath__MulDivFixedPointOverflow", - "type": "error" - }, - { - "inputs": [], - "name": "PermitExpired", - "type": "error" - }, - { - "inputs": [], - "name": "RemovePositionFailed", - "type": "error" - }, - { - "inputs": [], - "name": "WrongPool", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "indexes", - "type": "uint256[]" - } - ], - "name": "MemorializePosition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "pool", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fromIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "toIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "lpRedeemedFrom", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "lpAwardedTo", - "type": "uint256" - } - ], - "name": "MoveLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "indexes", - "type": "uint256[]" - } - ], - "name": "RedeemPosition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], + "type": "function", "name": "DOMAIN_SEPARATOR", + "inputs": [], "outputs": [ { - "internalType": "bytes32", "name": "", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "PERMIT_TYPEHASH", + "inputs": [], "outputs": [ { - "internalType": "bytes32", "name": "", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "approve", "inputs": [ { - "internalType": "address", "name": "to", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "tokenId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "approve", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "balanceOf", "inputs": [ { - "internalType": "address", "name": "owner", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "balanceOf", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "burn", "inputs": [ { - "internalType": "address", "name": "pool_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "tokenId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "burn", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "getApproved", "inputs": [ { - "internalType": "uint256", "name": "tokenId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "getApproved", "outputs": [ { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getLP", "inputs": [ { - "internalType": "uint256", "name": "tokenId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "index_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "getLP", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getPositionIndexes", "inputs": [ { - "internalType": "uint256", "name": "tokenId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "getPositionIndexes", "outputs": [ { - "internalType": "uint256[]", "name": "", - "type": "uint256[]" + "type": "uint256[]", + "internalType": "uint256[]" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getPositionIndexesFiltered", "inputs": [ { - "internalType": "uint256", "name": "tokenId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "getPositionIndexesFiltered", "outputs": [ { - "internalType": "uint256[]", "name": "filteredIndexes_", - "type": "uint256[]" + "type": "uint256[]", + "internalType": "uint256[]" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getPositionInfo", "inputs": [ { - "internalType": "uint256", "name": "tokenId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "index_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "getPositionInfo", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "isAjnaPool", "inputs": [ { - "internalType": "address", "name": "pool_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "bytes32", "name": "subsetHash_", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "name": "isAjnaPool", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "isApprovedForAll", "inputs": [ { - "internalType": "address", "name": "owner", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "operator", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "isApprovedForAll", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "isIndexInPosition", "inputs": [ { - "internalType": "uint256", "name": "tokenId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "index_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "isIndexInPosition", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "isPositionBucketBankrupt", "inputs": [ { - "internalType": "uint256", "name": "tokenId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "index_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "isPositionBucketBankrupt", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "memorializePositions", "inputs": [ { - "internalType": "address", "name": "pool_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "tokenId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256[]", "name": "indexes_", - "type": "uint256[]" + "type": "uint256[]", + "internalType": "uint256[]" } ], - "name": "memorializePositions", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "mint", "inputs": [ { - "internalType": "address", "name": "pool_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "recipient_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "bytes32", "name": "poolSubsetHash_", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "name": "mint", "outputs": [ { - "internalType": "uint256", "name": "tokenId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "moveLiquidity", "inputs": [ { - "internalType": "address", "name": "pool_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "tokenId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "fromIndex_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "toIndex_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "expiry_", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "revertIfBelowLup_", - "type": "bool" + "type": "uint256", + "internalType": "uint256" } ], - "name": "moveLiquidity", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "multicall", "inputs": [ { - "internalType": "bytes[]", "name": "data", - "type": "bytes[]" + "type": "bytes[]", + "internalType": "bytes[]" } ], - "name": "multicall", "outputs": [ { - "internalType": "bytes[]", "name": "results", - "type": "bytes[]" + "type": "bytes[]", + "internalType": "bytes[]" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { - "inputs": [], + "type": "function", "name": "name", + "inputs": [], "outputs": [ { - "internalType": "string", "name": "", - "type": "string" + "type": "string", + "internalType": "string" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "nonces", "inputs": [ { - "internalType": "uint256", "name": "tokenId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "nonces", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "ownerOf", "inputs": [ { - "internalType": "uint256", "name": "tokenId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "ownerOf", "outputs": [ { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "permit", "inputs": [ { - "internalType": "address", "name": "spender_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "tokenId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "deadline_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "bytes", "name": "signature_", - "type": "bytes" + "type": "bytes", + "internalType": "bytes" } ], - "name": "permit", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "poolKey", "inputs": [ { - "internalType": "uint256", "name": "tokenId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "poolKey", "outputs": [ { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "redeemPositions", "inputs": [ { - "internalType": "address", "name": "pool_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "tokenId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256[]", "name": "indexes_", - "type": "uint256[]" + "type": "uint256[]", + "internalType": "uint256[]" } ], - "name": "redeemPositions", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "safeTransferFrom", "inputs": [ { - "internalType": "address", "name": "from", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "to", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "tokenId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "safeTransferFrom", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "safeTransferFrom", "inputs": [ { - "internalType": "address", "name": "from", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "to", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "tokenId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "bytes", "name": "data", - "type": "bytes" + "type": "bytes", + "internalType": "bytes" } ], - "name": "safeTransferFrom", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "setApprovalForAll", "inputs": [ { - "internalType": "address", "name": "operator", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "bool", "name": "approved", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "name": "setApprovalForAll", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "supportsInterface", "inputs": [ { - "internalType": "bytes4", "name": "interfaceId", - "type": "bytes4" + "type": "bytes4", + "internalType": "bytes4" } ], - "name": "supportsInterface", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "symbol", + "inputs": [], "outputs": [ { - "internalType": "string", "name": "", - "type": "string" + "type": "string", + "internalType": "string" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "tokenURI", "inputs": [ { - "internalType": "uint256", "name": "tokenId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "tokenURI", "outputs": [ { - "internalType": "string", "name": "", - "type": "string" + "type": "string", + "internalType": "string" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "transferFrom", "inputs": [ { - "internalType": "address", "name": "from", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "to", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "tokenId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "transferFrom", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "Approval", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "approved", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ApprovalForAll", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "operator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "approved", + "type": "bool", + "indexed": false, + "internalType": "bool" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Burn", + "inputs": [ + { + "name": "lender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "MemorializePosition", + "inputs": [ + { + "name": "lender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "indexes", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Mint", + "inputs": [ + { + "name": "lender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "pool", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "MoveLiquidity", + "inputs": [ + { + "name": "lender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "fromIndex", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "toIndex", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lpRedeemedFrom", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lpAwardedTo", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RedeemPosition", + "inputs": [ + { + "name": "lender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "indexes", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Transfer", + "inputs": [ + { + "name": "from", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AllowanceTooLow", + "inputs": [] + }, + { + "type": "error", + "name": "BucketBankrupt", + "inputs": [] + }, + { + "type": "error", + "name": "BucketIndexOutOfBounds", + "inputs": [] + }, + { + "type": "error", + "name": "DeployWithZeroAddress", + "inputs": [] + }, + { + "type": "error", + "name": "LiquidityNotRemoved", + "inputs": [] + }, + { + "type": "error", + "name": "NoAuth", + "inputs": [] + }, + { + "type": "error", + "name": "NoToken", + "inputs": [] + }, + { + "type": "error", + "name": "NonExistentToken", + "inputs": [] + }, + { + "type": "error", + "name": "NotAjnaPool", + "inputs": [] + }, + { + "type": "error", + "name": "NotAuthorized", + "inputs": [] + }, + { + "type": "error", + "name": "PRBMathSD59x18__Exp2InputTooBig", + "inputs": [ + { + "name": "x", + "type": "int256", + "internalType": "int256" + } + ] + }, + { + "type": "error", + "name": "PRBMathSD59x18__FromIntOverflow", + "inputs": [ + { + "name": "x", + "type": "int256", + "internalType": "int256" + } + ] + }, + { + "type": "error", + "name": "PRBMathSD59x18__FromIntUnderflow", + "inputs": [ + { + "name": "x", + "type": "int256", + "internalType": "int256" + } + ] + }, + { + "type": "error", + "name": "PRBMathSD59x18__LogInputTooSmall", + "inputs": [ + { + "name": "x", + "type": "int256", + "internalType": "int256" + } + ] + }, + { + "type": "error", + "name": "PRBMathSD59x18__MulInputTooSmall", + "inputs": [] + }, + { + "type": "error", + "name": "PRBMathSD59x18__MulOverflow", + "inputs": [ + { + "name": "rAbs", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "PRBMath__MulDivFixedPointOverflow", + "inputs": [ + { + "name": "prod1", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "PermitExpired", + "inputs": [] + }, + { + "type": "error", + "name": "RemovePositionFailed", + "inputs": [] + }, + { + "type": "error", + "name": "WrongPool", + "inputs": [] } ] diff --git a/copy-abis.sh b/copy-abis.sh index d0db902..5475459 100755 --- a/copy-abis.sh +++ b/copy-abis.sh @@ -11,9 +11,15 @@ rm abis/* jq '.abi' "${ABI_PATH_CONTRACTS}/ERC20.sol/ERC20.json" > abis/ERC20.json jq '.abi' "${ABI_PATH_CONTRACTS}/ERC20Pool.sol/ERC20Pool.json" > abis/ERC20Pool.json jq '.abi' "${ABI_PATH_CONTRACTS}/ERC20PoolFactory.sol/ERC20PoolFactory.json" > abis/ERC20PoolFactory.json +jq '.abi' "${ABI_PATH_CONTRACTS}/ERC721.sol/ERC721.json" > abis/ERC721.json +jq '.abi' "${ABI_PATH_CONTRACTS}/ERC721Pool.sol/ERC721Pool.json" > abis/ERC721Pool.json jq '.abi' "${ABI_PATH_CONTRACTS}/ERC721PoolFactory.sol/ERC721PoolFactory.json" > abis/ERC721PoolFactory.json jq '.abi' "${ABI_PATH_CONTRACTS}/PoolInfoUtils.sol/PoolInfoUtils.json" > abis/PoolInfoUtils.json +jq '.abi' "${ABI_PATH_CONTRACTS}/PoolInfoUtilsMulticall.sol/PoolInfoUtilsMulticall.json" > abis/PoolInfoUtilsMulticall.json + jq '.abi' "${ABI_PATH_CONTRACTS}/PositionManager.sol/PositionManager.json" > abis/PositionManager.json -jq '.abi' "${ABI_PATH_CONTRACTS}/RewardsManager.sol/RewardsManager.json" > abis/RewardsManager.json -jq '.abi' "${ABI_PATH_GRANTS}/GrantFund.sol/GrantFund.json" > abis/GrantFund.json \ No newline at end of file +jq '.abi' "${ABI_PATH_GRANTS}/GrantFund.sol/GrantFund.json" > abis/GrantFund.json +jq '.abi' "${ABI_PATH_GRANTS}/AjnaToken.sol/AjnaToken.json" > abis/AjnaToken.json + +# Note this removes the needed BurnWrappedAjna ABI diff --git a/schema.graphql b/schema.graphql index d45cec4..c0cc99f 100644 --- a/schema.graphql +++ b/schema.graphql @@ -193,10 +193,14 @@ type Loan @entity { liquidationAuction: LiquidationAuction # collateral tokens deposited in a pool by the borrower collateralPledged: BigDecimal! + # borrower's threshold price + thresholdPrice: BigDecimal! # list of tokenIds pledged by the borrower tokenIdsPledged: [BigInt!]! # debt in T0 terms, useful when the caller knows the pending inflator t0debt: BigDecimal! + # borrowers t0 neutral price + t0Np: BigDecimal! } type Account @entity { @@ -264,6 +268,7 @@ type LiquidationAuction @entity { bondFactor: BigDecimal! # bond factor determining the reward or penalty for the kicker neutralPrice: BigDecimal! # price at which kicker will have their bond returned without penalty or reward referencePrice: BigDecimal! # max(HTP, NP) used in auction price curve + thresholdPrice: BigDecimal! # Threshold price stamped on the liquidation at time of kick } # tracks the reserve auction process across multiple takes in a single auction diff --git a/src/mappings/erc-20-pool.ts b/src/mappings/erc-20-pool.ts index c31faf9..12eacf5 100644 --- a/src/mappings/erc-20-pool.ts +++ b/src/mappings/erc-20-pool.ts @@ -46,7 +46,7 @@ import { } from "../../generated/schema" import { ZERO_BD, ONE_BI } from "../utils/constants" -import { addressToBytes, wadToDecimal } from "../utils/convert" +import { addressToBytes, wadToDecimal } from '../utils/convert'; import { loadOrCreateAccount, updateAccountLends, updateAccountLoans, updateAccountPools, updateAccountKicks, updateAccountTakes, updateAccountSettles } from "../utils/account" import { getBucketId, getBucketInfo, loadOrCreateBucket, updateBucketLends } from "../utils/pool/bucket" import { getLendId, loadOrCreateLend, saveOrRemoveLend } from "../utils/pool/lend" @@ -97,6 +97,8 @@ export function handleDrawDebt(event: DrawDebtEvent): void { const borrowerInfo = getBorrowerInfo(addressToBytes(event.params.borrower), pool.id) loan.collateralPledged = wadToDecimal(borrowerInfo.collateral) loan.t0debt = wadToDecimal(borrowerInfo.t0debt) + loan.t0Np = wadToDecimal(borrowerInfo.t0Np) + loan.thresholdPrice = wadToDecimal(borrowerInfo.thresholdPrice) // update account's list of pools and loans if necessary updateAccountPools(account, pool) @@ -149,6 +151,8 @@ export function handleRepayDebt(event: RepayDebtEvent): void { const borrowerInfo = getBorrowerInfo(accountId, pool.id) loan.collateralPledged = wadToDecimal(borrowerInfo.collateral) loan.t0debt = wadToDecimal(borrowerInfo.t0debt) + loan.t0Np = wadToDecimal(borrowerInfo.t0Np) + loan.thresholdPrice = wadToDecimal(borrowerInfo.thresholdPrice) // update account loans if necessary updateAccountLoans(account, loan) @@ -437,6 +441,8 @@ export function handleBucketTake(event: BucketTakeEvent): void { const borrowerInfo = getBorrowerInfo(addressToBytes(event.params.borrower), pool.id) loan.collateralPledged = wadToDecimal(borrowerInfo.collateral) loan.t0debt = wadToDecimal(borrowerInfo.t0debt) + loan.t0Np = wadToDecimal(borrowerInfo.t0Np) + loan.thresholdPrice = wadToDecimal(borrowerInfo.thresholdPrice) // retrieve auction information on the take's auction const auctionInfo = getAuctionInfoERC20Pool(bucketTake.borrower, pool) @@ -550,6 +556,8 @@ export function handleTake(event: TakeEvent): void { const borrowerInfo = getBorrowerInfo(addressToBytes(event.params.borrower), pool.id) loan.collateralPledged = wadToDecimal(borrowerInfo.collateral) loan.t0debt = wadToDecimal(borrowerInfo.t0debt) + loan.t0Np = wadToDecimal(borrowerInfo.t0Np) + loan.thresholdPrice = wadToDecimal(borrowerInfo.thresholdPrice) // update liquidation auction state const auctionId = loan.liquidationAuction! diff --git a/src/mappings/erc-721-pool.ts b/src/mappings/erc-721-pool.ts index 49eaf87..7ed6261 100644 --- a/src/mappings/erc-721-pool.ts +++ b/src/mappings/erc-721-pool.ts @@ -52,7 +52,7 @@ import { getBucketId, getBucketInfo, loadOrCreateBucket, updateBucketLends } fro import { addressToBytes, decimalToWad, wadToDecimal } from "../utils/convert" import { ZERO_BD, ONE_BI, ONE_WAD_BI } from "../utils/constants" import { getLendId, loadOrCreateLend, saveOrRemoveLend } from "../utils/pool/lend" -import { getBorrowerInfoERC721Pool, getLoanId, loadOrCreateLoan, saveOrRemoveLoan } from "../utils/pool/loan" +import { getBorrowerInfo, getLoanId, loadOrCreateLoan, saveOrRemoveLoan } from "../utils/pool/loan" import { getLiquidationAuctionId, loadOrCreateLiquidationAuction, updateLiquidationAuction, getAuctionStatus, loadOrCreateBucketTake, getAuctionInfoERC721Pool } from "../utils/pool/liquidation" import { updatePool, addLiquidationToPool, getLenderInfoERC721Pool } from "../utils/pool/pool" import { lpbValueInQuote } from "../utils/pool/lend" @@ -92,9 +92,11 @@ export function handleDrawDebtNFT(event: DrawDebtNFTEvent): void { // update loan state const loanId = getLoanId(pool.id, accountId) const loan = loadOrCreateLoan(loanId, pool.id, drawDebtNFT.borrower) - const borrowerInfo = getBorrowerInfoERC721Pool(addressToBytes(event.params.borrower), pool.id) + const borrowerInfo = getBorrowerInfo(addressToBytes(event.params.borrower), pool.id) loan.collateralPledged = wadToDecimal(borrowerInfo.collateral) loan.t0debt = wadToDecimal(borrowerInfo.t0debt) + loan.t0Np = wadToDecimal(borrowerInfo.t0Np) + loan.thresholdPrice = wadToDecimal(borrowerInfo.thresholdPrice) loan.tokenIdsPledged = loan.tokenIdsPledged.concat(event.params.tokenIdsPledged) // update account's list of pools and loans if necessary @@ -139,9 +141,11 @@ export function handleRepayDebt(event: RepayDebtEvent): void { const loanId = getLoanId(pool.id, accountId) const loan = loadOrCreateLoan(loanId, pool.id, repayDebt.borrower) - const borrowerInfo = getBorrowerInfoERC721Pool(accountId, pool.id) + const borrowerInfo = getBorrowerInfo(accountId, pool.id) loan.collateralPledged = wadToDecimal(borrowerInfo.collateral) loan.t0debt = wadToDecimal(borrowerInfo.t0debt) + loan.t0Np = wadToDecimal(borrowerInfo.t0Np) + loan.thresholdPrice = wadToDecimal(borrowerInfo.thresholdPrice) // retrieve the tokenIdsPledged that were pulled in this event const numberOfTokensPulled = event.params.collateralPulled.div(ONE_WAD_BI).toI32() @@ -622,9 +626,11 @@ export function handleBucketTake(event: BucketTakeEvent): void { // update loan state const loanId = getLoanId(pool.id, addressToBytes(event.params.borrower)) const loan = loadOrCreateLoan(loanId, pool.id, addressToBytes(event.params.borrower)) - const borrowerInfo = getBorrowerInfoERC721Pool(addressToBytes(event.params.borrower), pool.id) + const borrowerInfo = getBorrowerInfo(addressToBytes(event.params.borrower), pool.id) loan.collateralPledged = wadToDecimal(borrowerInfo.collateral) loan.t0debt = wadToDecimal(borrowerInfo.t0debt) + loan.t0Np = wadToDecimal(borrowerInfo.t0Np) + loan.thresholdPrice = wadToDecimal(borrowerInfo.thresholdPrice) // unique to ERC721Pools // remove collateral taken from loan and pool @@ -748,9 +754,11 @@ export function handleTake(event: TakeEvent): void { // update loan state const loanId = getLoanId(pool.id, addressToBytes(event.params.borrower)) const loan = Loan.load(loanId)! - const borrowerInfo = getBorrowerInfoERC721Pool(addressToBytes(event.params.borrower), pool.id) + const borrowerInfo = getBorrowerInfo(addressToBytes(event.params.borrower), pool.id) loan.collateralPledged = wadToDecimal(borrowerInfo.collateral) loan.t0debt = wadToDecimal(borrowerInfo.t0debt) + loan.t0Np = wadToDecimal(borrowerInfo.t0Np) + loan.thresholdPrice = wadToDecimal(borrowerInfo.thresholdPrice) // remove tokenIdsTaken from loan and pool tokenIdsPledged const numberOfTokensToTake = getWadCollateralFloorTokens(event.params.collateral).toI32() diff --git a/src/utils/pool/liquidation.ts b/src/utils/pool/liquidation.ts index 44c9346..e56d5b9 100644 --- a/src/utils/pool/liquidation.ts +++ b/src/utils/pool/liquidation.ts @@ -82,6 +82,7 @@ export function updateLiquidationAuction( liquidationAuction.kickTime = auctionInfo.kickTime liquidationAuction.neutralPrice = wadToDecimal(auctionInfo.neutralPrice) liquidationAuction.referencePrice = wadToDecimal(auctionInfo.referencePrice) + liquidationAuction.thresholdPrice = wadToDecimal(auctionInfo.thresholdPrice) } // update remaining quantities even if auction was settled and they are 0 @@ -99,16 +100,18 @@ export class AuctionInfo { kickTime: BigInt referencePrice: BigInt neutralPrice: BigInt + thresholdPrice: BigInt head: Address next: Address prev: Address - constructor(kicker: Address, bondFactor: BigInt, bondSize: BigInt, kickTime: BigInt, referencePrice: BigInt, neutralPrice: BigInt, head: Address, next: Address, prev: Address) { + constructor(kicker: Address, bondFactor: BigInt, bondSize: BigInt, kickTime: BigInt, referencePrice: BigInt, neutralPrice: BigInt, thresholdPrice: BigInt, head: Address, next: Address, prev: Address) { this.kicker = kicker this.bondFactor = bondFactor this.bondSize = bondSize this.kickTime = kickTime this.referencePrice = referencePrice this.neutralPrice = neutralPrice + this.thresholdPrice = thresholdPrice this.head = head this.next = next this.prev = prev @@ -126,7 +129,8 @@ export function getAuctionInfoERC20Pool(borrower: Bytes, pool: Pool): AuctionInf auctionInfoResult.value5, auctionInfoResult.value6, auctionInfoResult.value7, - auctionInfoResult.value8 + auctionInfoResult.value8, + auctionInfoResult.value9 ) return auctionInfo } @@ -142,7 +146,8 @@ export function getAuctionInfoERC721Pool(borrower: Bytes, pool: Pool): AuctionIn auctionInfoResult.value5, auctionInfoResult.value6, auctionInfoResult.value7, - auctionInfoResult.value8 + auctionInfoResult.value8, + auctionInfoResult.value9 ) return auctionInfo } @@ -154,13 +159,19 @@ export class AuctionStatus { isCollateralized: bool price: BigInt neutralPrice: BigInt - constructor(kickTime: BigInt, collateral: BigInt, debtToCover: BigInt, isCollateralized: bool, price: BigInt, neutralPrice: BigInt) { + referencePrice: BigInt + thresholdPrice: BigInt + bondFactor: BigInt + constructor(kickTime: BigInt, collateral: BigInt, debtToCover: BigInt, isCollateralized: bool, price: BigInt, neutralPrice: BigInt, referencePrice: BigInt, thresholdPrice: BigInt, bondFactor: BigInt) { this.kickTime = kickTime this.collateral = collateral this.debtToCover = debtToCover this.isCollateralized = isCollateralized this.price = price this.neutralPrice = neutralPrice + this.referencePrice = referencePrice + this.thresholdPrice = thresholdPrice + this.bondFactor = bondFactor } } export function getAuctionStatus(pool: Pool, borrower: Address): AuctionStatus { @@ -173,6 +184,9 @@ export function getAuctionStatus(pool: Pool, borrower: Address): AuctionStatus { result.value2, result.value3, result.value4, - result.value5 + result.value5, + result.value6, + result.value7, + result.value8 ) } diff --git a/src/utils/pool/loan.ts b/src/utils/pool/loan.ts index 4d10e35..5792d89 100644 --- a/src/utils/pool/loan.ts +++ b/src/utils/pool/loan.ts @@ -21,6 +21,8 @@ export function loadOrCreateLoan(loanId: Bytes, poolId: Bytes, borrower: Bytes): loan.poolAddress = poolId.toHexString() loan.collateralPledged = ZERO_BD loan.t0debt = ZERO_BD + loan.t0Np = ZERO_BD + loan.thresholdPrice = ZERO_BD loan.inLiquidation = false loan.liquidationAuction = null loan.tokenIdsPledged = [] @@ -46,31 +48,24 @@ export class BorrowerInfo { t0debt: BigInt collateral: BigInt t0Np: BigInt - constructor(t0debt: BigInt, collateral: BigInt, t0Np: BigInt) { + thresholdPrice: BigInt + constructor(t0debt: BigInt, collateral: BigInt, t0Np: BigInt, thresholdPrice: BigInt) { this.t0debt = t0debt this.collateral = collateral this.t0Np = t0Np + this.thresholdPrice = thresholdPrice } } export function getBorrowerInfo(borrower: Bytes, poolId: Bytes): BorrowerInfo { - const poolContract = ERC20Pool.bind(Address.fromBytes(poolId)) - const borrowerInfoResult = poolContract.borrowerInfo(Address.fromBytes(borrower)) + const poolInfoUtilsAddress = poolInfoUtilsAddressTable.get(dataSource.network())! + const poolInfoUtilsContract = PoolInfoUtils.bind(poolInfoUtilsAddress) + const borrowerInfoResult = poolInfoUtilsContract.borrowerInfo(Address.fromBytes(poolId), Address.fromBytes(borrower)) return new BorrowerInfo( borrowerInfoResult.value0, borrowerInfoResult.value1, - borrowerInfoResult.value2 - ) -} - -export function getBorrowerInfoERC721Pool(borrower: Bytes, poolId: Bytes): BorrowerInfo { - const poolContract = ERC721Pool.bind(Address.fromBytes(poolId)) - const borrowerInfoResult = poolContract.borrowerInfo(Address.fromBytes(borrower)) - - return new BorrowerInfo( - borrowerInfoResult.value0, - borrowerInfoResult.value1, - borrowerInfoResult.value2 + borrowerInfoResult.value2, + borrowerInfoResult.value3 ) } diff --git a/subgraph.yaml b/subgraph.yaml index e6bc1ce..16b0fc3 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -69,7 +69,7 @@ dataSources: - name: PoolInfoUtils file: ./abis/PoolInfoUtils.json eventHandlers: - - event: PoolCreated(address) + - event: PoolCreated(address,bytes32) handler: handlePoolCreated file: ./src/mappings/erc-20-pool-factory.ts network: goerli @@ -97,7 +97,7 @@ dataSources: - name: PoolInfoUtils file: ./abis/PoolInfoUtils.json eventHandlers: - - event: PoolCreated(address) + - event: PoolCreated(address,bytes32) handler: handlePoolCreated file: ./src/mappings/erc-721-pool-factory.ts network: goerli diff --git a/tests/erc-20-pool.test.ts b/tests/erc-20-pool.test.ts index 6bd7df7..77202a7 100644 --- a/tests/erc-20-pool.test.ts +++ b/tests/erc-20-pool.test.ts @@ -24,7 +24,7 @@ import { addressToBytes, wadToDecimal } from "../src/utils/convert" import { FIVE_PERCENT_BI, MAX_PRICE, MAX_PRICE_BI, MAX_PRICE_INDEX, ONE_BI, ONE_PERCENT_BI, ONE_WAD_BI, TWO_BI, ZERO_ADDRESS, ZERO_BD, ZERO_BI } from '../src/utils/constants'; import { Account, Lend, Loan, Pool } from "../generated/schema" import { getLendId } from "../src/utils/pool/lend" -import { BorrowerInfo, getLoanId } from "../src/utils/pool/loan" +import { BorrowerInfo, getLoanId, thresholdPrice } from '../src/utils/pool/loan'; import { AuctionInfo, AuctionStatus, getLiquidationAuctionId } from "../src/utils/pool/liquidation" import { BurnInfo, DebtInfo } from "../src/utils/pool/pool" import { getReserveAuctionId } from "../src/utils/pool/reserve-auction" @@ -468,8 +468,8 @@ describe("ERC20Pool assertions", () => { const collateralPledged = BigInt.fromI32(1067) const lup = BigInt.fromString("9529276179422528643") // 9.529276179422528643 * 1e18 const index = BigInt.fromI32(234) - const inflator = BigInt.fromString("1002804000000000000") + const thresholdPrice = amountBorrowed.div(collateralPledged) mockPoolInfoUtilsPoolUpdateCalls(poolAddress, { poolSize: ZERO_BI, @@ -498,7 +498,9 @@ describe("ERC20Pool assertions", () => { const expectedBorrowerInfo = new BorrowerInfo( wdiv(amountBorrowed, inflator), collateralPledged, - BigInt.fromString("8766934085068726351")) + BigInt.fromString("8766934085068726351"), + thresholdPrice + ) mockGetBorrowerInfo(poolAddress, borrower, expectedBorrowerInfo) // mock drawDebt event @@ -597,8 +599,10 @@ describe("ERC20Pool assertions", () => { const quoteRepaid = BigInt.fromString("567111000000000000000") // 567.111 * 1e18 const collateralPulled = BigInt.fromString("13400500000000000000") // 13.4005 * 1e18 const lup = BigInt.fromString("63480000000000000000") // 63.48 * 1e18 + const thresholdPrice = quoteRepaid.div(collateralPulled) - const expectedBorrowerInfo = new BorrowerInfo(quoteRepaid, collateralPulled, BigInt.fromString("501250000000000000")) + // TODO: fix mismatch between using pre-repay and post-repay update returns + const expectedBorrowerInfo = new BorrowerInfo(quoteRepaid, collateralPulled, BigInt.fromString("501250000000000000"), thresholdPrice) mockGetBorrowerInfo(poolAddress, borrower, expectedBorrowerInfo) const newRepayDebtEvent = createRepayDebtEvent( @@ -654,6 +658,7 @@ describe("ERC20Pool assertions", () => { const kickTime = BigInt.fromI32(123) const neutralPrice = BigInt.fromI32(456) const referencePrice = BigInt.fromI32(456) + const thresholdPrice = debt.div(collateral) const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") @@ -665,6 +670,7 @@ describe("ERC20Pool assertions", () => { kickTime, referencePrice, neutralPrice, + thresholdPrice, head, next, prev @@ -676,7 +682,10 @@ describe("ERC20Pool assertions", () => { debt, false, startPrice, - neutralPrice + neutralPrice, + referencePrice, + thresholdPrice, + bondFactor ) mockGetAuctionStatus(poolAddress, borrower, expectedAuctionStatus) @@ -836,6 +845,7 @@ describe("ERC20Pool assertions", () => { const kickTime = BigInt.fromI32(123) const referencePrice = BigInt.fromI32(456) const neutralPrice = BigInt.fromI32(456) + const thresholdPrice = debt.div(collateral) const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") @@ -847,6 +857,7 @@ describe("ERC20Pool assertions", () => { kickTime, referencePrice, neutralPrice, + thresholdPrice, head, next, prev @@ -857,7 +868,9 @@ describe("ERC20Pool assertions", () => { let expectedBorrowerInfo = new BorrowerInfo( wdiv(debt, inflator), collateral, - wdiv(neutralPrice, inflator)) + wdiv(neutralPrice, inflator), + thresholdPrice + ) mockGetBorrowerInfo(poolAddress, borrower, expectedBorrowerInfo) // mock kick event @@ -883,6 +896,7 @@ describe("ERC20Pool assertions", () => { kickTime, referencePrice, neutralPrice, + thresholdPrice, head, next, prev @@ -894,13 +908,18 @@ describe("ERC20Pool assertions", () => { debt, false, wmul(neutralPrice, BigInt.fromString("970000000000000000")), // take price = neutral price * 0.97 - neutralPrice + neutralPrice, + referencePrice, + thresholdPrice, + bondFactor ) mockGetAuctionStatus(poolAddress, borrower, expectedAuctionStatus) expectedBorrowerInfo = new BorrowerInfo( wdiv(debt, inflator), collateral.minus(amountToTake), - wdiv(neutralPrice, inflator)) + wdiv(neutralPrice, inflator), + thresholdPrice + ) mockGetBorrowerInfo(poolAddress, borrower, expectedBorrowerInfo) // mock take event @@ -1024,6 +1043,7 @@ describe("ERC20Pool assertions", () => { const kickTime = BigInt.fromI32(123) const referencePrice = BigInt.fromI32(456) const neutralPrice = BigInt.fromI32(456) + const thresholdPrice = debt.div(collateral) const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") @@ -1034,6 +1054,7 @@ describe("ERC20Pool assertions", () => { kickTime, referencePrice, neutralPrice, + thresholdPrice, head, next, prev @@ -1063,6 +1084,7 @@ describe("ERC20Pool assertions", () => { kickTime, referencePrice, neutralPrice, + thresholdPrice, head, next, prev @@ -1074,7 +1096,10 @@ describe("ERC20Pool assertions", () => { debt, false, wmul(neutralPrice, BigInt.fromString("1020000000000000000")), // take price = neutral price * 1.02 - neutralPrice + neutralPrice, + referencePrice, + thresholdPrice, + bondFactor ) mockGetAuctionStatus(poolAddress, borrower, expectedAuctionStatus) @@ -1216,6 +1241,7 @@ describe("ERC20Pool assertions", () => { const kickTime = BigInt.fromI32(123) const referencePrice = BigInt.fromI32(456) const neutralPrice = BigInt.fromI32(456) + const thresholdPrice = debt.div(collateral) const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") @@ -1226,6 +1252,7 @@ describe("ERC20Pool assertions", () => { kickTime, referencePrice, neutralPrice, + thresholdPrice, head, next, prev diff --git a/tests/erc-721-pool.test.ts b/tests/erc-721-pool.test.ts index 817d70d..66b8666 100644 --- a/tests/erc-721-pool.test.ts +++ b/tests/erc-721-pool.test.ts @@ -20,7 +20,7 @@ import { mockGetAuctionInfo, mockGetAuctionStatus, mockGetBorrowerInfo, mockGetB import { BucketInfo, getBucketId } from "../src/utils/pool/bucket" import { addressToBytes, wadToDecimal } from "../src/utils/convert" import { DebtInfo } from "../src/utils/pool/pool" -import { BorrowerInfo, getLoanId } from "../src/utils/pool/loan" +import { BorrowerInfo, getLoanId, thresholdPrice } from '../src/utils/pool/loan'; import { wdiv, wmul } from "../src/utils/math" import { getLendId } from "../src/utils/pool/lend" import { AuctionInfo, AuctionStatus, getLiquidationAuctionId } from "../src/utils/pool/liquidation" @@ -257,8 +257,8 @@ describe("Describe entity assertions", () => { const amountPledged = BigInt.fromString("2000000000000000000") const lup = BigInt.fromString("9529276179422528643") // 9.529276179422528643 * 1e18 const index = BigInt.fromI32(123) - const inflator = BigInt.fromString("1002804000000000000") + const thresholdPrice = amountBorrowed.div(amountPledged) mockPoolInfoUtilsPoolUpdateCalls(poolAddress, { poolSize: ZERO_BI, @@ -287,7 +287,9 @@ describe("Describe entity assertions", () => { const expectedBorrowerInfo = new BorrowerInfo( wdiv(amountBorrowed, inflator), amountPledged, - BigInt.fromString("8766934085068726351")) + BigInt.fromString("8766934085068726351"), + thresholdPrice + ) mockGetBorrowerInfo(poolAddress, borrower, expectedBorrowerInfo) const newDrawDebtEvent = createDrawDebtNFTEvent( @@ -404,6 +406,7 @@ describe("Describe entity assertions", () => { const tokenIdsPledged = [BigInt.fromI32(234), BigInt.fromI32(345)] const amountPledged = BigInt.fromString("2000000000000000000") let lup = BigInt.fromString("9529276179422528643") // 9.529276179422528643 * 1e18 + const thresholdPrice = amountBorrowed.div(amountPledged) // mock required contract calls const expectedPoolDebtInfo = new DebtInfo(amountBorrowed, ZERO_BI, ZERO_BI, ZERO_BI) @@ -413,7 +416,9 @@ describe("Describe entity assertions", () => { let expectedBorrowerInfo = new BorrowerInfo( wdiv(amountBorrowed, inflator), amountPledged, - BigInt.fromString("8766934085068726351")) + BigInt.fromString("8766934085068726351"), + thresholdPrice + ) mockGetBorrowerInfo(poolAddress, borrower, expectedBorrowerInfo) const newDrawDebtEvent = createDrawDebtNFTEvent( @@ -456,7 +461,7 @@ describe("Describe entity assertions", () => { const quoteRepaid = BigInt.fromString("567111000000000000000") // 567.111 * 1e18 const collateralPulled = BigInt.fromString("1000000000000000000") // 1 * 1e18 - expectedBorrowerInfo = new BorrowerInfo(quoteRepaid, collateralPulled, BigInt.fromString("501250000000000000")) + expectedBorrowerInfo = new BorrowerInfo(quoteRepaid, collateralPulled, BigInt.fromString("501250000000000000"), thresholdPrice) mockGetBorrowerInfo(poolAddress, borrower, expectedBorrowerInfo) const newRepayDebtEvent = createRepayDebtEvent( @@ -759,6 +764,7 @@ describe("Describe entity assertions", () => { const tokenIdsPledged = [BigInt.fromI32(234), BigInt.fromI32(345), BigInt.fromI32(456), BigInt.fromI32(567), BigInt.fromI32(789)] const amountPledged = BigInt.fromString("5000000000000000000") // 5 * 1e18 const lup = BigInt.fromString("9529276179422528643") // 9.529276179422528643 * 1e18 + let thresholdPrice = amountBorrowed.div(amountPledged) // mock required contract calls const expectedPoolDebtInfo = new DebtInfo(amountBorrowed, ZERO_BI, ZERO_BI, ZERO_BI) @@ -768,7 +774,9 @@ describe("Describe entity assertions", () => { let expectedBorrowerInfo = new BorrowerInfo( wdiv(amountBorrowed, inflator), amountPledged, - BigInt.fromString("8766934085068726351")) + BigInt.fromString("8766934085068726351"), + thresholdPrice + ) mockGetBorrowerInfo(poolAddress, borrower, expectedBorrowerInfo) // create and handle DrawDebt event @@ -818,6 +826,7 @@ describe("Describe entity assertions", () => { const kickTime = BigInt.fromI32(123) const referencePrice = BigInt.fromI32(456) const neutralPrice = BigInt.fromI32(456) + thresholdPrice = debt.div(amountPledged) const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") @@ -830,6 +839,7 @@ describe("Describe entity assertions", () => { kickTime, referencePrice, neutralPrice, + thresholdPrice, head, next, prev @@ -842,7 +852,10 @@ describe("Describe entity assertions", () => { debt, false, wmul(neutralPrice, BigInt.fromString("1020000000000000000")), // take price = neutral price * 1.02 - neutralPrice + neutralPrice, + referencePrice, + thresholdPrice, + bondFactor ) mockGetAuctionStatus(poolAddress, borrower, expectedAuctionStatus) @@ -872,7 +885,9 @@ describe("Describe entity assertions", () => { expectedBorrowerInfo = new BorrowerInfo( wdiv(amountBorrowed, inflator), amountPledged.minus(collateralToTake), - BigInt.fromString("8766934085068726351")) + BigInt.fromString("8766934085068726351"), + thresholdPrice + ) mockGetBorrowerInfo(poolAddress, borrower, expectedBorrowerInfo) // create and handle Take event @@ -1152,6 +1167,7 @@ describe("Describe entity assertions", () => { const amountBorrowed = BigInt.fromString("567529276179422528643") // 567.529276179422528643 * 1e18 const tokenIdsPledged = [BigInt.fromI32(234), BigInt.fromI32(345), BigInt.fromI32(456), BigInt.fromI32(567), BigInt.fromI32(789)] const amountPledged = BigInt.fromString("5000000000000000000") // 5 * 1e18 + let thresholdPrice = amountBorrowed.div(amountPledged) // mock required contract calls const expectedPoolDebtInfo = new DebtInfo(amountBorrowed, ZERO_BI, ZERO_BI, ZERO_BI) @@ -1161,7 +1177,9 @@ describe("Describe entity assertions", () => { let expectedBorrowerInfo = new BorrowerInfo( wdiv(amountBorrowed, inflator), amountPledged, - BigInt.fromString("8766934085068726351")) + BigInt.fromString("8766934085068726351"), + thresholdPrice + ) mockGetBorrowerInfo(poolAddress, borrower, expectedBorrowerInfo) // create and handle DrawDebt event @@ -1211,6 +1229,7 @@ describe("Describe entity assertions", () => { const kickTime = BigInt.fromI32(123) const referencePrice = BigInt.fromI32(456) const neutralPrice = BigInt.fromI32(456) + thresholdPrice = debt.div(amountPledged) const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") @@ -1223,6 +1242,7 @@ describe("Describe entity assertions", () => { kickTime, referencePrice, neutralPrice, + thresholdPrice, head, next, prev @@ -1235,7 +1255,10 @@ describe("Describe entity assertions", () => { debt, false, wmul(neutralPrice, BigInt.fromString("1020000000000000000")), // take price = neutral price * 1.02 - neutralPrice + neutralPrice, + referencePrice, + thresholdPrice, + bondFactor ) mockGetAuctionStatus(poolAddress, borrower, expectedAuctionStatus) @@ -1296,7 +1319,9 @@ describe("Describe entity assertions", () => { expectedBorrowerInfo = new BorrowerInfo( wdiv(amountBorrowed, inflator), amountPledged.minus(collateralToTake), - BigInt.fromString("8766934085068726351")) + BigInt.fromString("8766934085068726351"), + thresholdPrice + ) mockGetBorrowerInfo(poolAddress, borrower, expectedBorrowerInfo) // mock bucket take event diff --git a/tests/utils/mock-contract-calls.ts b/tests/utils/mock-contract-calls.ts index 25375ce..8d2dcb2 100644 --- a/tests/utils/mock-contract-calls.ts +++ b/tests/utils/mock-contract-calls.ts @@ -5,7 +5,7 @@ import { BucketInfo } from "../../src/utils/pool/bucket" import { positionManagerAddressTable, poolInfoUtilsAddressTable, ZERO_BI, ONE_BI, poolInfoUtilsMulticallAddressTable } from '../../src/utils/constants'; import { BurnInfo, DebtInfo, LoansInfo, PoolPricesInfo, PoolUtilizationInfo, ReservesInfo, PoolDetails, RatesAndFees, PoolBalanceDetails, depositUpToIndex } from '../../src/utils/pool/pool'; import { AuctionInfo, AuctionStatus } from "../../src/utils/pool/liquidation" -import { BorrowerInfo } from "../../src/utils/pool/loan" +import { BorrowerInfo } from '../../src/utils/pool/loan'; import { wdiv, wmin, wmul } from "../../src/utils/math" import { addressToBytes, decimalToWad } from "../../src/utils/convert" import { Pool } from "../../generated/schema" @@ -137,12 +137,13 @@ export function mockGetPositionInfo(tokenId: BigInt, bucketIndex: BigInt, expect /***************************/ export function mockGetBorrowerInfo(pool: Address, borrower: Address, expectedInfo: BorrowerInfo): void { - createMockedFunction(pool, 'borrowerInfo', 'borrowerInfo(address):(uint256,uint256,uint256)') - .withArgs([ethereum.Value.fromAddress(borrower)]) + createMockedFunction(poolInfoUtilsAddressTable.get(dataSource.network())!, 'borrowerInfo', 'borrowerInfo(address,address):(uint256,uint256,uint256,uint256)') + .withArgs([ethereum.Value.fromAddress(pool), ethereum.Value.fromAddress(borrower)]) .returns([ ethereum.Value.fromUnsignedBigInt(expectedInfo.t0debt), ethereum.Value.fromUnsignedBigInt(expectedInfo.collateral), - ethereum.Value.fromUnsignedBigInt(expectedInfo.t0Np) + ethereum.Value.fromUnsignedBigInt(expectedInfo.t0Np), + ethereum.Value.fromUnsignedBigInt(expectedInfo.thresholdPrice) ]) } @@ -326,7 +327,7 @@ export function mockGetPoolBalanceDetails(pool: Address, meaningfulIndex: BigInt // mock auctionInfo contract calls export function mockGetAuctionInfo(borrower: Address, pool: Address, expectedInfo: AuctionInfo): void { - createMockedFunction(pool, 'auctionInfo', 'auctionInfo(address):(address,uint256,uint256,uint256,uint256,uint256,address,address,address)') + createMockedFunction(pool, 'auctionInfo', 'auctionInfo(address):(address,uint256,uint256,uint256,uint256,uint256,uint256,address,address,address)') .withArgs([ethereum.Value.fromAddress(borrower)]) .returns([ ethereum.Value.fromAddress(expectedInfo.kicker), @@ -335,6 +336,7 @@ export function mockGetAuctionInfo(borrower: Address, pool: Address, expectedInf ethereum.Value.fromUnsignedBigInt(expectedInfo.kickTime), ethereum.Value.fromUnsignedBigInt(expectedInfo.referencePrice), ethereum.Value.fromUnsignedBigInt(expectedInfo.neutralPrice), + ethereum.Value.fromUnsignedBigInt(expectedInfo.thresholdPrice), ethereum.Value.fromAddress(expectedInfo.head), ethereum.Value.fromAddress(expectedInfo.next), ethereum.Value.fromAddress(expectedInfo.prev) @@ -344,15 +346,18 @@ export function mockGetAuctionInfo(borrower: Address, pool: Address, expectedInf // mock auctionStatus poolInfoUtils calls export function mockGetAuctionStatus(pool: Address, borrower: Address, expectedInfo: AuctionStatus): void { createMockedFunction(poolInfoUtilsAddressTable.get(dataSource.network())!, - 'auctionStatus', 'auctionStatus(address,address):(uint256,uint256,uint256,bool,uint256,uint256)') + 'auctionStatus', 'auctionStatus(address,address):(uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256)') .withArgs([ethereum.Value.fromAddress(pool), ethereum.Value.fromAddress(borrower)]) .returns([ - ethereum.Value.fromUnsignedBigInt(expectedInfo.kickTime), - ethereum.Value.fromUnsignedBigInt(expectedInfo.collateral), - ethereum.Value.fromUnsignedBigInt(expectedInfo.debtToCover), - ethereum.Value.fromBoolean(expectedInfo.isCollateralized), - ethereum.Value.fromUnsignedBigInt(expectedInfo.price), - ethereum.Value.fromUnsignedBigInt(expectedInfo.neutralPrice) + ethereum.Value.fromUnsignedBigInt(expectedInfo.kickTime), + ethereum.Value.fromUnsignedBigInt(expectedInfo.collateral), + ethereum.Value.fromUnsignedBigInt(expectedInfo.debtToCover), + ethereum.Value.fromBoolean(expectedInfo.isCollateralized), + ethereum.Value.fromUnsignedBigInt(expectedInfo.price), + ethereum.Value.fromUnsignedBigInt(expectedInfo.neutralPrice), + ethereum.Value.fromUnsignedBigInt(expectedInfo.referencePrice), + ethereum.Value.fromUnsignedBigInt(expectedInfo.thresholdPrice), + ethereum.Value.fromUnsignedBigInt(expectedInfo.bondFactor) ]) } From c6fadf71367727322d791caec40e120690fa21ad Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Wed, 20 Dec 2023 15:29:29 -0500 Subject: [PATCH 18/19] updated goerli and base addresses --- networks.json | 38 ++++++++++++++++++++++++++++++++------ src/utils/constants.ts | 9 ++++++--- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/networks.json b/networks.json index aeb3854..0e3cca8 100644 --- a/networks.json +++ b/networks.json @@ -51,18 +51,44 @@ "startBlock": 46312499 } }, + "base": { + "ERC20PoolFactory": { + "address": "0xdc01502485c02496a929c12762cE99Fd755c6a25", + "startBlock": 8156311 + }, + "ERC721PoolFactory": { + "address": "0x513cc6E8De2FC3c7532d867fc6c287ABb56df230", + "startBlock": 8156311 + }, + "PositionManager": { + "address": "0x72Ce601AecE3C46eF2b7C85712E05d7c0f29A364", + "startBlock": 8156311 + }, + "GrantFund": { + "address": "0x0000000000000000000000000000000000000000", + "startBlock": 8156311 + }, + "AjnaToken": { + "address": "0xf0f326af3b1Ed943ab95C29470730CC8Cf66ae47", + "startBlock": 3055193 + }, + "BurnWrappedAjna": { + "address": "0x0000000000000000000000000000000000000000", + "startBlock": 3055193 + } + }, "goerli": { "ERC20PoolFactory": { - "address": "0x14F2474fB5ea9DF82059053c4F85A8C803Ab10C9", - "startBlock": 9888337 + "address": "0xA2d6694F24c84e428B97bF9fCD8E3e3dba3023D0", + "startBlock": 10243942 }, "ERC721PoolFactory": { - "address": "0xb0d1c875B240EE9f6C2c3284a31b10f1EC6De7d2", - "startBlock": 9888337 + "address": "0x0CC0Ba1bC6f45513422D6BF301Bd1Cb8c78B5861", + "startBlock": 10243942 }, "PositionManager": { - "address": "0xC4114D90F51960854ab574297Cf7CC131d445F29", - "startBlock": 9888337 + "address": "0x20BE7129B4126dC39aadBfA4C3360b52313a660D", + "startBlock": 10243942 }, "GrantFund": { "address": "0x17C7eb98aD29c8C07C2842C4B64342142C405aF4", diff --git a/src/utils/constants.ts b/src/utils/constants.ts index f3b72a0..72e8fc0 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -31,14 +31,17 @@ export const MAX_BUCKET_INDEX = 4156; export const poolInfoUtilsAddressTable = new TypedMap() poolInfoUtilsAddressTable.set('mainnet', Address.fromString('0x154FFf344f426F99E328bacf70f4Eb632210ecdc')) poolInfoUtilsAddressTable.set('matic', Address.fromString('0xA9Ada58DD3c820b30D3bf5B490226F2ef92107bA')) -poolInfoUtilsAddressTable.set('goerli', Address.fromString('0x08F304cBeA7FAF48C93C27ae1305E220913a571d')) +poolInfoUtilsAddressTable.set('base', Address.fromString('0xC086acc9Bf89D8a0E2209e2870fC020D8f3323a8')) +poolInfoUtilsAddressTable.set('goerli', Address.fromString('0x3c5cf15122903C7CabcAA49FcfC090D3A311C038')) poolInfoUtilsAddressTable.set('mumbai', Address.fromString('0x39250241CC84Dadb1cDFE3A1a717631e2aA603eB')) poolInfoUtilsAddressTable.set('ganache', Address.fromString('0xab56A77bDFe82b36875e92CE717fE533C1709A9D')) export const poolInfoUtilsMulticallAddressTable = new TypedMap() -poolInfoUtilsMulticallAddressTable.set('goerli', Address.fromString('0xc0374Fd9d3824C6ad9866df4043469CE6fe45d8D')) +poolInfoUtilsMulticallAddressTable.set('base', Address.fromString('0x83bC7AE84B469Fa4c86a91BA8A82D253c0858e13')) +poolInfoUtilsMulticallAddressTable.set('goerli', Address.fromString('0xE1a73054BA68f31F029bC6D452DF786D900b3Ed0')) poolInfoUtilsMulticallAddressTable.set('ganache', Address.fromString('0x1d00b2f5861457F8503a481774903E36872Ea17d')) export const positionManagerAddressTable = new TypedMap() -positionManagerAddressTable.set('goerli', Address.fromString('0xC4114D90F51960854ab574297Cf7CC131d445F29')) +positionManagerAddressTable.set('base', Address.fromString('0x72Ce601AecE3C46eF2b7C85712E05d7c0f29A364')) +positionManagerAddressTable.set('goerli', Address.fromString('0x20BE7129B4126dC39aadBfA4C3360b52313a660D')) positionManagerAddressTable.set('ganache', Address.fromString('0x502dD41556B128C23F8B715dBEEBB73D1F1Feb67')) // GrantFund constants From 41288b1f6d895ab1b0352e497b0346ff4ceddfbc Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Wed, 20 Dec 2023 16:23:02 -0500 Subject: [PATCH 19/19] update ABIs --- abis/AjnaToken.json | 638 ++++++++-------- abis/GrantFund.json | 1114 ++++++++++++++-------------- abis/PoolInfoUtils.json | 57 +- abis/PoolInfoUtilsMulticall.json | 268 +++---- src/utils/pool/pool.ts | 4 +- tests/utils/mock-contract-calls.ts | 2 +- 6 files changed, 1039 insertions(+), 1044 deletions(-) diff --git a/abis/AjnaToken.json b/abis/AjnaToken.json index b23d1e4..e64354f 100644 --- a/abis/AjnaToken.json +++ b/abis/AjnaToken.json @@ -1,674 +1,674 @@ [ { + "type": "constructor", "inputs": [ { - "internalType": "address", "name": "tokenReceiver_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "nonpayable", - "type": "constructor" + "stateMutability": "nonpayable" }, { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "fromDelegate", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "toDelegate", - "type": "address" - } - ], - "name": "DelegateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegate", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "previousBalance", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newBalance", - "type": "uint256" - } - ], - "name": "DelegateVotesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], + "type": "function", "name": "DOMAIN_SEPARATOR", + "inputs": [], "outputs": [ { - "internalType": "bytes32", "name": "", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "allowance", "inputs": [ { - "internalType": "address", "name": "owner", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "spender", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "allowance", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "approve", "inputs": [ { - "internalType": "address", "name": "spender", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "amount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "approve", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "balanceOf", "inputs": [ { - "internalType": "address", "name": "account", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "balanceOf", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "burn", "inputs": [ { - "internalType": "uint256", "name": "amount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "burn", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "burnFrom", "inputs": [ { - "internalType": "address", "name": "account", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "amount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "burnFrom", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "checkpoints", "inputs": [ { - "internalType": "address", "name": "account", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint32", "name": "pos", - "type": "uint32" + "type": "uint32", + "internalType": "uint32" } ], - "name": "checkpoints", "outputs": [ { + "name": "", + "type": "tuple", + "internalType": "struct ERC20Votes.Checkpoint", "components": [ { - "internalType": "uint32", "name": "fromBlock", - "type": "uint32" + "type": "uint32", + "internalType": "uint32" }, { - "internalType": "uint224", "name": "votes", - "type": "uint224" + "type": "uint224", + "internalType": "uint224" } - ], - "internalType": "struct ERC20Votes.Checkpoint", - "name": "", - "type": "tuple" + ] } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "decimals", + "inputs": [], "outputs": [ { - "internalType": "uint8", "name": "", - "type": "uint8" + "type": "uint8", + "internalType": "uint8" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "decreaseAllowance", "inputs": [ { - "internalType": "address", "name": "spender", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "subtractedValue", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "decreaseAllowance", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "delegate", "inputs": [ { - "internalType": "address", "name": "delegatee", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "delegate", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "delegateBySig", "inputs": [ { - "internalType": "address", "name": "delegatee", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "nonce", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "expiry", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint8", "name": "v", - "type": "uint8" + "type": "uint8", + "internalType": "uint8" }, { - "internalType": "bytes32", "name": "r", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" }, { - "internalType": "bytes32", "name": "s", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "name": "delegateBySig", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "delegates", "inputs": [ { - "internalType": "address", "name": "account", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "delegates", "outputs": [ { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getPastTotalSupply", "inputs": [ { - "internalType": "uint256", "name": "blockNumber", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "getPastTotalSupply", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getPastVotes", "inputs": [ { - "internalType": "address", "name": "account", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "blockNumber", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "getPastVotes", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getVotes", "inputs": [ { - "internalType": "address", "name": "account", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "getVotes", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "increaseAllowance", "inputs": [ { - "internalType": "address", "name": "spender", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "addedValue", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "increaseAllowance", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { - "inputs": [], + "type": "function", "name": "name", + "inputs": [], "outputs": [ { - "internalType": "string", "name": "", - "type": "string" + "type": "string", + "internalType": "string" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "nonces", "inputs": [ { - "internalType": "address", "name": "owner", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "nonces", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "numCheckpoints", "inputs": [ { - "internalType": "address", "name": "account", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "numCheckpoints", "outputs": [ { - "internalType": "uint32", "name": "", - "type": "uint32" + "type": "uint32", + "internalType": "uint32" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "permit", "inputs": [ { - "internalType": "address", "name": "owner", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "spender", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "value", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "deadline", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint8", "name": "v", - "type": "uint8" + "type": "uint8", + "internalType": "uint8" }, { - "internalType": "bytes32", "name": "r", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" }, { - "internalType": "bytes32", "name": "s", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "name": "permit", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { - "inputs": [], + "type": "function", "name": "symbol", + "inputs": [], "outputs": [ { - "internalType": "string", "name": "", - "type": "string" + "type": "string", + "internalType": "string" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "totalSupply", + "inputs": [], "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "transfer", "inputs": [ { - "internalType": "address", "name": "to", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "amount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "transfer", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "transferFrom", "inputs": [ { - "internalType": "address", "name": "from", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "to", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "amount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "transferFrom", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "transferFromWithPermit", "inputs": [ { - "internalType": "address", "name": "from_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "to_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "spender_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "value_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "deadline_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint8", "name": "v_", - "type": "uint8" + "type": "uint8", + "internalType": "uint8" }, { - "internalType": "bytes32", "name": "r_", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" }, { - "internalType": "bytes32", "name": "s_", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "name": "transferFromWithPermit", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "Approval", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "spender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "value", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DelegateChanged", + "inputs": [ + { + "name": "delegator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "fromDelegate", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "toDelegate", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DelegateVotesChanged", + "inputs": [ + { + "name": "delegate", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "previousBalance", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "newBalance", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Transfer", + "inputs": [ + { + "name": "from", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "value", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false } ] diff --git a/abis/GrantFund.json b/abis/GrantFund.json index ba6636f..3968b4e 100644 --- a/abis/GrantFund.json +++ b/abis/GrantFund.json @@ -1,1031 +1,1031 @@ [ { + "type": "constructor", "inputs": [ { - "internalType": "address", "name": "ajnaToken_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "DelegateRewardInvalid", - "type": "error" - }, - { - "inputs": [], - "name": "DistributionPeriodStillActive", - "type": "error" - }, - { - "inputs": [], - "name": "ExecuteProposalInvalid", - "type": "error" - }, - { - "inputs": [], - "name": "FundingVoteWrongDirection", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientRemainingVotingPower", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientVotingPower", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidProposal", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidProposalSlate", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidVote", - "type": "error" - }, - { - "inputs": [], - "name": "ProposalAlreadyExists", - "type": "error" - }, - { - "inputs": [], - "name": "ProposalNotSuccessful", - "type": "error" - }, - { - "inputs": [], - "name": "RewardAlreadyClaimed", - "type": "error" - }, - { - "inputs": [], - "name": "ScreeningPeriodEnded", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegateeAddress", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "distributionId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "rewardClaimed", - "type": "uint256" - } - ], - "name": "DelegateRewardClaimed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "distributionId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "startBlock", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "endBlock", - "type": "uint256" - } - ], - "name": "DistributionPeriodStarted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "treasuryBalance", - "type": "uint256" - } - ], - "name": "FundTreasury", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "distributionId", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "fundedSlateHash", - "type": "bytes32" - } - ], - "name": "FundedSlateUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "proposer", - "type": "address" - }, - { - "indexed": false, - "internalType": "address[]", - "name": "targets", - "type": "address[]" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "string[]", - "name": "signatures", - "type": "string[]" - }, - { - "indexed": false, - "internalType": "bytes[]", - "name": "calldatas", - "type": "bytes[]" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "startBlock", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "endBlock", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "string", - "name": "description", - "type": "string" - } - ], - "name": "ProposalCreated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - } - ], - "name": "ProposalExecuted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "voter", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "support", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "weight", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - } - ], - "name": "VoteCast", - "type": "event" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "_voterInfo", "inputs": [ { - "internalType": "uint256", "name": "distributionId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "address", "name": "voter", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "_voterInfo", "outputs": [ { - "internalType": "uint128", "name": "fundingVotingPower", - "type": "uint128" + "type": "uint128", + "internalType": "uint128" }, { - "internalType": "uint128", "name": "fundingRemainingVotingPower", - "type": "uint128" + "type": "uint128", + "internalType": "uint128" }, { - "internalType": "uint248", "name": "screeningVotesCast", - "type": "uint248" + "type": "uint248", + "internalType": "uint248" }, { - "internalType": "bool", "name": "hasClaimedReward", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "ajnaTokenAddress", + "inputs": [], "outputs": [ { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "claimDelegateReward", "inputs": [ { - "internalType": "uint24", "name": "distributionId_", - "type": "uint24" + "type": "uint24", + "internalType": "uint24" } ], - "name": "claimDelegateReward", "outputs": [ { - "internalType": "uint256", "name": "rewardClaimed_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "execute", "inputs": [ { - "internalType": "address[]", "name": "targets_", - "type": "address[]" + "type": "address[]", + "internalType": "address[]" }, { - "internalType": "uint256[]", "name": "values_", - "type": "uint256[]" + "type": "uint256[]", + "internalType": "uint256[]" }, { - "internalType": "bytes[]", "name": "calldatas_", - "type": "bytes[]" + "type": "bytes[]", + "internalType": "bytes[]" }, { - "internalType": "bytes32", "name": "descriptionHash_", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "name": "execute", "outputs": [ { - "internalType": "uint256", "name": "proposalId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "fundTreasury", "inputs": [ { - "internalType": "uint256", "name": "fundingAmount_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "fundTreasury", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "fundingVote", "inputs": [ { + "name": "voteParams_", + "type": "tuple[]", + "internalType": "struct IGrantFundState.FundingVoteParams[]", "components": [ { - "internalType": "uint256", "name": "proposalId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "int256", "name": "votesUsed", - "type": "int256" + "type": "int256", + "internalType": "int256" } - ], - "internalType": "struct IGrantFundState.FundingVoteParams[]", - "name": "voteParams_", - "type": "tuple[]" + ] } ], - "name": "fundingVote", "outputs": [ { - "internalType": "uint256", "name": "votesCast_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "getChallengeStageStartBlock", "inputs": [ { - "internalType": "uint256", "name": "endBlock_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "getChallengeStageStartBlock", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "pure", - "type": "function" + "stateMutability": "pure" }, { + "type": "function", + "name": "getDelegateReward", "inputs": [ { - "internalType": "uint24", "name": "distributionId_", - "type": "uint24" + "type": "uint24", + "internalType": "uint24" }, { - "internalType": "address", "name": "voter_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "getDelegateReward", "outputs": [ { - "internalType": "uint256", "name": "rewards_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getDescriptionHash", "inputs": [ { - "internalType": "string", "name": "description_", - "type": "string" + "type": "string", + "internalType": "string" } ], - "name": "getDescriptionHash", "outputs": [ { - "internalType": "bytes32", "name": "", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "stateMutability": "pure", - "type": "function" + "stateMutability": "pure" }, { - "inputs": [], + "type": "function", "name": "getDistributionId", + "inputs": [], "outputs": [ { - "internalType": "uint24", "name": "", - "type": "uint24" + "type": "uint24", + "internalType": "uint24" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getDistributionPeriodInfo", "inputs": [ { - "internalType": "uint24", "name": "distributionId_", - "type": "uint24" + "type": "uint24", + "internalType": "uint24" } ], - "name": "getDistributionPeriodInfo", "outputs": [ { - "internalType": "uint24", "name": "", - "type": "uint24" + "type": "uint24", + "internalType": "uint24" }, { - "internalType": "uint48", "name": "", - "type": "uint48" + "type": "uint48", + "internalType": "uint48" }, { - "internalType": "uint48", "name": "", - "type": "uint48" + "type": "uint48", + "internalType": "uint48" }, { - "internalType": "uint128", "name": "", - "type": "uint128" + "type": "uint128", + "internalType": "uint128" }, { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "bytes32", "name": "", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getFundedProposalSlate", "inputs": [ { - "internalType": "bytes32", "name": "slateHash_", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "name": "getFundedProposalSlate", "outputs": [ { - "internalType": "uint256[]", "name": "", - "type": "uint256[]" + "type": "uint256[]", + "internalType": "uint256[]" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getFundingStageEndBlock", "inputs": [ { - "internalType": "uint256", "name": "startBlock_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "getFundingStageEndBlock", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "pure", - "type": "function" + "stateMutability": "pure" }, { + "type": "function", + "name": "getFundingVotesCast", "inputs": [ { - "internalType": "uint24", "name": "distributionId_", - "type": "uint24" + "type": "uint24", + "internalType": "uint24" }, { - "internalType": "address", "name": "account_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "getFundingVotesCast", "outputs": [ { + "name": "", + "type": "tuple[]", + "internalType": "struct IGrantFundState.FundingVoteParams[]", "components": [ { - "internalType": "uint256", "name": "proposalId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "int256", "name": "votesUsed", - "type": "int256" + "type": "int256", + "internalType": "int256" } - ], - "internalType": "struct IGrantFundState.FundingVoteParams[]", - "name": "", - "type": "tuple[]" + ] } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getHasClaimedRewards", "inputs": [ { - "internalType": "uint256", "name": "distributionId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "address", "name": "account_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "getHasClaimedRewards", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getProposalInfo", "inputs": [ { - "internalType": "uint256", "name": "proposalId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "getProposalInfo", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint24", "name": "", - "type": "uint24" + "type": "uint24", + "internalType": "uint24" }, { - "internalType": "uint128", "name": "", - "type": "uint128" + "type": "uint128", + "internalType": "uint128" }, { - "internalType": "uint128", "name": "", - "type": "uint128" + "type": "uint128", + "internalType": "uint128" }, { - "internalType": "int128", "name": "", - "type": "int128" + "type": "int128", + "internalType": "int128" }, { - "internalType": "bool", "name": "", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getScreeningStageEndBlock", "inputs": [ { - "internalType": "uint256", "name": "startBlock_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "getScreeningStageEndBlock", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "pure", - "type": "function" + "stateMutability": "pure" }, { + "type": "function", + "name": "getScreeningVotesCast", "inputs": [ { - "internalType": "uint256", "name": "distributionId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "address", "name": "account_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "getScreeningVotesCast", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getSlateHash", "inputs": [ { - "internalType": "uint256[]", "name": "proposalIds_", - "type": "uint256[]" + "type": "uint256[]", + "internalType": "uint256[]" } ], - "name": "getSlateHash", "outputs": [ { - "internalType": "bytes32", "name": "", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "stateMutability": "pure", - "type": "function" + "stateMutability": "pure" }, { - "inputs": [], + "type": "function", "name": "getStage", + "inputs": [], "outputs": [ { - "internalType": "bytes32", "name": "stage_", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getTopTenProposals", "inputs": [ { - "internalType": "uint24", "name": "distributionId_", - "type": "uint24" + "type": "uint24", + "internalType": "uint24" } ], - "name": "getTopTenProposals", "outputs": [ { - "internalType": "uint256[]", "name": "", - "type": "uint256[]" + "type": "uint256[]", + "internalType": "uint256[]" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getVoterInfo", "inputs": [ { - "internalType": "uint24", "name": "distributionId_", - "type": "uint24" + "type": "uint24", + "internalType": "uint24" }, { - "internalType": "address", "name": "account_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "getVoterInfo", "outputs": [ { - "internalType": "uint128", "name": "", - "type": "uint128" + "type": "uint128", + "internalType": "uint128" }, { - "internalType": "uint128", "name": "", - "type": "uint128" + "type": "uint128", + "internalType": "uint128" }, { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getVotesFunding", "inputs": [ { - "internalType": "uint24", "name": "distributionId_", - "type": "uint24" + "type": "uint24", + "internalType": "uint24" }, { - "internalType": "address", "name": "account_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "getVotesFunding", "outputs": [ { - "internalType": "uint256", "name": "votes_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getVotesScreening", "inputs": [ { - "internalType": "uint24", "name": "distributionId_", - "type": "uint24" + "type": "uint24", + "internalType": "uint24" }, { - "internalType": "address", "name": "account_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "getVotesScreening", "outputs": [ { - "internalType": "uint256", "name": "votes_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "hashProposal", "inputs": [ { - "internalType": "address[]", "name": "targets_", - "type": "address[]" + "type": "address[]", + "internalType": "address[]" }, { - "internalType": "uint256[]", "name": "values_", - "type": "uint256[]" + "type": "uint256[]", + "internalType": "uint256[]" }, { - "internalType": "bytes[]", "name": "calldatas_", - "type": "bytes[]" + "type": "bytes[]", + "internalType": "bytes[]" }, { - "internalType": "bytes32", "name": "descriptionHash_", - "type": "bytes32" + "type": "bytes32", + "internalType": "bytes32" } ], - "name": "hashProposal", "outputs": [ { - "internalType": "uint256", "name": "proposalId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "pure", - "type": "function" + "stateMutability": "pure" }, { + "type": "function", + "name": "propose", "inputs": [ { - "internalType": "address[]", "name": "targets_", - "type": "address[]" + "type": "address[]", + "internalType": "address[]" }, { - "internalType": "uint256[]", "name": "values_", - "type": "uint256[]" + "type": "uint256[]", + "internalType": "uint256[]" }, { - "internalType": "bytes[]", "name": "calldatas_", - "type": "bytes[]" + "type": "bytes[]", + "internalType": "bytes[]" }, { - "internalType": "string", "name": "description_", - "type": "string" + "type": "string", + "internalType": "string" } ], - "name": "propose", "outputs": [ { - "internalType": "uint256", "name": "proposalId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "screeningVote", "inputs": [ { + "name": "voteParams_", + "type": "tuple[]", + "internalType": "struct IGrantFundState.ScreeningVoteParams[]", "components": [ { - "internalType": "uint256", "name": "proposalId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "votes", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } - ], - "internalType": "struct IGrantFundState.ScreeningVoteParams[]", - "name": "voteParams_", - "type": "tuple[]" + ] } ], - "name": "screeningVote", "outputs": [ { - "internalType": "uint256", "name": "votesCast_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { - "inputs": [], + "type": "function", "name": "startNewDistributionPeriod", + "inputs": [], "outputs": [ { - "internalType": "uint24", "name": "newDistributionId_", - "type": "uint24" + "type": "uint24", + "internalType": "uint24" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "state", "inputs": [ { - "internalType": "uint256", "name": "proposalId_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "name": "state", "outputs": [ { - "internalType": "enum IGrantFundState.ProposalState", "name": "", - "type": "uint8" + "type": "uint8", + "internalType": "enum IGrantFundState.ProposalState" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "treasury", + "inputs": [], "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "updateSlate", "inputs": [ { - "internalType": "uint256[]", "name": "proposalIds_", - "type": "uint256[]" + "type": "uint256[]", + "internalType": "uint256[]" }, { - "internalType": "uint24", "name": "distributionId_", - "type": "uint24" + "type": "uint24", + "internalType": "uint24" } ], - "name": "updateSlate", "outputs": [ { - "internalType": "bool", "name": "newTopSlate_", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "DelegateRewardClaimed", + "inputs": [ + { + "name": "delegateeAddress", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "distributionId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "rewardClaimed", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DistributionPeriodStarted", + "inputs": [ + { + "name": "distributionId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "startBlock", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "endBlock", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "FundTreasury", + "inputs": [ + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "treasuryBalance", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "FundedSlateUpdated", + "inputs": [ + { + "name": "distributionId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "fundedSlateHash", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProposalCreated", + "inputs": [ + { + "name": "proposalId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "proposer", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "targets", + "type": "address[]", + "indexed": false, + "internalType": "address[]" + }, + { + "name": "values", + "type": "uint256[]", + "indexed": false, + "internalType": "uint256[]" + }, + { + "name": "signatures", + "type": "string[]", + "indexed": false, + "internalType": "string[]" + }, + { + "name": "calldatas", + "type": "bytes[]", + "indexed": false, + "internalType": "bytes[]" + }, + { + "name": "startBlock", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "endBlock", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "description", + "type": "string", + "indexed": false, + "internalType": "string" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProposalExecuted", + "inputs": [ + { + "name": "proposalId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "VoteCast", + "inputs": [ + { + "name": "voter", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "proposalId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "support", + "type": "uint8", + "indexed": false, + "internalType": "uint8" + }, + { + "name": "weight", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "reason", + "type": "string", + "indexed": false, + "internalType": "string" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "DelegateRewardInvalid", + "inputs": [] + }, + { + "type": "error", + "name": "DistributionPeriodStillActive", + "inputs": [] + }, + { + "type": "error", + "name": "ExecuteProposalInvalid", + "inputs": [] + }, + { + "type": "error", + "name": "FundingVoteWrongDirection", + "inputs": [] + }, + { + "type": "error", + "name": "InsufficientRemainingVotingPower", + "inputs": [] + }, + { + "type": "error", + "name": "InsufficientVotingPower", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidProposal", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidProposalSlate", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidVote", + "inputs": [] + }, + { + "type": "error", + "name": "ProposalAlreadyExists", + "inputs": [] + }, + { + "type": "error", + "name": "ProposalNotSuccessful", + "inputs": [] + }, + { + "type": "error", + "name": "RewardAlreadyClaimed", + "inputs": [] + }, + { + "type": "error", + "name": "ScreeningPeriodEnded", + "inputs": [] } ] diff --git a/abis/PoolInfoUtils.json b/abis/PoolInfoUtils.json index f3c9baf..4d69e1c 100644 --- a/abis/PoolInfoUtils.json +++ b/abis/PoolInfoUtils.json @@ -258,6 +258,25 @@ ], "stateMutability": "view" }, + { + "type": "function", + "name": "depositFeeRate", + "inputs": [ + { + "name": "ajnaPool_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, { "type": "function", "name": "hpb", @@ -449,6 +468,25 @@ ], "stateMutability": "view" }, + { + "type": "function", + "name": "multicall", + "inputs": [ + { + "name": "data", + "type": "bytes[]", + "internalType": "bytes[]" + } + ], + "outputs": [ + { + "name": "results", + "type": "bytes[]", + "internalType": "bytes[]" + } + ], + "stateMutability": "nonpayable" + }, { "type": "function", "name": "poolLoansInfo", @@ -624,25 +662,6 @@ ], "stateMutability": "pure" }, - { - "type": "function", - "name": "unutilizedDepositFeeRate", - "inputs": [ - { - "name": "ajnaPool_", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, { "type": "error", "name": "BucketIndexOutOfBounds", diff --git a/abis/PoolInfoUtilsMulticall.json b/abis/PoolInfoUtilsMulticall.json index 3ba3b1a..c8466a8 100644 --- a/abis/PoolInfoUtilsMulticall.json +++ b/abis/PoolInfoUtilsMulticall.json @@ -1,319 +1,295 @@ [ { + "type": "constructor", "inputs": [ { - "internalType": "contract PoolInfoUtils", "name": "poolInfoUtils_", - "type": "address" + "type": "address", + "internalType": "contract PoolInfoUtils" } ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "string[]", - "name": "functionSignatures_", - "type": "string[]" - }, - { - "internalType": "string[]", - "name": "args_", - "type": "string[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results_", - "type": "bytes[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "poolBalanceDetails", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "index_", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "address", "name": "quoteTokenAddress_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "collateralTokenAddress_", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "bool", "name": "isNFT_", - "type": "bool" + "type": "bool", + "internalType": "bool" } ], - "name": "poolBalanceDetails", "outputs": [ { + "name": "poolBalanceDetails_", + "type": "tuple", + "internalType": "struct PoolInfoUtilsMulticall.PoolBalanceDetails", "components": [ { - "internalType": "uint256", "name": "debt", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "accruedDebt", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "debtInAuction", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "t0Debt2ToCollateral", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "depositUpToIndex", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "quoteTokenBalance", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "collateralTokenBalance", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } - ], - "internalType": "struct PoolInfoUtilsMulticall.PoolBalanceDetails", - "name": "poolBalanceDetails_", - "type": "tuple" + ] } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "poolDetailsMulticall", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "poolDetailsMulticall", "outputs": [ { + "name": "poolLoansInfo_", + "type": "tuple", + "internalType": "struct PoolInfoUtilsMulticall.PoolLoansInfo", "components": [ { - "internalType": "uint256", "name": "poolSize", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "loansCount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "address", "name": "maxBorrower", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "pendingInflator", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "pendingInterestFactor", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } - ], - "internalType": "struct PoolInfoUtilsMulticall.PoolLoansInfo", - "name": "poolLoansInfo_", - "type": "tuple" + ] }, { + "name": "poolPriceInfo_", + "type": "tuple", + "internalType": "struct PoolInfoUtilsMulticall.PoolPriceInfo", "components": [ { - "internalType": "uint256", "name": "hpb", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "hpbIndex", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "htp", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "htpIndex", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "lup", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "lupIndex", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } - ], - "internalType": "struct PoolInfoUtilsMulticall.PoolPriceInfo", - "name": "poolPriceInfo_", - "type": "tuple" + ] }, { + "name": "poolRatesAndFees_", + "type": "tuple", + "internalType": "struct PoolInfoUtilsMulticall.PoolRatesAndFees", "components": [ { - "internalType": "uint256", "name": "lenderInterestMargin", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "borrowFeeRate", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "depositFeeRate", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } - ], - "internalType": "struct PoolInfoUtilsMulticall.PoolRatesAndFees", - "name": "poolRatesAndFees_", - "type": "tuple" + ] }, { + "name": "poolReservesInfo_", + "type": "tuple", + "internalType": "struct PoolInfoUtilsMulticall.PoolReservesInfo", "components": [ { - "internalType": "uint256", "name": "reserves", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "claimableReserves", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "claimableReservesRemaining", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "auctionPrice", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "timeRemaining", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } - ], - "internalType": "struct PoolInfoUtilsMulticall.PoolReservesInfo", - "name": "poolReservesInfo_", - "type": "tuple" + ] }, { + "name": "poolUtilizationInfo_", + "type": "tuple", + "internalType": "struct PoolInfoUtilsMulticall.PoolUtilizationInfo", "components": [ { - "internalType": "uint256", "name": "poolMinDebtAmount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "poolCollateralization", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "poolActualUtilization", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "poolTargetUtilization", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } - ], - "internalType": "struct PoolInfoUtilsMulticall.PoolUtilizationInfo", - "name": "poolUtilizationInfo_", - "type": "tuple" + ] } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "view" }, { - "inputs": [], + "type": "function", "name": "poolInfoUtils", + "inputs": [], "outputs": [ { - "internalType": "contract PoolInfoUtils", "name": "", - "type": "address" + "type": "address", + "internalType": "contract PoolInfoUtils" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "poolRatesAndFeesMulticall", "inputs": [ { - "internalType": "address", "name": "ajnaPool_", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "poolRatesAndFeesMulticall", "outputs": [ { - "internalType": "uint256", "name": "lenderInterestMargin", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "borrowFeeRate", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "depositFeeRate", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "view" } ] diff --git a/src/utils/pool/pool.ts b/src/utils/pool/pool.ts index 2b0f35d..0cae512 100644 --- a/src/utils/pool/pool.ts +++ b/src/utils/pool/pool.ts @@ -78,7 +78,7 @@ export function getRatesAndFees(poolId: Bytes): RatesAndFees { const lim = poolInfoUtilsContract.lenderInterestMargin(poolAddress) const bfr = poolInfoUtilsContract.borrowFeeRate(poolAddress) - const dfr = poolInfoUtilsContract.unutilizedDepositFeeRate(poolAddress) + const dfr = poolInfoUtilsContract.depositFeeRate(poolAddress) return new RatesAndFees(lim, bfr, dfr); } @@ -468,7 +468,7 @@ export function getDebtInfoERC721Pool(pool: Pool): DebtInfo { export function getTotalBucketTokens(pool: Bytes): BigInt { const poolContract = ERC721Pool.bind(Address.fromBytes(pool)) - return poolContract.totalBucketTokens() + return BigInt.fromU64(poolContract.bucketTokenIds.length) } export function isERC20Pool(pool: Pool): boolean { diff --git a/tests/utils/mock-contract-calls.ts b/tests/utils/mock-contract-calls.ts index 8d2dcb2..8a10de3 100644 --- a/tests/utils/mock-contract-calls.ts +++ b/tests/utils/mock-contract-calls.ts @@ -182,7 +182,7 @@ export function mockGetRatesAndFees(pool: Address, expectedLenderInterestMargin: createMockedFunction(poolInfoUtilsAddressTable.get(dataSource.network())!, 'borrowFeeRate', 'borrowFeeRate(address):(uint256)') .withArgs([ethereum.Value.fromAddress(pool)]) .returns([ethereum.Value.fromUnsignedBigInt(expectedBorrowFeeRate)]) - createMockedFunction(poolInfoUtilsAddressTable.get(dataSource.network())!, 'unutilizedDepositFeeRate', 'unutilizedDepositFeeRate(address):(uint256)') + createMockedFunction(poolInfoUtilsAddressTable.get(dataSource.network())!, 'depositFeeRate', 'depositFeeRate(address):(uint256)') .withArgs([ethereum.Value.fromAddress(pool)]) .returns([ethereum.Value.fromUnsignedBigInt(expectedDepositFeeRate)]) }