@raac/rpc 1.1.0-beta.64 → 1.1.0-beta.66
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 +4 -0
- package/dist/configs/chains/11155111.json +20 -20
- package/dist/pools/rwaVault/previewDeposit.js +16 -0
- package/dist/pools/rwaVault/previewWithdraw.js +16 -0
- package/dist/scripts/index.js +29 -31
- package/dist/types/RPCLibrary.d.ts +4 -0
- package/dist/types/pools/rwaVault/previewDeposit.d.ts +4 -0
- package/dist/types/pools/rwaVault/previewWithdraw.d.ts +4 -0
- package/package.json +1 -1
package/dist/RPCLibrary.js
CHANGED
|
@@ -43,6 +43,8 @@ const redeemNFTFromRWAVault_1 = __importDefault(require("./pools/rwaVault/redeem
|
|
|
43
43
|
const getRWAVaultInfo_1 = __importDefault(require("./pools/rwaVault/getRWAVaultInfo"));
|
|
44
44
|
const getNextRandomNFT_1 = __importDefault(require("./pools/rwaVault/getNextRandomNFT"));
|
|
45
45
|
const requestRandomSeed_1 = __importDefault(require("./pools/rwaVault/requestRandomSeed"));
|
|
46
|
+
const previewDeposit_1 = __importDefault(require("./pools/rwaVault/previewDeposit"));
|
|
47
|
+
const previewWithdraw_1 = __importDefault(require("./pools/rwaVault/previewWithdraw"));
|
|
46
48
|
// ERC20 Vault Adapter
|
|
47
49
|
const getERC20VaultAdapterInfo_1 = __importDefault(require("./pools/rwaVault/adapters/erc20/getERC20VaultAdapterInfo"));
|
|
48
50
|
const getERC20VaultAdapterTotalValue_1 = __importDefault(require("./pools/rwaVault/adapters/erc20/getERC20VaultAdapterTotalValue"));
|
|
@@ -271,6 +273,8 @@ class RPCLibrary {
|
|
|
271
273
|
getAdapters: getAdapters_2.default,
|
|
272
274
|
getAdapterAddress: getAdapterAddress_2.getAdapterAddress,
|
|
273
275
|
getAdapterAddressOnly: getAdapterAddress_2.getAdapterAddressOnly,
|
|
276
|
+
previewDeposit: previewDeposit_1.default,
|
|
277
|
+
previewWithdraw: previewWithdraw_1.default,
|
|
274
278
|
},
|
|
275
279
|
depositToLendingPool: depositToLendingPool_1.default,
|
|
276
280
|
withdrawFromLendingPool: withdrawFromLendingPool_1.default,
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"raachouseprices": {
|
|
18
18
|
"id": "raachouseprices",
|
|
19
19
|
"name": "RAAC House Prices",
|
|
20
|
-
"contract": "
|
|
20
|
+
"contract": "0x51F784aD035108a6Cc2EeD3209544F63fD9526B7"
|
|
21
21
|
},
|
|
22
22
|
"auctionfactory": {
|
|
23
23
|
"id": "auctionfactory",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"feecollector": {
|
|
38
38
|
"id": "feecollector",
|
|
39
39
|
"name": "Fee Collector",
|
|
40
|
-
"contract": "
|
|
40
|
+
"contract": "0xd33240f50fE9bc4FcD3CfF4361c23D47b321A686"
|
|
41
41
|
},
|
|
42
42
|
"treasury": {
|
|
43
43
|
"id": "treasury",
|
|
44
44
|
"name": "Treasury",
|
|
45
|
-
"contract": "
|
|
45
|
+
"contract": "0x3a9155B273b3e645dAE14C5994f81a4658c2DF6a"
|
|
46
46
|
},
|
|
47
47
|
"repairfund": {
|
|
48
48
|
"id": "repairfund",
|
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
"rwavault": {
|
|
58
58
|
"id": "rwavault",
|
|
59
59
|
"name": "RWA Vault",
|
|
60
|
-
"contract": "
|
|
60
|
+
"contract": "0xb5dC159499c77E334C290c001a67EeF8afea64aE"
|
|
61
61
|
},
|
|
62
62
|
"complianceregistry": {
|
|
63
63
|
"id": "complianceregistry",
|
|
64
64
|
"name": "Compliance Registry",
|
|
65
|
-
"contract": "
|
|
65
|
+
"contract": "0x8900603219B342994386D7d2fCAFa60f61389323"
|
|
66
66
|
},
|
|
67
67
|
"rwaindextokencollector": {
|
|
68
68
|
"id": "rwaindextokencollector",
|
|
69
69
|
"name": "RWA Index Token Collector",
|
|
70
|
-
"contract": "
|
|
70
|
+
"contract": "0xB4655c3bd694A1b36325C2C3401aFd3AE1BDc0B8"
|
|
71
71
|
},
|
|
72
72
|
"raactokencollector": {
|
|
73
73
|
"id": "raactokencollector",
|
|
@@ -77,31 +77,31 @@
|
|
|
77
77
|
"raachousepriceoracle": {
|
|
78
78
|
"id": "raachousepriceoracle",
|
|
79
79
|
"name": "RAAC House Price Oracle",
|
|
80
|
-
"contract": "
|
|
80
|
+
"contract": "0xB76b3b2B3C93F0E00cABE36841A0d3Fb8E940555"
|
|
81
81
|
},
|
|
82
82
|
"raacprimerateoracle": {
|
|
83
83
|
"id": "raacprimerateoracle",
|
|
84
84
|
"name": "RAAC Prime Rate Oracle",
|
|
85
|
-
"contract": "
|
|
85
|
+
"contract": "0x6b61186d23a8303a92F56301594d05ea7dcC24b9"
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
88
|
"pools": {
|
|
89
89
|
"stabilitypool": {
|
|
90
90
|
"id": "stabilitypool",
|
|
91
91
|
"name": "Stability Pool",
|
|
92
|
-
"contract": "
|
|
92
|
+
"contract": "0x7BDa7267213033db43664a3686fe17b93C760f18"
|
|
93
93
|
},
|
|
94
94
|
"lendingpool": {
|
|
95
95
|
"id": "lendingpool",
|
|
96
96
|
"name": "Lending Pool",
|
|
97
|
-
"contract": "
|
|
97
|
+
"contract": "0x410Dd45146cF8255078331e43D2b2748D2425B67"
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
100
|
"nfts": {
|
|
101
101
|
"raacnft": {
|
|
102
102
|
"id": "raacnft",
|
|
103
103
|
"name": "RAAC NFT",
|
|
104
|
-
"contract": "
|
|
104
|
+
"contract": "0x550970B27e0344Bd0Ec96a5Ca69Ec5Fe97c7a6DC"
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
107
|
"assets": {
|
|
@@ -115,19 +115,19 @@
|
|
|
115
115
|
"id": "crvusd",
|
|
116
116
|
"name": "CRVUSD",
|
|
117
117
|
"decimals": 18,
|
|
118
|
-
"contract": "
|
|
118
|
+
"contract": "0x121C5c6bF495712213b622baF8d10D61FfEE8fce"
|
|
119
119
|
},
|
|
120
120
|
"rtoken": {
|
|
121
121
|
"id": "rtoken",
|
|
122
122
|
"name": "RToken",
|
|
123
123
|
"decimals": 18,
|
|
124
|
-
"contract": "
|
|
124
|
+
"contract": "0x049774bBec00B4b2E27eb0781F769b2F7F164678"
|
|
125
125
|
},
|
|
126
126
|
"detoken": {
|
|
127
127
|
"id": "detoken",
|
|
128
128
|
"name": "DEToken",
|
|
129
129
|
"decimals": 18,
|
|
130
|
-
"contract": "
|
|
130
|
+
"contract": "0xca3ba8883f5081C10BdD6CF9CFCc9148F6d4746A"
|
|
131
131
|
},
|
|
132
132
|
"raactoken": {
|
|
133
133
|
"id": "raactoken",
|
|
@@ -145,13 +145,13 @@
|
|
|
145
145
|
"id": "debttoken",
|
|
146
146
|
"name": "Debt Token",
|
|
147
147
|
"decimals": 18,
|
|
148
|
-
"contract": "
|
|
148
|
+
"contract": "0xb549f7e7cC2df4417a04b4160055ee2dC3AD54Da"
|
|
149
149
|
},
|
|
150
150
|
"rwaindextoken": {
|
|
151
151
|
"id": "rwaindextoken",
|
|
152
152
|
"name": "RWA Index Token",
|
|
153
153
|
"decimals": 18,
|
|
154
|
-
"contract": "
|
|
154
|
+
"contract": "0xE6360bbAA1a322EfEB170965F8F1A627DFFBeF88"
|
|
155
155
|
}
|
|
156
156
|
},
|
|
157
157
|
"adapters": {
|
|
@@ -159,13 +159,13 @@
|
|
|
159
159
|
"raacnftadapter": {
|
|
160
160
|
"id": "raacnftadapter",
|
|
161
161
|
"name": "RAAC NFT Adapter",
|
|
162
|
-
"contract": "
|
|
162
|
+
"contract": "0x5aB19C3E0671A6dC6E30a7430C4B4C8d3646643A",
|
|
163
163
|
"type": "ERC721"
|
|
164
164
|
},
|
|
165
165
|
"rwaindextokenadapter": {
|
|
166
166
|
"id": "rwaindextokenadapter",
|
|
167
167
|
"name": "RWA Index Token",
|
|
168
|
-
"contract": "
|
|
168
|
+
"contract": "0x850caBB9C4C2f2f8EC2f207AD78592C6a1A14858",
|
|
169
169
|
"type": "ERC20"
|
|
170
170
|
}
|
|
171
171
|
},
|
|
@@ -173,13 +173,13 @@
|
|
|
173
173
|
"raacnftadapter": {
|
|
174
174
|
"id": "raacnftadapter",
|
|
175
175
|
"name": "RAAC NFT Adapter",
|
|
176
|
-
"contract": "
|
|
176
|
+
"contract": "0xa8D4f23d1cB8E730B75f66A02bD5eD4569c60675",
|
|
177
177
|
"type": "ERC721"
|
|
178
178
|
},
|
|
179
179
|
"crvusdadapter": {
|
|
180
180
|
"id": "crvusdadapter",
|
|
181
181
|
"name": "CRVUSD Adapter",
|
|
182
|
-
"contract": "
|
|
182
|
+
"contract": "0x0601a7b036F1894564757CEA3044Cf25d5cC82E2",
|
|
183
183
|
"type": "ERC20"
|
|
184
184
|
}
|
|
185
185
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ethers_1 = require("ethers");
|
|
4
|
+
const _helpers_1 = require("./_helpers");
|
|
5
|
+
async function previewDeposit(chainId, assetValue, provider) {
|
|
6
|
+
try {
|
|
7
|
+
const rwaVaultContract = await (0, _helpers_1.getRWAVaultContract)(chainId, provider);
|
|
8
|
+
const shares = await rwaVaultContract.previewDeposit(ethers_1.ethers.parseEther(assetValue));
|
|
9
|
+
return shares;
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
console.error(`Error depositing to RWA Vault:`, error);
|
|
13
|
+
throw new Error(`Deposit to RWA Vault failed: ${error.message}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.default = previewDeposit;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ethers_1 = require("ethers");
|
|
4
|
+
const _helpers_1 = require("./_helpers");
|
|
5
|
+
async function previewWithdraw(chainId, assetValue, provider) {
|
|
6
|
+
try {
|
|
7
|
+
const rwaVaultContract = await (0, _helpers_1.getRWAVaultContract)(chainId, provider);
|
|
8
|
+
const shares = await rwaVaultContract.previewDeposit(ethers_1.ethers.parseEther(assetValue));
|
|
9
|
+
return shares;
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
console.error(`Error depositing to RWA Vault:`, error);
|
|
13
|
+
throw new Error(`Deposit to RWA Vault failed: ${error.message}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.default = previewWithdraw;
|
package/dist/scripts/index.js
CHANGED
|
@@ -11,7 +11,8 @@ const contracts_1 = require("../utils/contracts");
|
|
|
11
11
|
const artifacts_1 = require("../utils/artifacts");
|
|
12
12
|
const _helpers_1 = require("../pools/rwaVault/_helpers");
|
|
13
13
|
const ethers5_1 = require("ethers5");
|
|
14
|
-
const
|
|
14
|
+
const encryptSecretURLs_1 = require("../oracles/encryptSecretURLs");
|
|
15
|
+
const chainId = 11155111;
|
|
15
16
|
const config = chains_1.default[chainId];
|
|
16
17
|
const TEST_MNEMONIC = process.env.TEST_MNEMONIC;
|
|
17
18
|
const TEST_PRIVATE_KEY = process.env.TEST_PRIVATE_KEY;
|
|
@@ -66,16 +67,13 @@ async function setup() {
|
|
|
66
67
|
const TreasuryAddress = (0, contracts_1.getContractAddress)(chainId, "treasury");
|
|
67
68
|
const TreasuryABI = (0, artifacts_1.getABI)("treasury");
|
|
68
69
|
const TreasuryContract = new ethers_1.ethers.Contract(TreasuryAddress, TreasuryABI, signer);
|
|
69
|
-
console.log(await LendingPoolContract.parameters());
|
|
70
|
-
// await rpc.pools.lendingPool.openVaultPosition(chainId, signer);
|
|
71
|
-
console.log(await lendingPoolContract.vaultOpened(signer.address));
|
|
72
70
|
// const secretsReference = await encryptSecrets(chainId, {
|
|
73
71
|
// apiKey: process.env.FRED_API_KEY as string,
|
|
74
72
|
// }, "encryptedFunctionsPrimeRateSecrets.json", signerV5);
|
|
75
73
|
// console.log(secretsReference);
|
|
76
74
|
// return;
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
const encryptedURL = await (0, encryptSecretURLs_1.encryptSecretURLs)(chainId, ["https://emerald-many-grasshopper-318.mypinata.cloud/ipfs/bafkreifvuyg7rsfx2wbyeulc267mvg5nwak2ggaxnr723zbekuzycjiysa"], signerV5);
|
|
76
|
+
console.log(encryptedURL);
|
|
79
77
|
// const secretReference = await generateSecretReference(chainId, {
|
|
80
78
|
// ATTESTATIONS_AUDITOR_BISCUIT: process.env.ATTESTATIONS_AUDITOR_BISCUIT as string,
|
|
81
79
|
// ATTESTATION_BATCHES_BISCUIT: process.env.ATTESTATION_BATCHES_BISCUIT as string,
|
|
@@ -130,11 +128,7 @@ async function setup() {
|
|
|
130
128
|
// signer
|
|
131
129
|
// );
|
|
132
130
|
// set the base uri to instruxi data gateway
|
|
133
|
-
|
|
134
|
-
// chainId,
|
|
135
|
-
// "http://3.86.253.54:3000/v1/properties/",
|
|
136
|
-
// signer
|
|
137
|
-
// );
|
|
131
|
+
await rpc.nfts.setBaseUri(chainId, "http://3.86.253.54:3000/v1/properties/", signer);
|
|
138
132
|
// return;
|
|
139
133
|
const RWAVaultAddress = (0, contracts_1.getContractAddress)(chainId, "rwavault");
|
|
140
134
|
const RWAVaultABI = (0, artifacts_1.getABI)("rwavault");
|
|
@@ -147,38 +141,42 @@ async function setup() {
|
|
|
147
141
|
// if (chainId !== 8453) {
|
|
148
142
|
// return;
|
|
149
143
|
// }
|
|
150
|
-
console.log("hello");
|
|
151
144
|
// // // set the oracle address of the RAACHousePrice. TEmporarily simulating that I AM THE ORACLE
|
|
152
145
|
// await rpc.contracts.housePrices.setOracle(chainId, signer.address, signer);
|
|
153
146
|
const raacNFTAddress = (0, contracts_1.getContractAddress)(chainId, "raacnft");
|
|
154
147
|
const raacNFTABI = (0, artifacts_1.getABI)("raacnft");
|
|
155
148
|
const raacNFTContract = new ethers_1.ethers.Contract(raacNFTAddress, raacNFTABI, signer);
|
|
156
|
-
const countTokens =
|
|
149
|
+
const countTokens = 100;
|
|
157
150
|
// // // // Generate 10 house prices between 100K and 2M
|
|
158
151
|
const housePrices = [];
|
|
159
152
|
for (let i = 1; i <= countTokens; i++) {
|
|
160
153
|
const price = Math.floor(Math.random() * (2000000 - 100000) + 100000);
|
|
161
|
-
housePrices.push(price);
|
|
154
|
+
housePrices.push(ethers_1.ethers.parseEther(price.toString()));
|
|
162
155
|
}
|
|
163
156
|
// // // Mint the new properties
|
|
164
|
-
for (let i = 1; i <=
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
157
|
+
// for (let i = 1; i <= 5; i++) {
|
|
158
|
+
// const tx = await raacNFTContract.minterMint(signer.address, i);
|
|
159
|
+
// await tx.wait();
|
|
160
|
+
// console.log("Minted NFT", i);
|
|
161
|
+
// }
|
|
162
|
+
const tokenIds = new Array(countTokens).fill(0).map((_, i) => BigInt(i + 1));
|
|
163
|
+
await (await housePriceContract.setHousePrices(tokenIds, housePrices)).wait();
|
|
169
164
|
// // set house prices
|
|
170
|
-
for (let i = 1; i <= countTokens; i++) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
165
|
+
// for (let i = 1; i <= countTokens; i++) {
|
|
166
|
+
// const tx = await housePriceContract.setHousePrice(
|
|
167
|
+
// i,
|
|
168
|
+
// parseEther(housePrices[i - 1].toString())
|
|
169
|
+
// );
|
|
170
|
+
// await tx.wait();
|
|
171
|
+
// console.log("Price set for house", i);
|
|
172
|
+
// }
|
|
173
|
+
// for (let i = 1; i <= countTokens; i++) {
|
|
174
|
+
// const price = await rpc.nfts.getHousePrice(chainId, i, provider);
|
|
175
|
+
// console.log("Price for house", i, price);
|
|
176
|
+
// if (price !== housePrices[i - 1].toString() + ".0") {
|
|
177
|
+
// throw new Error("Price not set correctly");
|
|
178
|
+
// }
|
|
179
|
+
// }
|
|
182
180
|
}
|
|
183
181
|
const execute = async () => {
|
|
184
182
|
const provider = await getProvider();
|
|
@@ -26,6 +26,8 @@ import redeemNFTFromRWAVault from "./pools/rwaVault/redeemNFTFromRWAVault";
|
|
|
26
26
|
import getRWAVaultInfo from "./pools/rwaVault/getRWAVaultInfo";
|
|
27
27
|
import getNextRandomNFT from "./pools/rwaVault/getNextRandomNFT";
|
|
28
28
|
import requestRandomSeed from "./pools/rwaVault/requestRandomSeed";
|
|
29
|
+
import previewDeposit from "./pools/rwaVault/previewDeposit";
|
|
30
|
+
import previewWithdraw from "./pools/rwaVault/previewWithdraw";
|
|
29
31
|
import getERC20VaultAdapterInfo from "./pools/rwaVault/adapters/erc20/getERC20VaultAdapterInfo";
|
|
30
32
|
import getERC20VaultAdapterTotalValue from "./pools/rwaVault/adapters/erc20/getERC20VaultAdapterTotalValue";
|
|
31
33
|
import getERC20VaultAdapterAssetValue from "./pools/rwaVault/adapters/erc20/getERC20VaultAdapterAssetValue";
|
|
@@ -210,6 +212,8 @@ declare class RPCLibrary {
|
|
|
210
212
|
getAdapters: typeof getRWAVaultAdapters;
|
|
211
213
|
getAdapterAddress: typeof getRWAVaultAdapterAddress;
|
|
212
214
|
getAdapterAddressOnly: typeof getRWAVaultAdapterAddressOnly;
|
|
215
|
+
previewDeposit: typeof previewDeposit;
|
|
216
|
+
previewWithdraw: typeof previewWithdraw;
|
|
213
217
|
};
|
|
214
218
|
depositToLendingPool: typeof depositToLendingPool;
|
|
215
219
|
withdrawFromLendingPool: typeof withdrawFromLendingPool;
|