Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PoolInfoUtilsMulticall support in updatePool #77

Merged
merged 22 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
319 changes: 319 additions & 0 deletions abis/PoolInfoUtilsMulticall.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,319 @@
[
{
"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": "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": [
{
"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"
}
]
2 changes: 1 addition & 1 deletion src/mappings/base/base-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 } 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"
Expand Down
3 changes: 3 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, Address>()
poolInfoUtilsMulticallAddressTable.set('goerli', Address.fromString('0x12874db433dBF1D0f3c73B39F96B009093A56E0E'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the address for the old contract, before your most recent changes to the PR. The new one is at 0x49B8AAd62e1BBBA1A69CA8B3E24383F29828F718.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to most recent deployment address

poolInfoUtilsMulticallAddressTable.set('ganache', Address.fromString('0x1d00b2f5861457F8503a481774903E36872Ea17d'))
export const positionManagerAddressTable = new TypedMap<string, Address>()
positionManagerAddressTable.set('goerli', Address.fromString('0xC4114D90F51960854ab574297Cf7CC131d445F29'))
positionManagerAddressTable.set('ganache', Address.fromString('0x502dD41556B128C23F8B715dBEEBB73D1F1Feb67'))
Expand Down
Loading
Loading