@raac/rpc 1.0.1 → 1.0.2-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RPCLibrary.js +61 -8
- package/dist/artifacts/core/collectors/FeeCollector.sol/FeeCollector.json +1743 -0
- package/dist/artifacts/core/minters/RAACMinter/RAACMinter.sol/RAACMinter.json +175 -67
- package/dist/artifacts/core/oracles/BaseVRFv2Consumer.sol/BaseVRFv2Consumer.json +279 -0
- package/dist/artifacts/core/pools/LendingPool/LendingPool.sol/LendingPool.json +1231 -195
- package/dist/artifacts/core/pools/StabilityPool/StabilityPool.sol/StabilityPool.json +153 -199
- package/dist/artifacts/core/primitives/RAACHousePrices.sol/RAACHousePrices.json +72 -2
- package/dist/artifacts/core/tokens/DEToken.sol/DEToken.json +2 -2
- package/dist/artifacts/core/tokens/IndexToken.sol/IndexToken.json +770 -0
- package/dist/artifacts/core/tokens/RAACNFT.sol/RAACNFT.json +707 -49
- package/dist/artifacts/core/tokens/RAACToken.sol/RAACToken.json +23 -84
- package/dist/artifacts/core/tokens/RToken.sol/RToken.json +62 -62
- package/dist/artifacts/core/tokens/veRAACToken.sol/veRAACToken.json +2 -2
- package/dist/artifacts/mocks/core/oracles/MockVRFCoordinatorV2.sol/MockVRFCoordinatorV2.json +774 -0
- package/dist/artifacts/zeno/Auction.sol/Auction.json +34 -114
- package/dist/artifacts/zeno/AuctionFactory.sol/AuctionFactory.json +3 -3
- package/dist/artifacts/zeno/Zeno.sol/Zeno.json +3 -3
- package/dist/artifacts/zeno/ZenoFactory.sol/ZenoFactory.json +3 -3
- package/dist/configs/chains/11155111.json +132 -0
- package/dist/configs/chains/17000.json +127 -0
- package/dist/configs/chains/8453.json +26 -14
- package/dist/configs/chains/index.js +4 -0
- package/dist/configs/createConfig.js +6 -0
- package/dist/contracts/feeCollector/claimRewardFromPool.js +24 -0
- package/dist/contracts/housePrices/getLatestPrice.js +1 -1
- package/dist/contracts/indexToken/getNextRandomNFT.js +30 -0
- package/dist/contracts/indexToken/redeemNFT.js +39 -0
- package/dist/methods/commons/estimateGasPrice.js +7 -2
- package/dist/nfts/getAllTokens.js +34 -0
- package/dist/nfts/{addNewBatch.js → getBaseUri.js} +7 -8
- package/dist/nfts/getMintFeePercentage.js +23 -0
- package/dist/nfts/getMintPrice.js +28 -0
- package/dist/nfts/getTokenURI.js +23 -0
- package/dist/nfts/getTokensByOwner.js +35 -0
- package/dist/nfts/getTotalPropertiesCount.js +23 -0
- package/dist/nfts/{getCurrentBatchSize.js → totalNFTSupply.js} +3 -3
- package/dist/pools/lendingPool/borrowFromLendingPool.js +4 -3
- package/dist/pools/lendingPool/borrowFromLendingPoolWithInsurance.js +40 -0
- package/dist/pools/lendingPool/calculateInsuranceFee.js +20 -0
- package/dist/pools/lendingPool/claimReward.js +22 -0
- package/dist/pools/lendingPool/closeLiquidation.js +28 -0
- package/dist/pools/lendingPool/depositNFTToLendingPool.js +0 -1
- package/dist/pools/lendingPool/depositToLendingPool.js +2 -2
- package/dist/pools/lendingPool/getAllUserData.js +28 -0
- package/dist/pools/lendingPool/getEligibleUserDeposits.js +27 -0
- package/dist/pools/lendingPool/getHealthFactor.js +27 -0
- package/dist/pools/lendingPool/getLendingPoolInfo.js +8 -5
- package/dist/pools/lendingPool/getPendingReward.js +20 -0
- package/dist/pools/lendingPool/getPositionDebt.js +27 -0
- package/dist/pools/lendingPool/getPositionScaledDebt.js +27 -0
- package/dist/pools/lendingPool/getPositionView.js +38 -0
- package/dist/pools/lendingPool/getPositionsScaledDebt.js +27 -0
- package/dist/pools/lendingPool/getRawUserDepositsInLendingPool.js +21 -0
- package/dist/pools/lendingPool/getUserCollateralValue.js +27 -0
- package/dist/pools/lendingPool/initializeLiquidation.js +28 -0
- package/dist/pools/lendingPool/repayToLendingPool.js +4 -8
- package/dist/pools/lendingPool/withdrawFromLendingPool.js +2 -2
- package/dist/pools/stabilityPool/depositNFTToStabilityPool.js +40 -0
- package/dist/pools/stabilityPool/getRawUserDepositsInStabilityPool.js +21 -0
- package/dist/pools/stabilityPool/getStabilityPoolInfo.js +2 -12
- package/dist/scripts/index.js +90 -35
- package/dist/types/RPCLibrary.d.ts +61 -8
- package/dist/types/configs/chains/index.d.ts +5 -1
- package/dist/types/configs/createConfig.d.ts +6 -0
- package/dist/types/configs/index.d.ts +2 -0
- package/dist/types/contracts/feeCollector/claimRewardFromPool.d.ts +4 -0
- package/dist/types/contracts/housePrices/getLatestPrice.d.ts +1 -1
- package/dist/types/contracts/indexToken/getNextRandomNFT.d.ts +7 -0
- package/dist/types/contracts/indexToken/redeemNFT.d.ts +4 -0
- package/dist/types/nfts/getAllTokens.d.ts +7 -0
- package/dist/types/nfts/getBaseUri.d.ts +4 -0
- package/dist/types/nfts/getMintFeePercentage.d.ts +4 -0
- package/dist/types/nfts/getMintPrice.d.ts +7 -0
- package/dist/types/nfts/getTokenURI.d.ts +4 -0
- package/dist/types/nfts/getTokensByOwner.d.ts +10 -0
- package/dist/types/nfts/getTotalPropertiesCount.d.ts +4 -0
- package/dist/types/nfts/totalNFTSupply.d.ts +4 -0
- package/dist/types/pools/lendingPool/borrowFromLendingPool.d.ts +1 -1
- package/dist/types/pools/lendingPool/borrowFromLendingPoolWithInsurance.d.ts +4 -0
- package/dist/types/pools/lendingPool/calculateInsuranceFee.d.ts +4 -0
- package/dist/types/pools/lendingPool/claimReward.d.ts +4 -0
- package/dist/types/pools/lendingPool/closeLiquidation.d.ts +11 -0
- package/dist/types/pools/lendingPool/getAllUserData.d.ts +16 -0
- package/dist/types/pools/lendingPool/getEligibleUserDeposits.d.ts +11 -0
- package/dist/types/pools/lendingPool/getHealthFactor.d.ts +11 -0
- package/dist/types/pools/lendingPool/getLendingPoolInfo.d.ts +2 -1
- package/dist/types/pools/lendingPool/getPendingReward.d.ts +4 -0
- package/dist/types/pools/lendingPool/getPositionDebt.d.ts +11 -0
- package/dist/types/pools/lendingPool/getPositionScaledDebt.d.ts +11 -0
- package/dist/types/pools/lendingPool/getPositionView.d.ts +27 -0
- package/dist/types/pools/lendingPool/getPositionsScaledDebt.d.ts +11 -0
- package/dist/types/pools/lendingPool/getRawUserDepositsInLendingPool.d.ts +4 -0
- package/dist/types/pools/lendingPool/getUserCollateralValue.d.ts +11 -0
- package/dist/types/pools/lendingPool/initializeLiquidation.d.ts +11 -0
- package/dist/types/pools/lendingPool/repayToLendingPool.d.ts +2 -2
- package/dist/types/pools/lendingPool/withdrawNFTFromLendingPool.d.ts +1 -1
- package/dist/types/pools/stabilityPool/depositNFTToStabilityPool.d.ts +4 -0
- package/dist/types/pools/stabilityPool/getRawUserDepositsInStabilityPool.d.ts +4 -0
- package/dist/types/pools/stabilityPool/getStabilityPoolInfo.d.ts +1 -3
- package/dist/types/typechain-types/@chainlink/contracts/src/v0.8/index.d.ts +2 -0
- package/dist/types/typechain-types/@chainlink/contracts/src/v0.8/vrf/VRFConsumerBaseV2.d.ts +35 -0
- package/dist/types/typechain-types/@chainlink/contracts/src/v0.8/vrf/index.d.ts +3 -0
- package/dist/types/typechain-types/@chainlink/contracts/src/v0.8/vrf/interfaces/VRFCoordinatorV2Interface.d.ts +156 -0
- package/dist/types/typechain-types/@chainlink/contracts/src/v0.8/vrf/interfaces/index.d.ts +1 -0
- package/dist/types/typechain-types/contracts/core/collectors/FeeCollector.d.ts +446 -221
- package/dist/types/typechain-types/contracts/core/minters/RAACMinter/RAACMinter.d.ts +108 -20
- package/dist/types/typechain-types/contracts/core/minters/RAACReleaseOrchestrator/RAACReleaseOrchestrator.d.ts +6 -16
- package/dist/types/typechain-types/contracts/core/oracles/BaseVRFv2Consumer.d.ts +166 -0
- package/dist/types/typechain-types/contracts/core/oracles/index.d.ts +1 -0
- package/dist/types/typechain-types/contracts/core/pools/LendingPool/LendingPool.d.ts +811 -99
- package/dist/types/typechain-types/contracts/core/pools/StabilityPool/StabilityPool.d.ts +152 -148
- package/dist/types/typechain-types/contracts/core/pools/StabilityPool/index.d.ts +0 -1
- package/dist/types/typechain-types/contracts/core/primitives/RAACHousePrices.d.ts +29 -2
- package/dist/types/typechain-types/contracts/core/tokens/DebtToken.d.ts +65 -51
- package/dist/types/typechain-types/contracts/core/tokens/IndexToken.d.ts +187 -2
- package/dist/types/typechain-types/contracts/core/tokens/RAACNFT.d.ts +413 -19
- package/dist/types/typechain-types/contracts/core/tokens/RToken.d.ts +40 -40
- package/dist/types/typechain-types/contracts/interfaces/core/collectors/IBaseCollector.d.ts +39 -0
- package/dist/types/typechain-types/contracts/interfaces/core/collectors/IFeeCollector.d.ts +317 -130
- package/dist/types/typechain-types/contracts/interfaces/core/collectors/index.d.ts +1 -0
- package/dist/types/typechain-types/contracts/interfaces/core/index.d.ts +2 -0
- package/dist/types/typechain-types/contracts/interfaces/core/minters/RAACMinter/IRAACMinter.d.ts +58 -22
- package/dist/types/typechain-types/contracts/interfaces/core/minters/RAACReleaseOrchestrator/IReleaseOrchestrator.d.ts +5 -3
- package/dist/types/typechain-types/contracts/interfaces/core/oracles/IBaseVRFv2Consumer.d.ts +86 -0
- package/dist/types/typechain-types/contracts/interfaces/core/oracles/index.d.ts +1 -0
- package/dist/types/typechain-types/contracts/interfaces/core/pools/ILiquidityPool.d.ts +83 -45
- package/dist/types/typechain-types/contracts/interfaces/core/pools/LendingPool/ILendingPool.d.ts +539 -54
- package/dist/types/typechain-types/contracts/interfaces/core/pools/StabilityPool/IStabilityPool.d.ts +92 -71
- package/dist/types/typechain-types/contracts/interfaces/core/tokens/IDebtToken.d.ts +123 -27
- package/dist/types/typechain-types/contracts/interfaces/core/tokens/IIndexToken.d.ts +187 -0
- package/dist/types/typechain-types/contracts/interfaces/core/tokens/IRAACNFT.d.ts +243 -17
- package/dist/types/typechain-types/contracts/interfaces/core/tokens/IRToken.d.ts +37 -37
- package/dist/types/typechain-types/contracts/interfaces/core/tokens/index.d.ts +1 -0
- package/dist/types/typechain-types/contracts/interfaces/core/vaults/IBaseVault.d.ts +83 -0
- package/dist/types/typechain-types/contracts/interfaces/core/vaults/index.d.ts +1 -0
- package/dist/types/typechain-types/contracts/interfaces/index.d.ts +0 -1
- package/dist/types/typechain-types/contracts/mocks/core/collectors/index.d.ts +0 -1
- package/dist/types/typechain-types/contracts/mocks/core/governance/proposals/TimelockTestTarget.d.ts +5 -1
- package/dist/types/typechain-types/contracts/mocks/core/index.d.ts +2 -0
- package/dist/types/typechain-types/contracts/mocks/core/oracles/MockVRFCoordinatorV2.d.ts +530 -0
- package/dist/types/typechain-types/contracts/mocks/core/oracles/index.d.ts +1 -0
- package/dist/types/typechain-types/contracts/mocks/core/pools/MockLendingPoolCollector.d.ts +156 -0
- package/dist/types/typechain-types/contracts/mocks/core/pools/MockLendingPoolDebtToken.d.ts +557 -102
- package/dist/types/typechain-types/contracts/mocks/core/pools/MockLiquidityPool.d.ts +486 -0
- package/dist/types/typechain-types/contracts/mocks/core/pools/index.d.ts +2 -0
- package/dist/types/typechain-types/contracts/mocks/core/primitives/MockDistributableContract.d.ts +35 -0
- package/dist/types/typechain-types/contracts/mocks/core/primitives/index.d.ts +1 -0
- package/dist/types/typechain-types/contracts/mocks/core/tokens/MockCollectableUnderlying.d.ts +292 -0
- package/dist/types/typechain-types/contracts/mocks/core/tokens/index.d.ts +1 -0
- package/dist/types/typechain-types/contracts/mocks/core/vaults/MockVault.d.ts +290 -0
- package/dist/types/typechain-types/contracts/mocks/core/vaults/index.d.ts +1 -0
- package/dist/types/typechain-types/contracts/mocks/libraries/MockStringUtils.d.ts +25 -0
- package/dist/types/typechain-types/contracts/mocks/libraries/index.d.ts +1 -0
- package/dist/types/typechain-types/factories/@chainlink/contracts/src/v0.8/index.d.ts +1 -0
- package/dist/types/typechain-types/factories/@chainlink/contracts/src/v0.8/vrf/VRFConsumerBaseV2__factory.d.ts +33 -0
- package/dist/types/typechain-types/factories/@chainlink/contracts/src/v0.8/vrf/index.d.ts +2 -0
- package/dist/types/typechain-types/factories/@chainlink/contracts/src/v0.8/vrf/interfaces/VRFCoordinatorV2Interface__factory.d.ts +171 -0
- package/dist/types/typechain-types/factories/@chainlink/contracts/src/v0.8/vrf/interfaces/index.d.ts +1 -0
- package/dist/types/typechain-types/factories/contracts/core/collectors/FeeCollector__factory.d.ts +571 -194
- package/dist/types/typechain-types/factories/contracts/core/minters/RAACMinter/RAACMinter__factory.d.ts +138 -54
- package/dist/types/typechain-types/factories/contracts/core/minters/RAACReleaseOrchestrator/RAACReleaseOrchestrator__factory.d.ts +5 -31
- package/dist/types/typechain-types/factories/contracts/core/oracles/BaseVRFv2Consumer__factory.d.ts +231 -0
- package/dist/types/typechain-types/factories/contracts/core/oracles/RAACHousePriceOracle__factory.d.ts +1 -1
- package/dist/types/typechain-types/factories/contracts/core/oracles/RAACPrimeRateOracle__factory.d.ts +1 -1
- package/dist/types/typechain-types/factories/contracts/core/oracles/index.d.ts +1 -0
- package/dist/types/typechain-types/factories/contracts/core/pools/LendingPool/LendingPool__factory.d.ts +897 -64
- package/dist/types/typechain-types/factories/contracts/core/pools/StabilityPool/NFTLiquidator__factory.d.ts +1 -1
- package/dist/types/typechain-types/factories/contracts/core/pools/StabilityPool/StabilityPool__factory.d.ts +128 -161
- package/dist/types/typechain-types/factories/contracts/core/pools/StabilityPool/index.d.ts +0 -1
- package/dist/types/typechain-types/factories/contracts/core/primitives/RAACHousePrices__factory.d.ts +54 -1
- package/dist/types/typechain-types/factories/contracts/core/tokens/DebtToken__factory.d.ts +47 -29
- package/dist/types/typechain-types/factories/contracts/core/tokens/IndexToken__factory.d.ts +317 -1
- package/dist/types/typechain-types/factories/contracts/core/tokens/RAACNFT__factory.d.ts +525 -17
- package/dist/types/typechain-types/factories/contracts/core/tokens/RAACToken__factory.d.ts +1 -1
- package/dist/types/typechain-types/factories/contracts/core/tokens/RToken__factory.d.ts +52 -52
- package/dist/types/typechain-types/factories/contracts/core/tokens/VeRAACToken__factory.d.ts +1 -1
- package/dist/types/typechain-types/factories/contracts/interfaces/core/collectors/IBaseCollector__factory.d.ts +33 -0
- package/dist/types/typechain-types/factories/contracts/interfaces/core/collectors/IFeeCollector__factory.d.ts +409 -90
- package/dist/types/typechain-types/factories/contracts/interfaces/core/collectors/index.d.ts +1 -0
- package/dist/types/typechain-types/factories/contracts/interfaces/core/index.d.ts +1 -0
- package/dist/types/typechain-types/factories/contracts/interfaces/core/minters/RAACMinter/IRAACMinter__factory.d.ts +59 -15
- package/dist/types/typechain-types/factories/contracts/interfaces/core/minters/RAACReleaseOrchestrator/IReleaseOrchestrator__factory.d.ts +4 -0
- package/dist/types/typechain-types/factories/contracts/interfaces/core/oracles/IBaseVRFv2Consumer__factory.d.ts +78 -0
- package/dist/types/typechain-types/factories/contracts/interfaces/core/oracles/index.d.ts +1 -0
- package/dist/types/typechain-types/factories/contracts/interfaces/core/pools/ILiquidityPool__factory.d.ts +119 -39
- package/dist/types/typechain-types/factories/contracts/interfaces/core/pools/LendingPool/ILendingPool__factory.d.ts +547 -19
- package/dist/types/typechain-types/factories/contracts/interfaces/core/pools/StabilityPool/IStabilityPool__factory.d.ts +68 -67
- package/dist/types/typechain-types/factories/contracts/interfaces/core/tokens/IDebtToken__factory.d.ts +119 -6
- package/dist/types/typechain-types/factories/{erc721a/contracts/IERC721A__factory.d.ts → contracts/interfaces/core/tokens/IIndexToken__factory.d.ts} +74 -215
- package/dist/types/typechain-types/factories/contracts/interfaces/core/tokens/IRAACNFT__factory.d.ts +274 -10
- package/dist/types/typechain-types/factories/contracts/interfaces/core/tokens/IRToken__factory.d.ts +26 -26
- package/dist/types/typechain-types/factories/contracts/interfaces/core/tokens/index.d.ts +1 -0
- package/dist/types/typechain-types/factories/contracts/interfaces/{IMarketCreator__factory.d.ts → core/vaults/IBaseVault__factory.d.ts} +78 -42
- package/dist/types/typechain-types/factories/contracts/interfaces/core/vaults/index.d.ts +1 -0
- package/dist/types/typechain-types/factories/contracts/interfaces/index.d.ts +0 -1
- package/dist/types/typechain-types/factories/contracts/libraries/pools/ReserveLibrary__factory.d.ts +1 -1
- package/dist/types/typechain-types/factories/contracts/mocks/core/collectors/index.d.ts +0 -1
- package/dist/types/typechain-types/factories/contracts/mocks/core/governance/gauges/MockBaseGauge__factory.d.ts +16 -4
- package/dist/types/typechain-types/factories/contracts/mocks/core/governance/proposals/TimelockTestTarget__factory.d.ts +10 -1
- package/dist/types/typechain-types/factories/contracts/mocks/core/index.d.ts +1 -0
- package/dist/types/typechain-types/factories/contracts/mocks/core/oracles/MockOracle__factory.d.ts +1 -1
- package/dist/types/typechain-types/factories/contracts/mocks/core/oracles/MockVRFCoordinatorV2__factory.d.ts +620 -0
- package/dist/types/typechain-types/factories/contracts/mocks/core/oracles/TestRAACHousePriceOracle__factory.d.ts +1 -1
- package/dist/types/typechain-types/factories/contracts/mocks/core/oracles/TestRAACPrimeRateOracle__factory.d.ts +1 -1
- package/dist/types/typechain-types/factories/contracts/mocks/core/oracles/index.d.ts +1 -0
- package/dist/types/typechain-types/factories/contracts/mocks/core/pools/MockLendingPoolCollector__factory.d.ts +234 -0
- package/dist/types/typechain-types/factories/contracts/mocks/core/pools/MockLendingPoolDebtToken__factory.d.ts +539 -77
- package/dist/types/typechain-types/factories/contracts/mocks/core/pools/MockLendingPool__factory.d.ts +1 -1
- package/dist/types/typechain-types/factories/contracts/mocks/core/pools/MockLiquidityPool__factory.d.ts +795 -0
- package/dist/types/typechain-types/factories/contracts/mocks/core/pools/MockStabilityPool__factory.d.ts +1 -1
- package/dist/types/typechain-types/factories/contracts/mocks/core/pools/index.d.ts +2 -0
- package/dist/types/typechain-types/factories/contracts/mocks/core/primitives/MockDistributableContract__factory.d.ts +68 -0
- package/dist/types/typechain-types/factories/contracts/mocks/core/primitives/index.d.ts +1 -0
- package/dist/types/typechain-types/factories/contracts/mocks/core/tokens/MockCollectableUnderlying__factory.d.ts +451 -0
- package/dist/types/typechain-types/factories/contracts/mocks/core/tokens/index.d.ts +1 -0
- package/dist/types/typechain-types/factories/contracts/mocks/core/vaults/MockVault__factory.d.ts +525 -0
- package/dist/types/typechain-types/factories/contracts/mocks/core/vaults/index.d.ts +1 -0
- package/dist/types/typechain-types/factories/contracts/mocks/libraries/MockStringUtils__factory.d.ts +40 -0
- package/dist/types/typechain-types/factories/contracts/mocks/libraries/index.d.ts +1 -0
- package/dist/types/typechain-types/factories/contracts/mocks/libraries/pools/ReserveLibraryMock__factory.d.ts +1 -1
- package/dist/types/typechain-types/factories/contracts/mocks/tests/VeRAACFuzzHelper__factory.d.ts +1 -1
- package/dist/types/typechain-types/factories/index.d.ts +0 -1
- package/dist/types/typechain-types/index.d.ts +28 -10
- package/dist/types/utils/artifacts.d.ts +677 -39
- package/dist/types/utils/contracts.d.ts +4 -0
- package/dist/utils/artifacts.js +9 -0
- package/package.json +1 -1
- package/dist/nfts/getDepositedNFTs.js +0 -19
- package/dist/nfts/getOwnedNFTs.js +0 -34
- package/dist/types/nfts/addNewBatch.d.ts +0 -4
- package/dist/types/nfts/getCurrentBatchSize.d.ts +0 -4
- package/dist/types/nfts/getDepositedNFTs.d.ts +0 -7
- package/dist/types/nfts/getOwnedNFTs.d.ts +0 -7
- package/dist/types/typechain-types/contracts/core/pools/StabilityPool/MarketCreator.d.ts +0 -274
- package/dist/types/typechain-types/contracts/interfaces/IMarketCreator.d.ts +0 -85
- package/dist/types/typechain-types/contracts/mocks/core/collectors/MockFeeCollector.d.ts +0 -708
- package/dist/types/typechain-types/erc721a/contracts/IERC721A.d.ts +0 -242
- package/dist/types/typechain-types/erc721a/contracts/index.d.ts +0 -1
- package/dist/types/typechain-types/erc721a/index.d.ts +0 -2
- package/dist/types/typechain-types/factories/contracts/core/pools/StabilityPool/MarketCreator__factory.d.ts +0 -405
- package/dist/types/typechain-types/factories/contracts/mocks/core/collectors/MockFeeCollector__factory.d.ts +0 -985
- package/dist/types/typechain-types/factories/erc721a/contracts/index.d.ts +0 -1
- package/dist/types/typechain-types/factories/erc721a/index.d.ts +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformPositionView = transformPositionView;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const getContractAddress_1 = require("../../contracts/getContractAddress");
|
|
6
|
+
const artifacts_1 = require("../../utils/artifacts");
|
|
7
|
+
function transformPositionView(positionView) {
|
|
8
|
+
return {
|
|
9
|
+
rawDebtBalance: ethers_1.ethers.formatEther(positionView?.[0] || 0n),
|
|
10
|
+
scaledDebtBalance: ethers_1.ethers.formatEther(positionView?.[1] || 0n),
|
|
11
|
+
healthFactor: (positionView?.[2] || 0n).toString(),
|
|
12
|
+
isUnderLiquidation: positionView?.[3] || false,
|
|
13
|
+
liquidationStartTime: (positionView?.[4] || 0n).toString(),
|
|
14
|
+
positionIndex: (positionView?.[5] || 0n).toString(),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @description Return all the information about a NFT position
|
|
19
|
+
* @param chainId
|
|
20
|
+
* @param address
|
|
21
|
+
* @param provider
|
|
22
|
+
* @returns All information about a NFT position
|
|
23
|
+
*/
|
|
24
|
+
async function getPositionView(chainId, address, tokenId, provider) {
|
|
25
|
+
try {
|
|
26
|
+
const lendingPoolAddress = (0, getContractAddress_1.getContractAddress)(chainId, "lendingpool");
|
|
27
|
+
const lendingPoolABI = (0, artifacts_1.getABI)("lendingpool");
|
|
28
|
+
const lendingPoolContract = new ethers_1.ethers.Contract(lendingPoolAddress, lendingPoolABI, provider);
|
|
29
|
+
const res = await lendingPoolContract.getPositionView(address, tokenId);
|
|
30
|
+
console.log(`getPositionView result: ${res}`);
|
|
31
|
+
return transformPositionView(res);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.error("Error in getPositionView:", error);
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.default = getPositionView;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ethers_1 = require("ethers");
|
|
4
|
+
const getContractAddress_1 = require("../../contracts/getContractAddress");
|
|
5
|
+
const artifacts_1 = require("../../utils/artifacts");
|
|
6
|
+
/**
|
|
7
|
+
* @description Get the sum of all the scaled debts of a user over all NFTs
|
|
8
|
+
* @param chainId
|
|
9
|
+
* @param address
|
|
10
|
+
* @param provider
|
|
11
|
+
* @returns The debt of the user
|
|
12
|
+
*/
|
|
13
|
+
async function getPositionsScaledDebt(chainId, address, provider) {
|
|
14
|
+
try {
|
|
15
|
+
const lendingPoolAddress = (0, getContractAddress_1.getContractAddress)(chainId, "lendingpool");
|
|
16
|
+
const lendingPoolABI = (0, artifacts_1.getABI)("lendingpool");
|
|
17
|
+
const lendingPoolContract = new ethers_1.ethers.Contract(lendingPoolAddress, lendingPoolABI, provider);
|
|
18
|
+
const reward = await lendingPoolContract.getPositionsScaledDebt(address);
|
|
19
|
+
console.log(`getPositionsScaledDebt result: ${ethers_1.ethers.formatEther(reward)}`);
|
|
20
|
+
return reward;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
console.error("Error in getPositionsScaledDebt:", error);
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.default = getPositionsScaledDebt;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ethers_1 = require("ethers");
|
|
4
|
+
const getContractAddress_1 = require("../../contracts/getContractAddress");
|
|
5
|
+
const artifacts_1 = require("../../utils/artifacts");
|
|
6
|
+
// Get the amount of RToken RAW deposit in the lending pool, without the accured interest
|
|
7
|
+
async function getRawUserDepositsInLendingPool(chainId, address, provider) {
|
|
8
|
+
try {
|
|
9
|
+
const lendingPoolAddress = (0, getContractAddress_1.getContractAddress)(chainId, "lendingpool");
|
|
10
|
+
const lendingPoolABI = (0, artifacts_1.getABI)("lendingpool");
|
|
11
|
+
const lendingPoolContract = new ethers_1.ethers.Contract(lendingPoolAddress, lendingPoolABI, provider);
|
|
12
|
+
const value = await lendingPoolContract.getUserDeposits(address);
|
|
13
|
+
console.log(`User deposits in lending pool: ${ethers_1.ethers.formatEther(value)}`);
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
console.error("Error in getRawUserDepositsInLendingPool:", error);
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.default = getRawUserDepositsInLendingPool;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ethers_1 = require("ethers");
|
|
4
|
+
const getContractAddress_1 = require("../../contracts/getContractAddress");
|
|
5
|
+
const artifacts_1 = require("../../utils/artifacts");
|
|
6
|
+
/**
|
|
7
|
+
* @description Sum of the prices of all the NFTS
|
|
8
|
+
* @param chainId
|
|
9
|
+
* @param address
|
|
10
|
+
* @param provider
|
|
11
|
+
* @returns The total value of the collateral
|
|
12
|
+
*/
|
|
13
|
+
async function getUserCollateralValue(chainId, address, provider) {
|
|
14
|
+
try {
|
|
15
|
+
const lendingPoolAddress = (0, getContractAddress_1.getContractAddress)(chainId, "lendingpool");
|
|
16
|
+
const lendingPoolABI = (0, artifacts_1.getABI)("lendingpool");
|
|
17
|
+
const lendingPoolContract = new ethers_1.ethers.Contract(lendingPoolAddress, lendingPoolABI, provider);
|
|
18
|
+
const reward = await lendingPoolContract.getUserCollateralValue(address);
|
|
19
|
+
console.log(`getUserCollateralValue result: ${ethers_1.ethers.formatEther(reward)}`);
|
|
20
|
+
return reward;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
console.error("Error in getUserCollateralValue:", error);
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.default = getUserCollateralValue;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ethers_1 = require("ethers");
|
|
4
|
+
const getContractAddress_1 = require("../../contracts/getContractAddress");
|
|
5
|
+
const artifacts_1 = require("../../utils/artifacts");
|
|
6
|
+
/**
|
|
7
|
+
* @description Get the sum of all the scaled debts of a user over all NFTs
|
|
8
|
+
* @param chainId
|
|
9
|
+
* @param address
|
|
10
|
+
* @param provider
|
|
11
|
+
* @returns The debt of the user
|
|
12
|
+
*/
|
|
13
|
+
async function initializeLiquidation(chainId, address, tokenId, signer) {
|
|
14
|
+
try {
|
|
15
|
+
const lendingPoolAddress = (0, getContractAddress_1.getContractAddress)(chainId, "lendingpool");
|
|
16
|
+
const lendingPoolABI = (0, artifacts_1.getABI)("lendingpool");
|
|
17
|
+
const lendingPoolContract = new ethers_1.ethers.Contract(lendingPoolAddress, lendingPoolABI, signer);
|
|
18
|
+
const tx = await lendingPoolContract.initiateLiquidation(address, tokenId);
|
|
19
|
+
await tx.wait();
|
|
20
|
+
console.log(`initializeLiquidation result: ${tx.hash}`);
|
|
21
|
+
return tx;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
console.error("Error in initializeLiquidation:", error);
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.default = initializeLiquidation;
|
|
@@ -6,17 +6,13 @@ const artifacts_1 = require("../../utils/artifacts");
|
|
|
6
6
|
async function repayToLendingPool(chainId, tokenId, amount, signer) {
|
|
7
7
|
try {
|
|
8
8
|
const lendingPoolAddress = (0, getContractAddress_1.getContractAddress)(chainId, "lendingpool");
|
|
9
|
-
const crvUSDAddress = (0, getContractAddress_1.getContractAddress)(chainId, "rcrvusd");
|
|
10
9
|
const lendingPoolABI = (0, artifacts_1.getABI)("lendingpool");
|
|
11
|
-
const crvUSDABI = (0, artifacts_1.getABI)("crvusd");
|
|
12
10
|
const lendingPoolContract = new ethers_1.ethers.Contract(lendingPoolAddress, lendingPoolABI, signer);
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
await
|
|
16
|
-
console.log(`Approved lendingPoolContract to spend ${ethers_1.ethers.formatEther(amount)} crvUSD`);
|
|
17
|
-
const tx = await lendingPoolContract.repay(amount);
|
|
11
|
+
const amountInWei = ethers_1.ethers.parseEther(amount.toString());
|
|
12
|
+
console.log("Repaying amount in wei:", amountInWei.toString());
|
|
13
|
+
const tx = await lendingPoolContract.repay(tokenId, amountInWei.toString());
|
|
18
14
|
const receipt = await tx.wait();
|
|
19
|
-
console.log(`Repaid ${
|
|
15
|
+
console.log(`Repaid ${amount} crvUSD to lending pool.`);
|
|
20
16
|
console.log(`Transaction hash: ${receipt?.hash}`);
|
|
21
17
|
return receipt;
|
|
22
18
|
}
|
|
@@ -19,11 +19,11 @@ async function withdrawFromLendingPool(chainId, amount, signer) {
|
|
|
19
19
|
const { maxFeePerGas } = await (0, estimateGasPrice_1.default)(signer);
|
|
20
20
|
const userBalance = await rTokenContract.balanceOf(await signer.getAddress());
|
|
21
21
|
if (userBalance < amount) {
|
|
22
|
-
throw new Error(`Insufficient
|
|
22
|
+
throw new Error(`Insufficient rToken balance. Available: ${ethers_1.ethers.formatEther(userBalance)}, Requested: ${ethers_1.ethers.formatEther(amount)}`);
|
|
23
23
|
}
|
|
24
24
|
const approveTx = await rTokenContract.approve(lendingPoolAddress, amountInWei);
|
|
25
25
|
await approveTx.wait();
|
|
26
|
-
console.log(`Approved LendingPool to spend ${amount}
|
|
26
|
+
console.log(`Approved LendingPool to spend ${amount} rToken`);
|
|
27
27
|
// const withdraw = await lendingPoolContract.withdraw(amountInWei.toString(), {
|
|
28
28
|
// maxFeePerGas,
|
|
29
29
|
// nonce: await signer.getNonce()
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ethers_1 = require("ethers");
|
|
4
|
+
const contracts_1 = require("../../utils/contracts");
|
|
5
|
+
const artifacts_1 = require("../../utils/artifacts");
|
|
6
|
+
async function depositNFTToStabilityPool(chainId, tokenId, signer) {
|
|
7
|
+
if (!signer) {
|
|
8
|
+
throw new Error("Wallet not connected");
|
|
9
|
+
}
|
|
10
|
+
try {
|
|
11
|
+
const stabilityPoolAddress = (0, contracts_1.getContractAddress)(chainId, "stabilitypool");
|
|
12
|
+
const abi = (0, artifacts_1.getABI)("stabilitypool");
|
|
13
|
+
const stabilityPoolContract = new ethers_1.ethers.Contract(stabilityPoolAddress, abi, signer);
|
|
14
|
+
const RAACNFTAddress = (0, contracts_1.getContractAddress)(chainId, "raacnft");
|
|
15
|
+
const raacNFTABI = (0, artifacts_1.getABI)("raacnft");
|
|
16
|
+
const raacNFTContract = new ethers_1.ethers.Contract(RAACNFTAddress, raacNFTABI, signer);
|
|
17
|
+
const owner = await raacNFTContract.ownerOf(tokenId);
|
|
18
|
+
if (owner.toLowerCase() !== (await signer.getAddress()).toLowerCase()) {
|
|
19
|
+
throw new Error(`Signer does not own NFT #${tokenId}`);
|
|
20
|
+
}
|
|
21
|
+
// approve the disposal of the NFT
|
|
22
|
+
const approvalTx = await raacNFTContract.approve(stabilityPoolAddress, tokenId, {
|
|
23
|
+
nonce: await signer.getNonce(),
|
|
24
|
+
});
|
|
25
|
+
await approvalTx.wait();
|
|
26
|
+
console.log(`Approved stability pool to transfer NFT #${tokenId}`);
|
|
27
|
+
const tx = await stabilityPoolContract.depositNFT(RAACNFTAddress, tokenId, {
|
|
28
|
+
nonce: await signer.getNonce(),
|
|
29
|
+
});
|
|
30
|
+
console.log(`Deposit NFT transaction sent to Stability Pool:`, tx.hash);
|
|
31
|
+
const receipt = await tx.wait();
|
|
32
|
+
console.log(`Deposited token ${tokenId} to Stability Pool successfully:`, receipt?.hash);
|
|
33
|
+
return receipt;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error(`Error depositing NFT to Stability Pool:`, error);
|
|
37
|
+
throw new Error(`NFT Deposit to Stability Pool failed: ${error.message}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.default = depositNFTToStabilityPool;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ethers_1 = require("ethers");
|
|
4
|
+
const getContractAddress_1 = require("../../contracts/getContractAddress");
|
|
5
|
+
const artifacts_1 = require("../../utils/artifacts");
|
|
6
|
+
// Get the amount of RToken RAW deposit in the lending pool, without the accured interest
|
|
7
|
+
async function getRawUserDepositInStabilityPool(chainId, address, provider) {
|
|
8
|
+
try {
|
|
9
|
+
const stabilityPoolAddress = (0, getContractAddress_1.getContractAddress)(chainId, "stabilitypool");
|
|
10
|
+
const stabilityPoolABI = (0, artifacts_1.getABI)("stabilitypool");
|
|
11
|
+
const stabilityPoolContract = new ethers_1.ethers.Contract(stabilityPoolAddress, stabilityPoolABI, provider);
|
|
12
|
+
const value = await stabilityPoolContract.getUserDeposit(address);
|
|
13
|
+
console.log(`User deposits in stability pool: ${ethers_1.ethers.formatEther(value)}`);
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
console.error("Error in getRawUserDepositInStabilityPool:", error);
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.default = getRawUserDepositInStabilityPool;
|
|
@@ -17,16 +17,10 @@ async function getStabilityPoolInfo(chainId, address, provider) {
|
|
|
17
17
|
};
|
|
18
18
|
console.log(await stabilityPoolContract.deToken());
|
|
19
19
|
// Fetch data from StabilityPool
|
|
20
|
-
const [totalDeposits, totalAllocation
|
|
20
|
+
const [totalDeposits, totalAllocation] = await Promise.all([
|
|
21
21
|
stabilityPoolContract
|
|
22
22
|
.getTotalDeposits()
|
|
23
23
|
.catch(handleError("getTotalDeposits")),
|
|
24
|
-
stabilityPoolContract
|
|
25
|
-
.getTotalAllocation()
|
|
26
|
-
.catch(handleError("getTotalAllocation")),
|
|
27
|
-
stabilityPoolContract
|
|
28
|
-
.getExchangeRate()
|
|
29
|
-
.catch(handleError("getExchangeRate")),
|
|
30
24
|
stabilityPoolContract
|
|
31
25
|
.raacToken()
|
|
32
26
|
.then(async (raacTokenAddress) => {
|
|
@@ -51,9 +45,7 @@ async function getStabilityPoolInfo(chainId, address, provider) {
|
|
|
51
45
|
]);
|
|
52
46
|
}
|
|
53
47
|
// Fetch RAAC Minter information if needed for APY calculation
|
|
54
|
-
const raacMinterAddress =
|
|
55
|
-
.raacMinter()
|
|
56
|
-
.catch(handleError("raacMinter"));
|
|
48
|
+
const raacMinterAddress = (0, contracts_1.getContractAddress)(chainId, "raacminter");
|
|
57
49
|
let apy = 0n;
|
|
58
50
|
if (raacMinterAddress && raacMinterAddress !== ethers_1.ethers.ZeroAddress) {
|
|
59
51
|
const raacMinterABI = (0, artifacts_1.getABI)("raacminter");
|
|
@@ -74,8 +66,6 @@ async function getStabilityPoolInfo(chainId, address, provider) {
|
|
|
74
66
|
const result = {
|
|
75
67
|
totalDeposits: ethers_1.ethers.formatEther(totalDeposits ?? 0n),
|
|
76
68
|
totalAllocation: (totalAllocation ?? 0n).toString(),
|
|
77
|
-
exchangeRate: ethers_1.ethers.formatUnits(exchangeRate ?? 0n, 18),
|
|
78
|
-
totalRAACRewards: ethers_1.ethers.formatEther(totalRAACRewards ?? 0n),
|
|
79
69
|
userDeposit: ethers_1.ethers.formatEther(userDeposit ?? 0n),
|
|
80
70
|
pendingRewards: ethers_1.ethers.formatEther(pendingRewards ?? 0n),
|
|
81
71
|
apy: parseFloat((apy ?? 0n).toString()) / 100, // APY in percentage
|
package/dist/scripts/index.js
CHANGED
|
@@ -29,37 +29,63 @@ async function setup() {
|
|
|
29
29
|
rpc.provider = provider;
|
|
30
30
|
rpc.chainId = chainId;
|
|
31
31
|
// send myself some CRVUSD
|
|
32
|
-
await rpc.wallet.assets.mintAsset(chainId, "crvusd",
|
|
33
|
-
// // set the base uri to
|
|
34
|
-
await rpc.nfts.setBaseUri(chainId, "https://
|
|
35
|
-
// // set the oracle address of the RAACHousePrice. TEmporarily simulating that I AM THE ORACLE
|
|
32
|
+
await rpc.wallet.assets.mintAsset(chainId, "crvusd", 10000000n, signer.address, signer);
|
|
33
|
+
// // set the base uri to instruxi data gateway
|
|
34
|
+
await rpc.nfts.setBaseUri(chainId, "https://gateway-staging.instruxi.dev/api/v1/vnft/metadata/public/1/0x0000000000000000000000000000", signer);
|
|
35
|
+
// // // set the oracle address of the RAACHousePrice. TEmporarily simulating that I AM THE ORACLE
|
|
36
36
|
await rpc.contracts.housePrices.setOracle(chainId, signer.address, signer);
|
|
37
|
-
// // set price for 3 houses
|
|
37
|
+
// // // set price for 3 houses
|
|
38
38
|
const housePriceAddress = (0, contracts_1.getContractAddress)(chainId, "raachouseprices");
|
|
39
39
|
const housePriceABI = (0, artifacts_1.getABI)("raachouseprices");
|
|
40
40
|
const housePriceContract = new ethers_1.ethers.Contract(housePriceAddress, housePriceABI, signer);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
const raacNFTAddress = (0, contracts_1.getContractAddress)(chainId, "raacnft");
|
|
42
|
+
const raacNFTABI = (0, artifacts_1.getABI)("raacnft");
|
|
43
|
+
const raacNFTContract = new ethers_1.ethers.Contract(raacNFTAddress, raacNFTABI, signer);
|
|
44
|
+
const countTokens = 3;
|
|
45
|
+
// // Generate 10 house prices between 100K and 2M
|
|
46
|
+
const housePrices = [];
|
|
47
|
+
for (let i = 1; i <= countTokens; i++) {
|
|
48
|
+
const price = Math.floor(Math.random() * (2000000 - 100000) + 100000);
|
|
49
|
+
housePrices.push(price);
|
|
50
|
+
}
|
|
51
|
+
// // Mint the new properties
|
|
52
|
+
for (let i = 1; i <= countTokens; i++) {
|
|
53
|
+
const tx = await raacNFTContract.minterMint(signer.address, i);
|
|
54
|
+
await tx.wait();
|
|
55
|
+
console.log("Minted NFT", i);
|
|
54
56
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
// set house prices
|
|
58
|
+
for (let i = 1; i <= countTokens; i++) {
|
|
59
|
+
const tx = await housePriceContract.setHousePrice(i, (0, ethers_1.parseEther)(housePrices[i - 1].toString()));
|
|
60
|
+
await tx.wait();
|
|
61
|
+
console.log("Price set for house", i);
|
|
58
62
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
// confirm the house prices are set
|
|
64
|
+
for (let i = 1; i <= countTokens; i++) {
|
|
65
|
+
const price = await rpc.nfts.getHousePrice(chainId, i, provider);
|
|
66
|
+
console.log("Price for house", i, price);
|
|
67
|
+
if (price !== housePrices[i - 1].toString() + ".0") {
|
|
68
|
+
throw new Error("Price not set correctly");
|
|
69
|
+
}
|
|
62
70
|
}
|
|
71
|
+
// Generate some random NFT and set price only: not purchased yet
|
|
72
|
+
let nftIdStart = countTokens + 1;
|
|
73
|
+
let nftIdEnd = countTokens + 10;
|
|
74
|
+
for (let i = nftIdStart; i <= nftIdEnd; i++) {
|
|
75
|
+
const price = Math.floor(Math.random() * (2000000 - 100000) + 100000);
|
|
76
|
+
const tx = await housePriceContract.setHousePrice(i, (0, ethers_1.parseEther)(price.toString()));
|
|
77
|
+
await tx.wait();
|
|
78
|
+
console.log("Price set for house", i);
|
|
79
|
+
}
|
|
80
|
+
/// Temporary fix for stabillity pool setStabilityPool
|
|
81
|
+
const stabilityPoolAddress = (0, contracts_1.getContractAddress)(chainId, "stabilitypool");
|
|
82
|
+
const deTokenAddress = (0, contracts_1.getContractAddress)(chainId, "detoken");
|
|
83
|
+
const deTokenABI = (0, artifacts_1.getABI)("detoken");
|
|
84
|
+
const deTokenContract = new ethers_1.ethers.Contract(deTokenAddress, deTokenABI, signer);
|
|
85
|
+
const tx = await deTokenContract.setStabilityPool(stabilityPoolAddress);
|
|
86
|
+
await tx.wait();
|
|
87
|
+
console.log("Stability pool set to", stabilityPoolAddress);
|
|
88
|
+
fulfillRequest();
|
|
63
89
|
}
|
|
64
90
|
const execute = async () => {
|
|
65
91
|
const provider = await getProvider();
|
|
@@ -68,16 +94,45 @@ const execute = async () => {
|
|
|
68
94
|
rpc.address = signer.address;
|
|
69
95
|
rpc.provider = provider;
|
|
70
96
|
rpc.chainId = chainId;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
97
|
+
console.log(await rpc.contracts.indexToken.getNextRandomNFT(chainId, provider));
|
|
98
|
+
};
|
|
99
|
+
const updateNFTPrice = async (id, price) => {
|
|
100
|
+
const provider = await getProvider();
|
|
101
|
+
const signer = await createWallet(TEST_MNEMONIC, provider);
|
|
102
|
+
const rpc = new RPCLibrary_1.default();
|
|
103
|
+
rpc.address = signer.address;
|
|
104
|
+
rpc.provider = provider;
|
|
105
|
+
rpc.chainId = chainId;
|
|
106
|
+
const housePriceAddress = (0, contracts_1.getContractAddress)(chainId, "raachouseprices");
|
|
107
|
+
const housePriceABI = (0, artifacts_1.getABI)("raachouseprices");
|
|
108
|
+
const housePriceContract = new ethers_1.ethers.Contract(housePriceAddress, housePriceABI, signer);
|
|
109
|
+
let tx;
|
|
110
|
+
tx = await housePriceContract.setHousePrice(id, ethers_1.ethers.parseEther(price));
|
|
111
|
+
console.log(await rpc.nfts.getHousePrice(chainId, parseInt(id), provider));
|
|
112
|
+
};
|
|
113
|
+
const fulfillRequest = async () => {
|
|
114
|
+
const provider = await getProvider();
|
|
115
|
+
const signer = await createWallet(TEST_MNEMONIC, provider);
|
|
116
|
+
const rpc = new RPCLibrary_1.default();
|
|
117
|
+
rpc.address = signer.address;
|
|
118
|
+
rpc.provider = provider;
|
|
119
|
+
rpc.chainId = chainId;
|
|
120
|
+
const indexTokenAddress = (0, contracts_1.getContractAddress)(chainId, "indextoken");
|
|
121
|
+
const indexTokenABI = (0, artifacts_1.getABI)("indextoken");
|
|
122
|
+
const indexTokenContract = new ethers_1.ethers.Contract(indexTokenAddress, indexTokenABI, signer);
|
|
123
|
+
const vrfCoordinatorAddress = "0x9d4454B023096f34B160D6B654540c56A1F81688";
|
|
124
|
+
const vrfCoordinatorABI = (0, artifacts_1.getABI)("mockvrfcoordinator");
|
|
125
|
+
const vrfCoordinatorContract = new ethers_1.ethers.Contract(vrfCoordinatorAddress, vrfCoordinatorABI, signer);
|
|
126
|
+
const vrfConsumerAddress = "0x5eb3Bc0a489C5A8288765d2336659EbCA68FCd00";
|
|
127
|
+
const vrfConsumerABI = (0, artifacts_1.getABI)("vrfconsumer");
|
|
128
|
+
const vrfConsumerContract = new ethers_1.ethers.Contract(vrfConsumerAddress, vrfConsumerABI, signer);
|
|
129
|
+
await vrfCoordinatorContract.fulfillRandomWordsWithOverride(await vrfConsumerContract.lastRequestId(), vrfConsumerAddress, [12]);
|
|
130
|
+
const nextRandom = await vrfConsumerContract.getRequestStatus();
|
|
131
|
+
console.log("Next random number", nextRandom);
|
|
132
|
+
const redemptionToken = await rpc.contracts.indexToken.getNextRandomNFT(chainId, provider);
|
|
133
|
+
console.log("Redemption token", redemptionToken);
|
|
81
134
|
};
|
|
82
|
-
execute();
|
|
135
|
+
// execute();
|
|
83
136
|
// setup();
|
|
137
|
+
fulfillRequest();
|
|
138
|
+
// updateNFTPrice("7", "1650000");
|
|
@@ -20,10 +20,8 @@ import withdrawNFTFromLendingPool from "./pools/lendingPool/withdrawNFTFromLendi
|
|
|
20
20
|
import getHousePrice from "./pools/lendingPool/getHousePrice";
|
|
21
21
|
import mintNFT from "./nfts/mint";
|
|
22
22
|
import getNFTHousePrice from "./nfts/getHousePrice";
|
|
23
|
-
import addNewNFTBatch from "./nfts/addNewBatch";
|
|
24
23
|
import setNFTBaseUri from "./nfts/setBaseUri";
|
|
25
|
-
import
|
|
26
|
-
import getOwnedNFTs from "./nfts/getOwnedNFTs";
|
|
24
|
+
import getTokensByOwner from "./nfts/getTokensByOwner";
|
|
27
25
|
import getContractAddress from "./contracts/getContractAddress";
|
|
28
26
|
import getContract from "./contracts/getContract";
|
|
29
27
|
import getLatestPrice from "./contracts/housePrices/getLatestPrice";
|
|
@@ -44,7 +42,33 @@ import createAuction from "./contracts/zeno/createAuction";
|
|
|
44
42
|
import createZeno from "./contracts/zeno/createZeno";
|
|
45
43
|
import getZenos from "./contracts/zeno/getZenos";
|
|
46
44
|
import { ChainId } from "./configs/chains";
|
|
47
|
-
import
|
|
45
|
+
import getBaseUri from "./nfts/getBaseUri";
|
|
46
|
+
import getAllUserData from "./pools/lendingPool/getAllUserData";
|
|
47
|
+
import claimRewardFromPool from "./contracts/feeCollector/claimRewardFromPool";
|
|
48
|
+
import claimReward from "./pools/lendingPool/claimReward";
|
|
49
|
+
import getPendingReward from "./pools/lendingPool/getPendingReward";
|
|
50
|
+
import getRawUserDepositsInLendingPool from "./pools/lendingPool/getRawUserDepositsInLendingPool";
|
|
51
|
+
import getRawUserDepositInStabilityPool from "./pools/stabilityPool/getRawUserDepositsInStabilityPool";
|
|
52
|
+
import getEligibleUserDeposits from "./pools/lendingPool/getEligibleUserDeposits";
|
|
53
|
+
import getMintPrice from "./nfts/getMintPrice";
|
|
54
|
+
import getMintFeePercentage from "./nfts/getMintFeePercentage";
|
|
55
|
+
import getAllTokens from "./nfts/getAllTokens";
|
|
56
|
+
import totalNFTSupply from "./nfts/totalNFTSupply";
|
|
57
|
+
import getTokenURI from "./nfts/getTokenURI";
|
|
58
|
+
import getHealthFactor from "./pools/lendingPool/getHealthFactor";
|
|
59
|
+
import getPositionDebt from "./pools/lendingPool/getPositionDebt";
|
|
60
|
+
import getPositionScaledDebt from "./pools/lendingPool/getPositionScaledDebt";
|
|
61
|
+
import getPositionsScaledDebt from "./pools/lendingPool/getPositionsScaledDebt";
|
|
62
|
+
import getPositionView from "./pools/lendingPool/getPositionView";
|
|
63
|
+
import getUserCollateralValue from "./pools/lendingPool/getUserCollateralValue";
|
|
64
|
+
import initializeLiquidation from "./pools/lendingPool/initializeLiquidation";
|
|
65
|
+
import closeLiquidation from "./pools/lendingPool/closeLiquidation";
|
|
66
|
+
import borrowFromLendingPoolWithInsurance from "./pools/lendingPool/borrowFromLendingPoolWithInsurance";
|
|
67
|
+
import depositNFTToStabilityPool from "./pools/stabilityPool/depositNFTToStabilityPool";
|
|
68
|
+
import redeemNFT from "./contracts/indexToken/redeemNFT";
|
|
69
|
+
import getNextRandomNFT from "./contracts/indexToken/getNextRandomNFT";
|
|
70
|
+
import calculateInsuranceFee from "./pools/lendingPool/calculateInsuranceFee";
|
|
71
|
+
import getTotalPropertiesCount from "./nfts/getTotalPropertiesCount";
|
|
48
72
|
declare class RPCLibrary {
|
|
49
73
|
signer: Signer | null;
|
|
50
74
|
isConnected: boolean;
|
|
@@ -69,13 +93,17 @@ declare class RPCLibrary {
|
|
|
69
93
|
};
|
|
70
94
|
};
|
|
71
95
|
nfts: {
|
|
96
|
+
getBaseUri: typeof getBaseUri;
|
|
72
97
|
mint: typeof mintNFT;
|
|
73
98
|
getHousePrice: typeof getNFTHousePrice;
|
|
74
|
-
|
|
75
|
-
getDepositedNFTs: typeof getDepositedNFTs;
|
|
76
|
-
addNewBatch: typeof addNewNFTBatch;
|
|
99
|
+
getTokensByOwner: typeof getTokensByOwner;
|
|
77
100
|
setBaseUri: typeof setNFTBaseUri;
|
|
78
|
-
|
|
101
|
+
totalSupply: typeof totalNFTSupply;
|
|
102
|
+
getMintPrice: typeof getMintPrice;
|
|
103
|
+
getMintFeePercentage: typeof getMintFeePercentage;
|
|
104
|
+
getAllTokens: typeof getAllTokens;
|
|
105
|
+
getTokenURI: typeof getTokenURI;
|
|
106
|
+
getTotalPropertiesCount: typeof getTotalPropertiesCount;
|
|
79
107
|
};
|
|
80
108
|
contracts: {
|
|
81
109
|
housePrices: {
|
|
@@ -89,6 +117,13 @@ declare class RPCLibrary {
|
|
|
89
117
|
};
|
|
90
118
|
getContractAddress: typeof getContractAddress;
|
|
91
119
|
getContract: typeof getContract;
|
|
120
|
+
feeCollector: {
|
|
121
|
+
claimRewardFromPool: typeof claimRewardFromPool;
|
|
122
|
+
};
|
|
123
|
+
indexToken: {
|
|
124
|
+
getNextRandomNFT: typeof getNextRandomNFT;
|
|
125
|
+
redeemNFT: typeof redeemNFT;
|
|
126
|
+
};
|
|
92
127
|
};
|
|
93
128
|
pools: {
|
|
94
129
|
stabilityPool: {
|
|
@@ -96,6 +131,8 @@ declare class RPCLibrary {
|
|
|
96
131
|
depositToStabilityPool: typeof depositToStabilityPool;
|
|
97
132
|
withdrawFromStabilityPool: typeof withdrawFromStabilityPool;
|
|
98
133
|
calculateRAACRewards: typeof calculateRAACRewards;
|
|
134
|
+
getRawUserDepositInStabilityPool: typeof getRawUserDepositInStabilityPool;
|
|
135
|
+
depositNFTToStabilityPool: typeof depositNFTToStabilityPool;
|
|
99
136
|
};
|
|
100
137
|
lendingPool: {
|
|
101
138
|
repayToLendingPool: typeof repayToLendingPool;
|
|
@@ -104,6 +141,22 @@ declare class RPCLibrary {
|
|
|
104
141
|
depositNFTToLendingPool: typeof depositNFTToLendingPool;
|
|
105
142
|
withdrawNFTFromLendingPool: typeof withdrawNFTFromLendingPool;
|
|
106
143
|
getLendingPoolInfo: typeof getLendingPoolInfo;
|
|
144
|
+
getAllUserData: typeof getAllUserData;
|
|
145
|
+
claimReward: typeof claimReward;
|
|
146
|
+
getPendingReward: typeof getPendingReward;
|
|
147
|
+
getRawUserDepositsInLendingPool: typeof getRawUserDepositsInLendingPool;
|
|
148
|
+
getEligibleUserDeposits: typeof getEligibleUserDeposits;
|
|
149
|
+
getHealthFactor: typeof getHealthFactor;
|
|
150
|
+
getPositionDebt: typeof getPositionDebt;
|
|
151
|
+
getPositionScaledDebt: typeof getPositionScaledDebt;
|
|
152
|
+
getPositionsScaledDebt: typeof getPositionsScaledDebt;
|
|
153
|
+
getPositionView: typeof getPositionView;
|
|
154
|
+
getUserCollateralValue: typeof getUserCollateralValue;
|
|
155
|
+
depositToLendingPool: typeof depositToLendingPool;
|
|
156
|
+
initializeLiquidation: typeof initializeLiquidation;
|
|
157
|
+
closeLiquidation: typeof closeLiquidation;
|
|
158
|
+
borrowFromLendingPoolWithInsurance: typeof borrowFromLendingPoolWithInsurance;
|
|
159
|
+
calculateInsuranceFee: typeof calculateInsuranceFee;
|
|
107
160
|
};
|
|
108
161
|
depositToLendingPool: typeof depositToLendingPool;
|
|
109
162
|
withdrawFromLendingPool: typeof withdrawFromLendingPool;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { Chain8453 } from "./chain";
|
|
1
|
+
import { Chain8453, Chain11155111 } from "./chain";
|
|
2
2
|
declare const chains: {
|
|
3
3
|
8453: Chain8453;
|
|
4
|
+
17000: Chain8453;
|
|
5
|
+
11155111: Chain11155111;
|
|
4
6
|
};
|
|
5
7
|
export default chains;
|
|
6
8
|
export declare const configs: {
|
|
7
9
|
8453: Chain8453;
|
|
10
|
+
17000: Chain8453;
|
|
11
|
+
11155111: Chain11155111;
|
|
8
12
|
};
|
|
9
13
|
export type Configs = typeof chains;
|
|
10
14
|
export type ConfigKeys = keyof Configs;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ChainId } from "./chains/index";
|
|
2
2
|
declare function getChainsConfig(): {
|
|
3
3
|
8453: import("./chains/chain").Chain8453;
|
|
4
|
+
17000: import("./chains/chain").Chain8453;
|
|
5
|
+
11155111: import("./chains/chain").Chain11155111;
|
|
4
6
|
};
|
|
5
7
|
declare function setChainConfig(chainId: ChainId, config: any): void;
|
|
6
8
|
declare function getChainConfig(chainId: ChainId): any;
|