@raac/rpc 1.1.0-beta.59 → 1.1.0-beta.60

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.
@@ -37,12 +37,12 @@
37
37
  "feecollector": {
38
38
  "id": "feecollector",
39
39
  "name": "Fee Collector",
40
- "contract": "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6"
40
+ "contract": "0x0165878A594ca255338adfa4d48449f69242Eb8F"
41
41
  },
42
42
  "treasury": {
43
43
  "id": "treasury",
44
44
  "name": "Treasury",
45
- "contract": "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853"
45
+ "contract": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707"
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": "0x4A679253410272dd5232B3Ff7cF5dbB88f295319"
60
+ "contract": "0x68B1D87F95878fE05B998F19b66F4baba5De1aed"
61
61
  },
62
62
  "complianceregistry": {
63
63
  "id": "complianceregistry",
64
64
  "name": "Compliance Registry",
65
- "contract": "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"
65
+ "contract": "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0"
66
66
  },
67
67
  "rwaindextokencollector": {
68
68
  "id": "rwaindextokencollector",
69
69
  "name": "RWA Index Token Collector",
70
- "contract": "0x36C02dA8a0983159322a80FFE9F24b1acfF8B570"
70
+ "contract": "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE"
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": "0x0000000000000000000000000000000000000000"
80
+ "contract": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
81
81
  },
82
82
  "raacprimerateoracle": {
83
83
  "id": "raacprimerateoracle",
84
84
  "name": "RAAC Prime Rate Oracle",
85
- "contract": "0x0000000000000000000000000000000000000000"
85
+ "contract": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
86
86
  }
87
87
  },
88
88
  "pools": {
89
89
  "stabilitypool": {
90
90
  "id": "stabilitypool",
91
91
  "name": "Stability Pool",
92
- "contract": "0x59b670e9fA9D0A427751Af201D676719a970857b"
92
+ "contract": "0x0B306BF915C4d645ff596e518fAf3F9669b97016"
93
93
  },
94
94
  "lendingpool": {
95
95
  "id": "lendingpool",
96
96
  "name": "Lending Pool",
97
- "contract": "0x0B306BF915C4d645ff596e518fAf3F9669b97016"
97
+ "contract": "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0"
98
98
  }
99
99
  },
100
100
  "nfts": {
101
101
  "raacnft": {
102
102
  "id": "raacnft",
103
103
  "name": "RAAC NFT",
104
- "contract": "0x9E545E3C0baAB3E08CdfD552C960A1050f373042"
104
+ "contract": "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c"
105
105
  }
106
106
  },
107
107
  "assets": {
@@ -121,13 +121,13 @@
121
121
  "id": "rtoken",
122
122
  "name": "RToken",
123
123
  "decimals": 18,
124
- "contract": "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e"
124
+ "contract": "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6"
125
125
  },
126
126
  "detoken": {
127
127
  "id": "detoken",
128
128
  "name": "DEToken",
129
129
  "decimals": 18,
130
- "contract": "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c"
130
+ "contract": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82"
131
131
  },
132
132
  "raactoken": {
133
133
  "id": "raactoken",
@@ -145,25 +145,25 @@
145
145
  "id": "debttoken",
146
146
  "name": "Debt Token",
147
147
  "decimals": 18,
148
- "contract": "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0"
148
+ "contract": "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"
149
149
  },
150
150
  "rwaindextoken": {
151
151
  "id": "rwaindextoken",
152
152
  "name": "Index Token",
153
153
  "decimals": 18,
154
- "contract": "0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f"
154
+ "contract": "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1"
155
155
  },
156
156
  "complianceregistry": {
157
157
  "id": "complianceregistry",
158
158
  "name": "Compliance Registry",
159
159
  "decimals": 18,
160
- "contract": "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"
160
+ "contract": "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0"
161
161
  },
162
162
  "rwaindextokencollector": {
163
163
  "id": "rwaindextokencollector",
164
164
  "name": "RWA Index Token Collector",
165
165
  "decimals": 18,
166
- "contract": "0x36C02dA8a0983159322a80FFE9F24b1acfF8B570"
166
+ "contract": "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE"
167
167
  },
168
168
  "raactokencollector": {
169
169
  "id": "raactokencollector",
@@ -177,13 +177,13 @@
177
177
  "raacnftadapter": {
178
178
  "id": "raacnftadapter",
179
179
  "name": "RAAC NFT Adapter",
180
- "contract": "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8",
180
+ "contract": "0x4A679253410272dd5232B3Ff7cF5dbB88f295319",
181
181
  "type": "ERC721"
182
182
  },
183
183
  "rwaindextokenadapter": {
184
184
  "id": "rwaindextokenadapter",
185
185
  "name": "RWA Index Token",
186
- "contract": "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9",
186
+ "contract": "0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f",
187
187
  "type": "ERC20"
188
188
  }
189
189
  },
@@ -191,13 +191,13 @@
191
191
  "raacnftadapter": {
192
192
  "id": "raacnftadapter",
193
193
  "name": "RAAC NFT Adapter",
194
- "contract": "0x95401dc811bb5740090279Ba06cfA8fcF6113778",
194
+ "contract": "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1",
195
195
  "type": "ERC721"
196
196
  },
197
197
  "crvusdadapter": {
198
198
  "id": "crvusdadapter",
199
199
  "name": "CRVUSD Adapter",
200
- "contract": "0x09635F643e140090A9A8Dcd712eD6285858ceBef",
200
+ "contract": "0x59b670e9fA9D0A427751Af201D676719a970857b",
201
201
  "type": "ERC20"
202
202
  }
203
203
  }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.encryptSecretURLs = encryptSecretURLs;
7
+ const functions_toolkit_1 = require("@chainlink/functions-toolkit");
8
+ const chainlink_networks_config_1 = __importDefault(require("./chainlink-networks-config"));
9
+ async function encryptSecretURLs(chainId, urls, signerV5) {
10
+ const network = chainlink_networks_config_1.default[chainId];
11
+ const functionsRouterAddress = network.functionsRouter;
12
+ const donId = network.donId;
13
+ const secretsManager = new functions_toolkit_1.SecretsManager({
14
+ signer: signerV5,
15
+ functionsRouterAddress,
16
+ donId,
17
+ });
18
+ await secretsManager.initialize();
19
+ const encryptedSecrets = await secretsManager.encryptSecretsUrls(urls);
20
+ const isVerified = await secretsManager.verifyOffchainSecrets(urls);
21
+ if (!isVerified) {
22
+ throw new Error("Offchain secrets verification failed");
23
+ }
24
+ return { encryptedSecrets, isVerified };
25
+ }
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generateSecretReference = generateSecretReference;
6
7
  exports.request = request;
7
8
  const functions_toolkit_1 = require("@chainlink/functions-toolkit");
8
9
  const configs_1 = require("../../configs");
@@ -17,6 +18,36 @@ const subscriptionIds = {
17
18
  11155111: 4392,
18
19
  18453: 4392,
19
20
  };
21
+ async function generateSecretReference(chainId, signerV5) {
22
+ const chain = (0, configs_1.getChainConfig)(chainId);
23
+ const network = chainlink_networks_config_1.default[chainId];
24
+ if (!chain) {
25
+ throw new Error(`Chain configuration not found for chainId: ${chainId}`);
26
+ }
27
+ const slotId = 0;
28
+ const functionsRouterAddress = network.functionsRouter;
29
+ const donId = network.donId;
30
+ const secretsManager = new functions_toolkit_1.SecretsManager({
31
+ // ethers v5 signer again
32
+ signer: signerV5,
33
+ functionsRouterAddress,
34
+ donId,
35
+ });
36
+ await secretsManager.initialize();
37
+ const encryptedSecrets = await secretsManager.encryptSecrets(config_1.default.secrets);
38
+ // DONHoster secrets
39
+ const { version } = await secretsManager.uploadEncryptedSecretsToDON({
40
+ encryptedSecretsHexstring: encryptedSecrets.encryptedSecrets,
41
+ gatewayUrls: network.gatewayUrls,
42
+ slotId,
43
+ minutesUntilExpiration: 3600,
44
+ });
45
+ const encryptedSecretsReference = await secretsManager.buildDONHostedEncryptedSecretsReference({
46
+ slotId,
47
+ version,
48
+ });
49
+ return encryptedSecretsReference;
50
+ }
20
51
  async function request(chainId, houseId, signerV5) {
21
52
  const chain = (0, configs_1.getChainConfig)(chainId);
22
53
  const network = chainlink_networks_config_1.default[chainId];
@@ -87,7 +118,7 @@ async function request(chainId, houseId, signerV5) {
87
118
  encryptedSecretsHexstring: encryptedSecrets.encryptedSecrets,
88
119
  gatewayUrls: network.gatewayUrls,
89
120
  slotId,
90
- minutesUntilExpiration: 5,
121
+ minutesUntilExpiration: 86000,
91
122
  });
92
123
  const encryptedSecretsReference = await secretsManager.buildDONHostedEncryptedSecretsReference({
93
124
  slotId,
@@ -10,8 +10,8 @@ const RPCLibrary_1 = __importDefault(require("../RPCLibrary"));
10
10
  const contracts_1 = require("../utils/contracts");
11
11
  const artifacts_1 = require("../utils/artifacts");
12
12
  const _helpers_1 = require("../pools/rwaVault/_helpers");
13
- const request_1 = require("../oracles/prime-rate/request");
14
13
  const ethers5_1 = require("ethers5");
14
+ const encryptSecretURLs_1 = require("../oracles/encryptSecretURLs");
15
15
  const chainId = 11155111;
16
16
  const config = chains_1.default[chainId];
17
17
  const TEST_MNEMONIC = process.env.TEST_MNEMONIC;
@@ -63,7 +63,11 @@ async function setup() {
63
63
  const StabilityPoolContract = new ethers_1.ethers.Contract(StabilityPoolAddress, StabilityPoolABI, signer);
64
64
  const providerV5 = new ethers5_1.ethers.providers.JsonRpcProvider(config.rpcs[0]);
65
65
  const signerV5 = new ethers5_1.ethers.Wallet(TEST_PRIVATE_KEY, providerV5);
66
- await (0, request_1.request)(chainId, signerV5);
66
+ const TreasuryAddress = (0, contracts_1.getContractAddress)(chainId, "treasury");
67
+ const TreasuryABI = (0, artifacts_1.getABI)("treasury");
68
+ const TreasuryContract = new ethers_1.ethers.Contract(TreasuryAddress, TreasuryABI, signer);
69
+ const secretReference = await (0, encryptSecretURLs_1.encryptSecretURLs)(chainId, ["https://oracle-config.instruxi.dev/sxt/encrypted-secrets-get-attestation-amount-by-token-id.json"], signerV5);
70
+ console.log(secretReference);
67
71
  // await (await housePriceContract.setOracle(signer.address)).wait();
68
72
  // console.log(await rpc.pools.lendingPool.getLendingPoolInfo(chainId, signer.address, provider))
69
73
  // console.log(await LendingPoolContract.rateData())
@@ -0,0 +1,5 @@
1
+ import { Signer } from "ethers5";
2
+ export declare function encryptSecretURLs(chainId: number, urls: string[], signerV5: Signer): Promise<{
3
+ encryptedSecrets: string;
4
+ isVerified: true;
5
+ }>;
@@ -1,2 +1,3 @@
1
1
  import { Signer } from "ethers5";
2
+ export declare function generateSecretReference(chainId: number, signerV5: Signer): Promise<string>;
2
3
  export declare function request(chainId: number, houseId: string, signerV5: Signer): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raac/rpc",
3
- "version": "1.1.0-beta.59",
3
+ "version": "1.1.0-beta.60",
4
4
  "description": "RPC Library for RAAC ",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types/index.d.ts",