@raac/rpc 1.1.0-beta.28 → 1.1.0-beta.29
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"chainId": 11155111,
|
|
3
3
|
"name": "sepolia",
|
|
4
|
-
"rpcs": ["https://sepolia.
|
|
4
|
+
"rpcs": ["https://eth-sepolia.g.alchemy.com/v2/GRu4-s8cjabOCnh-3ZFzapF-MwUcURV_"],
|
|
5
5
|
"nativeCurrency": {
|
|
6
6
|
"name": "ETH",
|
|
7
7
|
"symbol": "ETH",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"raachouseprices": {
|
|
18
18
|
"id": "raachouseprices",
|
|
19
19
|
"name": "RAAC House Prices",
|
|
20
|
-
"contract": "
|
|
20
|
+
"contract": "0x3aD29bF120251BF7B2616B7460d38796535E0753"
|
|
21
21
|
},
|
|
22
22
|
"raacprimerateoracle": {
|
|
23
23
|
"id": "raacprimerateoracle",
|
|
24
24
|
"name": "RAAC Prime Rate Oracle",
|
|
25
|
-
"contract": "
|
|
25
|
+
"contract": "0x755853680b66535067E436f218AF87f1C8Db961a"
|
|
26
26
|
},
|
|
27
27
|
"auctionfactory": {
|
|
28
28
|
"id": "auctionfactory",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"feecollector": {
|
|
43
43
|
"id": "feecollector",
|
|
44
44
|
"name": "Fee Collector",
|
|
45
|
-
"contract": "
|
|
45
|
+
"contract": "0xA7154A854A86050C69Fc2081f0464ba48a1E6830"
|
|
46
46
|
},
|
|
47
47
|
"treasury": {
|
|
48
48
|
"id": "treasury",
|
|
49
49
|
"name": "Treasury",
|
|
50
|
-
"contract": "
|
|
50
|
+
"contract": "0x6e647B74E06fc008043174EF9fbB06629E143b70"
|
|
51
51
|
},
|
|
52
52
|
"repairfund": {
|
|
53
53
|
"id": "repairfund",
|
|
@@ -62,26 +62,26 @@
|
|
|
62
62
|
"rwavault": {
|
|
63
63
|
"id": "rwavault",
|
|
64
64
|
"name": "RWA Vault",
|
|
65
|
-
"contract": "
|
|
65
|
+
"contract": "0xB28264c78bFFAc4Ff4Bc9dB76F138CbaD865F642"
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
"pools": {
|
|
69
69
|
"stabilitypool": {
|
|
70
70
|
"id": "stabilitypool",
|
|
71
71
|
"name": "Stability Pool",
|
|
72
|
-
"contract": "
|
|
72
|
+
"contract": "0x8B8265469B5495c67373fC0655F2c78AcBdAfa5f"
|
|
73
73
|
},
|
|
74
74
|
"lendingpool": {
|
|
75
75
|
"id": "lendingpool",
|
|
76
76
|
"name": "Lending Pool",
|
|
77
|
-
"contract": "
|
|
77
|
+
"contract": "0x29f12b7195A863043C437Ae88ffAFd1e0C89Ec2E"
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
"nfts": {
|
|
81
81
|
"raacnft": {
|
|
82
82
|
"id": "raacnft",
|
|
83
83
|
"name": "RAAC NFT",
|
|
84
|
-
"contract": "
|
|
84
|
+
"contract": "0xEA034D093C73eaF20dBB3d2489B39b4c86848465"
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
"assets": {
|
|
@@ -95,43 +95,43 @@
|
|
|
95
95
|
"id": "crvusd",
|
|
96
96
|
"name": "CRVUSD",
|
|
97
97
|
"decimals": 18,
|
|
98
|
-
"contract": "
|
|
98
|
+
"contract": "0x144346562EE47526D945E86d55C4203642C3b7fD"
|
|
99
99
|
},
|
|
100
100
|
"rtoken": {
|
|
101
101
|
"id": "rtoken",
|
|
102
102
|
"name": "RToken",
|
|
103
103
|
"decimals": 18,
|
|
104
|
-
"contract": "
|
|
104
|
+
"contract": "0x80D0747737453D30dCE3167bB1284B6c0e6bC5db"
|
|
105
105
|
},
|
|
106
106
|
"detoken": {
|
|
107
107
|
"id": "detoken",
|
|
108
108
|
"name": "DEToken",
|
|
109
109
|
"decimals": 18,
|
|
110
|
-
"contract": "
|
|
110
|
+
"contract": "0x34c4245991d5041BA8ebA6269B7b9386c32BDEEe"
|
|
111
111
|
},
|
|
112
112
|
"raactoken": {
|
|
113
113
|
"id": "raactoken",
|
|
114
114
|
"name": "RAAC",
|
|
115
115
|
"decimals": 18,
|
|
116
|
-
"contract": "
|
|
116
|
+
"contract": "0xB1839AE38339Dc0035571cf856BF24254a27FbBC"
|
|
117
117
|
},
|
|
118
118
|
"veraac": {
|
|
119
119
|
"id": "veraac",
|
|
120
120
|
"name": "VERAAC",
|
|
121
121
|
"decimals": 18,
|
|
122
|
-
"contract": "
|
|
122
|
+
"contract": "0x6eB1E8Ee1F16D23db63Dd8FCe8d127041E8a9588"
|
|
123
123
|
},
|
|
124
124
|
"debttoken": {
|
|
125
125
|
"id": "debttoken",
|
|
126
126
|
"name": "Debt Token",
|
|
127
127
|
"decimals": 18,
|
|
128
|
-
"contract": "
|
|
128
|
+
"contract": "0x596917E0180fcBa1d809511A743Ea7d4ccf92Ca9"
|
|
129
129
|
},
|
|
130
130
|
"rwaindextoken": {
|
|
131
131
|
"id": "rwaindextoken",
|
|
132
132
|
"name": "RWA Index Token",
|
|
133
133
|
"decimals": 18,
|
|
134
|
-
"contract": "
|
|
134
|
+
"contract": "0x1be9E0875edfbAE72D087500c502b5F84ca9E9Da"
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
}
|
|
@@ -8,6 +8,8 @@ async function getTokensByOwner(chainId, address, provider, pagination) {
|
|
|
8
8
|
const raacNFTAddress = (0, contracts_1.getContractAddress)(chainId, "raacnft");
|
|
9
9
|
const raacNFTABI = (0, artifacts_1.getABI)("raacnft");
|
|
10
10
|
const raacNFTContract = new ethers_1.ethers.Contract(raacNFTAddress, raacNFTABI, provider);
|
|
11
|
+
console.log(raacNFTContract);
|
|
12
|
+
console.log(address);
|
|
11
13
|
const balance = await raacNFTContract.balanceOf(address);
|
|
12
14
|
if (balance === 0n) {
|
|
13
15
|
return { address, tokens: [] };
|
package/dist/scripts/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const chains_1 = __importDefault(require("../configs/chains"));
|
|
|
9
9
|
const RPCLibrary_1 = __importDefault(require("../RPCLibrary"));
|
|
10
10
|
const contracts_1 = require("../utils/contracts");
|
|
11
11
|
const artifacts_1 = require("../utils/artifacts");
|
|
12
|
-
const chainId =
|
|
12
|
+
const chainId = 11155111;
|
|
13
13
|
const config = chains_1.default[chainId];
|
|
14
14
|
const TEST_MNEMONIC = process.env.TEST_MNEMONIC;
|
|
15
15
|
const TEST_PRIVATE_KEY = process.env.TEST_PRIVATE_KEY;
|
|
@@ -17,16 +17,14 @@ async function getProvider() {
|
|
|
17
17
|
return new ethers_1.ethers.JsonRpcProvider(config.rpcs[0]);
|
|
18
18
|
}
|
|
19
19
|
async function createWallet(mnemonic, provider) {
|
|
20
|
-
const wallet =
|
|
21
|
-
console.info(`[${chainId}]: Loaded wallet from mnemonic: ${wallet.address}`);
|
|
22
|
-
// the signer is the wallet
|
|
23
|
-
return wallet;
|
|
24
|
-
// load from private key
|
|
25
|
-
// const wallet = new ethers.Wallet(TEST_PRIVATE_KEY, provider);
|
|
26
|
-
// console.info(
|
|
27
|
-
// `[${chainId}]: Loaded wallet from private key: ${wallet.address}`
|
|
28
|
-
// );
|
|
20
|
+
// const wallet = ethers.Wallet.fromPhrase(mnemonic, provider);
|
|
21
|
+
// console.info(`[${chainId}]: Loaded wallet from mnemonic: ${wallet.address}`);
|
|
22
|
+
// // the signer is the wallet
|
|
29
23
|
// return wallet;
|
|
24
|
+
// load from private key
|
|
25
|
+
const wallet = new ethers_1.ethers.Wallet(TEST_PRIVATE_KEY, provider);
|
|
26
|
+
console.info(`[${chainId}]: Loaded wallet from private key: ${wallet.address}`);
|
|
27
|
+
return wallet;
|
|
30
28
|
}
|
|
31
29
|
async function setup() {
|
|
32
30
|
const provider = await getProvider();
|
|
@@ -36,15 +34,38 @@ async function setup() {
|
|
|
36
34
|
rpc.provider = provider;
|
|
37
35
|
rpc.chainId = chainId;
|
|
38
36
|
// // send myself some CRVUSD
|
|
39
|
-
await rpc.wallet.assets.mintAsset(
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
// await rpc.wallet.assets.mintAsset(
|
|
38
|
+
// chainId,
|
|
39
|
+
// "crvusd",
|
|
40
|
+
// 10000000n,
|
|
41
|
+
// signer.address,
|
|
42
|
+
// signer
|
|
43
|
+
// );
|
|
44
|
+
// // // set the base uri to instruxi data gateway
|
|
45
|
+
// await rpc.nfts.setBaseUri(
|
|
46
|
+
// chainId,
|
|
47
|
+
// "http://44.211.155.244:3000/v1/properties/",
|
|
48
|
+
// signer
|
|
49
|
+
// );
|
|
50
|
+
// console.log(
|
|
51
|
+
// await rpc.pools.lendingPool.getLendingPoolInfo(
|
|
52
|
+
// chainId,
|
|
53
|
+
// signer.address,
|
|
54
|
+
// provider
|
|
55
|
+
// )
|
|
56
|
+
// );
|
|
57
|
+
// console.log(
|
|
58
|
+
// await rpc.wallet.assets.getBalance(
|
|
59
|
+
// chainId,
|
|
60
|
+
// "rtoken",
|
|
61
|
+
// signer.address,
|
|
62
|
+
// provider
|
|
63
|
+
// )
|
|
64
|
+
// );
|
|
44
65
|
console.log(await rpc.nfts.getTokensByOwner(chainId, signer.address, provider));
|
|
45
66
|
// // // set the oracle address of the RAACHousePrice. TEmporarily simulating that I AM THE ORACLE
|
|
46
|
-
await rpc.contracts.housePrices.setOracle(chainId, signer.address, signer);
|
|
47
|
-
// // // // set price for 3 houses
|
|
67
|
+
// await rpc.contracts.housePrices.setOracle(chainId, signer.address, signer);
|
|
68
|
+
// // // // // set price for 3 houses
|
|
48
69
|
const housePriceAddress = (0, contracts_1.getContractAddress)(chainId, "raachouseprices");
|
|
49
70
|
const housePriceABI = (0, artifacts_1.getABI)("raachouseprices");
|
|
50
71
|
const housePriceContract = new ethers_1.ethers.Contract(housePriceAddress, housePriceABI, signer);
|
|
@@ -52,41 +73,67 @@ async function setup() {
|
|
|
52
73
|
const raacNFTABI = (0, artifacts_1.getABI)("raacnft");
|
|
53
74
|
const raacNFTContract = new ethers_1.ethers.Contract(raacNFTAddress, raacNFTABI, signer);
|
|
54
75
|
const countTokens = 3;
|
|
55
|
-
// // // Generate 10 house prices between 100K and 2M
|
|
56
|
-
const housePrices = [];
|
|
57
|
-
for (let i = 1; i <= countTokens; i++) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
// // //
|
|
62
|
-
for (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
// //
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
76
|
+
// // // // Generate 10 house prices between 100K and 2M
|
|
77
|
+
// const housePrices = [];
|
|
78
|
+
// for (let i = 1; i <= countTokens; i++) {
|
|
79
|
+
// const price = Math.floor(Math.random() * (2000000 - 100000) + 100000);
|
|
80
|
+
// housePrices.push(price);
|
|
81
|
+
// }
|
|
82
|
+
// // // set house prices with proper error handling and gas management
|
|
83
|
+
// for (const item of housePrices.map((price, index) => ({ id: index + 3, price: parseEther(price.toString()) }))) {
|
|
84
|
+
// try {
|
|
85
|
+
// // Get the current gas price and add a small increment
|
|
86
|
+
// const gasPrice = await provider.getGasPrice();
|
|
87
|
+
// const tx = await housePriceContract.setHousePrice(item.id, item.price, {
|
|
88
|
+
// gasPrice: gasPrice.add(1000000), // Add a small increment to gas price
|
|
89
|
+
// gasLimit: 300000 // Set a specific gas limit
|
|
90
|
+
// });
|
|
91
|
+
// // Wait for the transaction to be mined
|
|
92
|
+
// const receipt = await tx.wait();
|
|
93
|
+
// console.log("Price set for house", item.id, "tx:", receipt.hash);
|
|
94
|
+
// // Add a delay between transactions
|
|
95
|
+
// await new Promise(resolve => setTimeout(resolve, 2000));
|
|
96
|
+
// } catch (error) {
|
|
97
|
+
// console.error(`Failed to set price for house ${item.id}:`, error);
|
|
98
|
+
// // Continue with the next item instead of stopping
|
|
99
|
+
// continue;
|
|
100
|
+
// }
|
|
101
|
+
// }
|
|
73
102
|
// // confirm the house prices are set
|
|
74
|
-
for (let i = 1; i <= countTokens; i++) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
103
|
+
// for (let i = 1; i <= countTokens; i++) {
|
|
104
|
+
// const price = await rpc.nfts.getHousePrice(chainId, i, provider);
|
|
105
|
+
// console.log("Price for house", i, price);
|
|
106
|
+
// if (price !== housePrices[i - 1].toString() + ".0") {
|
|
107
|
+
// throw new Error("Price not set correctly");
|
|
108
|
+
// }
|
|
109
|
+
// }
|
|
110
|
+
// // // // Mint the new properties
|
|
111
|
+
// for (let i = 1; i <= countTokens; i++) {
|
|
112
|
+
// const tx = await raacNFTContract.minterMint(signer.address, i);
|
|
113
|
+
// await tx.wait();
|
|
114
|
+
// console.log("Minted NFT", i);
|
|
115
|
+
// }
|
|
81
116
|
// Generate some random NFT and set price only: not purchased yet
|
|
82
|
-
let nftIdStart = countTokens +
|
|
83
|
-
let nftIdEnd = countTokens + 10;
|
|
84
|
-
for (let i = nftIdStart; i <= nftIdEnd; i++) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
117
|
+
// let nftIdStart = countTokens + 2;
|
|
118
|
+
// let nftIdEnd = countTokens + 10;
|
|
119
|
+
// for (let i = nftIdStart; i <= nftIdEnd; i++) {
|
|
120
|
+
// try {
|
|
121
|
+
// const price = Math.floor(Math.random() * (2000000 - 100000) + 100000);
|
|
122
|
+
// const tx = await housePriceContract.setHousePrice(
|
|
123
|
+
// i,
|
|
124
|
+
// parseEther(price.toString()),
|
|
125
|
+
// {
|
|
126
|
+
// nonce: await provider.getTransactionCount(signer.address)
|
|
127
|
+
// }
|
|
128
|
+
// );
|
|
129
|
+
// const receipt = await tx.wait();
|
|
130
|
+
// console.log("Price set for house", i, "tx:", receipt.hash);
|
|
131
|
+
// await new Promise(resolve => setTimeout(resolve, 2000));
|
|
132
|
+
// } catch (error) {
|
|
133
|
+
// console.error(`Failed to set price for house ${i}:`, error);
|
|
134
|
+
// continue;
|
|
135
|
+
// }
|
|
136
|
+
// }
|
|
90
137
|
}
|
|
91
138
|
const execute = async () => {
|
|
92
139
|
const provider = await getProvider();
|
|
@@ -134,7 +181,7 @@ const fulfillRequest = async () => {
|
|
|
134
181
|
const redemptionToken = await rwaVaultContract.getNextRandomNFT();
|
|
135
182
|
console.log("Redemption token", redemptionToken);
|
|
136
183
|
};
|
|
137
|
-
execute();
|
|
138
|
-
|
|
184
|
+
// execute();
|
|
185
|
+
setup();
|
|
139
186
|
// fulfillRequest();
|
|
140
187
|
// setup();
|