@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.
@@ -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": "0x3a933ab12852a30c83dFDeAEf4a67b84241B0acc"
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": "0x08831baeC732C9a47C18016c1A9A17611e0B903d"
40
+ "contract": "0xd33240f50fE9bc4FcD3CfF4361c23D47b321A686"
41
41
  },
42
42
  "treasury": {
43
43
  "id": "treasury",
44
44
  "name": "Treasury",
45
- "contract": "0xfDD625D9E062ff2b31eBe9130162B775d3975e49"
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": "0x4e41b7d32D2AeD257e479a9d76ee00A3F38Cf38E"
60
+ "contract": "0xb5dC159499c77E334C290c001a67EeF8afea64aE"
61
61
  },
62
62
  "complianceregistry": {
63
63
  "id": "complianceregistry",
64
64
  "name": "Compliance Registry",
65
- "contract": "0x7Cc1CA23F8fff6B51074131140e0928Df7043633"
65
+ "contract": "0x8900603219B342994386D7d2fCAFa60f61389323"
66
66
  },
67
67
  "rwaindextokencollector": {
68
68
  "id": "rwaindextokencollector",
69
69
  "name": "RWA Index Token Collector",
70
- "contract": "0x958faB88A3adD2c76870F1ca4c5dC8042bFB860f"
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": "0x7Ff66b2700c5F75fcD17c810e17E948276C11aA3"
80
+ "contract": "0xB76b3b2B3C93F0E00cABE36841A0d3Fb8E940555"
81
81
  },
82
82
  "raacprimerateoracle": {
83
83
  "id": "raacprimerateoracle",
84
84
  "name": "RAAC Prime Rate Oracle",
85
- "contract": "0x3c3Daa41c3Cf41d51AE2a56749D673C73DE04A6B"
85
+ "contract": "0x6b61186d23a8303a92F56301594d05ea7dcC24b9"
86
86
  }
87
87
  },
88
88
  "pools": {
89
89
  "stabilitypool": {
90
90
  "id": "stabilitypool",
91
91
  "name": "Stability Pool",
92
- "contract": "0x2Aada221CAC2A2366407792CDD47924f7F75D232"
92
+ "contract": "0x7BDa7267213033db43664a3686fe17b93C760f18"
93
93
  },
94
94
  "lendingpool": {
95
95
  "id": "lendingpool",
96
96
  "name": "Lending Pool",
97
- "contract": "0x039C516918D76F0e508E3AeF404a1a0193903A94"
97
+ "contract": "0x410Dd45146cF8255078331e43D2b2748D2425B67"
98
98
  }
99
99
  },
100
100
  "nfts": {
101
101
  "raacnft": {
102
102
  "id": "raacnft",
103
103
  "name": "RAAC NFT",
104
- "contract": "0x9f732c8082a660a89A55ec7551d90393572F5d42"
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": "0xd39d5D3289B6B76D4d584a9cD58AED99442D29eb"
118
+ "contract": "0x121C5c6bF495712213b622baF8d10D61FfEE8fce"
119
119
  },
120
120
  "rtoken": {
121
121
  "id": "rtoken",
122
122
  "name": "RToken",
123
123
  "decimals": 18,
124
- "contract": "0x3fea2bF12b686FfFD0321DA6CA6c762FA7C2121C"
124
+ "contract": "0x049774bBec00B4b2E27eb0781F769b2F7F164678"
125
125
  },
126
126
  "detoken": {
127
127
  "id": "detoken",
128
128
  "name": "DEToken",
129
129
  "decimals": 18,
130
- "contract": "0xdCB4C5aB4aE4873ec700C3EACD1f338547cE6117"
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": "0x6f81d033a6F87d987851086cf44214D6c0730089"
148
+ "contract": "0xb549f7e7cC2df4417a04b4160055ee2dC3AD54Da"
149
149
  },
150
150
  "rwaindextoken": {
151
151
  "id": "rwaindextoken",
152
152
  "name": "RWA Index Token",
153
153
  "decimals": 18,
154
- "contract": "0xc23b30B0fd654f51e6b833d3d550c320c0f32018"
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": "0x8DCc5f781933A6232d7aA6003cb5b07138B7A8AA",
162
+ "contract": "0x5aB19C3E0671A6dC6E30a7430C4B4C8d3646643A",
163
163
  "type": "ERC721"
164
164
  },
165
165
  "rwaindextokenadapter": {
166
166
  "id": "rwaindextokenadapter",
167
167
  "name": "RWA Index Token",
168
- "contract": "0x204B3Cfe37734F80C73958c9C188d23ec120C1d5",
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": "0x0C45430F37ce079740b55B323c090b3B498DBdf0",
176
+ "contract": "0xa8D4f23d1cB8E730B75f66A02bD5eD4569c60675",
177
177
  "type": "ERC721"
178
178
  },
179
179
  "crvusdadapter": {
180
180
  "id": "crvusdadapter",
181
181
  "name": "CRVUSD Adapter",
182
- "contract": "0x0a72162CF100A5494Ca8593a8c1A906Ff8349CAB",
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;
@@ -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 chainId = 8453;
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
- // const encryptedURL = await encryptSecretURLs(chainId, ["https://emerald-many-grasshopper-318.mypinata.cloud/ipfs/bafkreidwvgtxxeijgdfpujh7dh6wwliomxsmn2qg4ey37ql52oqqoly55m"], signerV5);
78
- // console.log(encryptedURL);
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
- // await rpc.nfts.setBaseUri(
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 = 3;
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 <= countTokens; i++) {
165
- const tx = await raacNFTContract.minterMint(signer.address, i);
166
- await tx.wait();
167
- console.log("Minted NFT", i);
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
- const tx = await housePriceContract.setHousePrice(i, (0, ethers_1.parseEther)(housePrices[i - 1].toString()));
172
- await tx.wait();
173
- console.log("Price set for house", i);
174
- }
175
- for (let i = 1; i <= countTokens; i++) {
176
- const price = await rpc.nfts.getHousePrice(chainId, i, provider);
177
- console.log("Price for house", i, price);
178
- if (price !== housePrices[i - 1].toString() + ".0") {
179
- throw new Error("Price not set correctly");
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;
@@ -0,0 +1,4 @@
1
+ import { Provider } from "ethers";
2
+ import { ChainId } from "../../configs/chains/index";
3
+ declare function previewDeposit(chainId: ChainId, assetValue: string, provider: Provider): Promise<bigint>;
4
+ export default previewDeposit;
@@ -0,0 +1,4 @@
1
+ import { Provider } from "ethers";
2
+ import { ChainId } from "../../configs/chains/index";
3
+ declare function previewWithdraw(chainId: ChainId, assetValue: string, provider: Provider): Promise<bigint>;
4
+ export default previewWithdraw;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raac/rpc",
3
- "version": "1.1.0-beta.64",
3
+ "version": "1.1.0-beta.66",
4
4
  "description": "RPC Library for RAAC ",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types/index.d.ts",