Skip to content

Commit

Permalink
add latest rc9 updates; fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike committed Dec 19, 2023
1 parent 646da38 commit fbfe005
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 103 deletions.
25 changes: 10 additions & 15 deletions abis/ERC20Pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"internalType": "uint256"
},
{
"name": "thresholdPrice_",
"name": "debtToCollateral_",
"type": "uint256",
"internalType": "uint256"
},
Expand Down Expand Up @@ -1103,6 +1103,11 @@
"type": "uint256",
"internalType": "uint256"
},
{
"name": "",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "",
"type": "uint256",
Expand Down Expand Up @@ -2126,17 +2131,17 @@
},
{
"type": "error",
"name": "AllowanceAlreadySet",
"name": "AlreadyInitialized",
"inputs": []
},
{
"type": "error",
"name": "AlreadyInitialized",
"name": "AmountLTMinDebt",
"inputs": []
},
{
"type": "error",
"name": "AmountLTMinDebt",
"name": "AuctionActive",
"inputs": []
},
{
Expand Down Expand Up @@ -2254,11 +2259,6 @@
"name": "LUPBelowHTP",
"inputs": []
},
{
"type": "error",
"name": "LUPGreaterThanTP",
"inputs": []
},
{
"type": "error",
"name": "LimitIndexExceeded",
Expand Down Expand Up @@ -2424,11 +2424,6 @@
}
]
},
{
"type": "error",
"name": "PoolUnderCollateralized",
"inputs": []
},
{
"type": "error",
"name": "PriceBelowLUP",
Expand Down Expand Up @@ -2471,7 +2466,7 @@
},
{
"type": "error",
"name": "ZeroThresholdPrice",
"name": "ZeroDebtToCollateral",
"inputs": []
}
]
6 changes: 6 additions & 0 deletions abis/ERC20PoolFactory.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@
"type": "address",
"indexed": false,
"internalType": "address"
},
{
"name": "subsetHash_",
"type": "bytes32",
"indexed": false,
"internalType": "bytes32"
}
],
"anonymous": false
Expand Down
89 changes: 42 additions & 47 deletions abis/ERC721Pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"internalType": "uint256"
},
{
"name": "thresholdPrice_",
"name": "debtToCollateral_",
"type": "uint256",
"internalType": "uint256"
},
Expand Down Expand Up @@ -619,6 +619,38 @@
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "getBorrowerTokenIds",
"inputs": [
{
"name": "borrower_",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256[]",
"internalType": "uint256[]"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getBucketTokenIds",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256[]",
"internalType": "uint256[]"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "increaseLPAllowance",
Expand Down Expand Up @@ -1166,6 +1198,11 @@
"type": "uint256",
"internalType": "uint256"
},
{
"name": "",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "",
"type": "uint256",
Expand Down Expand Up @@ -1326,38 +1363,6 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "totalBorrowerTokens",
"inputs": [
{
"name": "borrower_",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "totalBucketTokens",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "totalT0Debt",
Expand Down Expand Up @@ -2265,17 +2270,17 @@
},
{
"type": "error",
"name": "AllowanceAlreadySet",
"name": "AlreadyInitialized",
"inputs": []
},
{
"type": "error",
"name": "AlreadyInitialized",
"name": "AmountLTMinDebt",
"inputs": []
},
{
"type": "error",
"name": "AmountLTMinDebt",
"name": "AuctionActive",
"inputs": []
},
{
Expand Down Expand Up @@ -2393,11 +2398,6 @@
"name": "LUPBelowHTP",
"inputs": []
},
{
"type": "error",
"name": "LUPGreaterThanTP",
"inputs": []
},
{
"type": "error",
"name": "LimitIndexExceeded",
Expand Down Expand Up @@ -2514,11 +2514,6 @@
}
]
},
{
"type": "error",
"name": "PoolUnderCollateralized",
"inputs": []
},
{
"type": "error",
"name": "PriceBelowLUP",
Expand Down Expand Up @@ -2561,7 +2556,7 @@
},
{
"type": "error",
"name": "ZeroThresholdPrice",
"name": "ZeroDebtToCollateral",
"inputs": []
}
]
6 changes: 6 additions & 0 deletions abis/ERC721PoolFactory.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@
"type": "address",
"indexed": false,
"internalType": "address"
},
{
"name": "subsetHash_",
"type": "bytes32",
"indexed": false,
"internalType": "bytes32"
}
],
"anonymous": false
Expand Down
9 changes: 7 additions & 2 deletions abis/PoolInfoUtils.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"internalType": "uint256"
},
{
"name": "thresholdPrice_",
"name": "debtToCollateral_",
"type": "uint256",
"internalType": "uint256"
},
Expand Down Expand Up @@ -120,7 +120,7 @@
"internalType": "uint256"
},
{
"name": "thresholdPrice_",
"name": "debtToCollateral_",
"type": "uint256",
"internalType": "uint256"
},
Expand Down Expand Up @@ -200,6 +200,11 @@
"name": "t0Np_",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "thresholdPrice_",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
Expand Down
6 changes: 4 additions & 2 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,14 @@ type Loan @entity {
liquidationAuction: LiquidationAuction
# collateral tokens deposited in a pool by the borrower
collateralPledged: BigDecimal!
# borrower's threshold price in t0 terms
t0ThresholdPrice: 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 {
Expand Down
8 changes: 4 additions & 4 deletions src/mappings/erc-20-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function handleDrawDebt(event: DrawDebtEvent): void {
loan.collateralPledged = wadToDecimal(borrowerInfo.collateral)
loan.t0debt = wadToDecimal(borrowerInfo.t0debt)
loan.t0Np = wadToDecimal(borrowerInfo.t0Np)
loan.t0ThresholdPrice = wadToDecimal(borrowerInfo.t0ThresholdPrice)
loan.thresholdPrice = wadToDecimal(borrowerInfo.thresholdPrice)

// update account's list of pools and loans if necessary
updateAccountPools(account, pool)
Expand Down Expand Up @@ -152,7 +152,7 @@ export function handleRepayDebt(event: RepayDebtEvent): void {
loan.collateralPledged = wadToDecimal(borrowerInfo.collateral)
loan.t0debt = wadToDecimal(borrowerInfo.t0debt)
loan.t0Np = wadToDecimal(borrowerInfo.t0Np)
loan.t0ThresholdPrice = wadToDecimal(borrowerInfo.t0ThresholdPrice)
loan.thresholdPrice = wadToDecimal(borrowerInfo.thresholdPrice)

// update account loans if necessary
updateAccountLoans(account, loan)
Expand Down Expand Up @@ -442,7 +442,7 @@ export function handleBucketTake(event: BucketTakeEvent): void {
loan.collateralPledged = wadToDecimal(borrowerInfo.collateral)
loan.t0debt = wadToDecimal(borrowerInfo.t0debt)
loan.t0Np = wadToDecimal(borrowerInfo.t0Np)
loan.t0ThresholdPrice = wadToDecimal(borrowerInfo.t0ThresholdPrice)
loan.thresholdPrice = wadToDecimal(borrowerInfo.thresholdPrice)

// retrieve auction information on the take's auction
const auctionInfo = getAuctionInfoERC20Pool(bucketTake.borrower, pool)
Expand Down Expand Up @@ -557,7 +557,7 @@ export function handleTake(event: TakeEvent): void {
loan.collateralPledged = wadToDecimal(borrowerInfo.collateral)
loan.t0debt = wadToDecimal(borrowerInfo.t0debt)
loan.t0Np = wadToDecimal(borrowerInfo.t0Np)
loan.t0ThresholdPrice = wadToDecimal(borrowerInfo.t0ThresholdPrice)
loan.thresholdPrice = wadToDecimal(borrowerInfo.thresholdPrice)

// update liquidation auction state
const auctionId = loan.liquidationAuction!
Expand Down
Loading

0 comments on commit fbfe005

Please sign in to comment.