@raac/rpc 1.1.0-beta.30 → 1.1.0-beta.31
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 +1 -0
- package/dist/configs/chains/8453.json +11 -11
- package/dist/scripts/index.js +49 -75
- package/dist/types/RPCLibrary.d.ts +1 -0
- package/dist/types/configs/chains/index.d.ts +3 -3
- package/dist/types/configs/index.d.ts +1 -1
- package/dist/types/utils/contracts.d.ts +2 -2
- package/package.json +1 -1
package/dist/RPCLibrary.js
CHANGED
|
@@ -57,26 +57,26 @@
|
|
|
57
57
|
"rwavault": {
|
|
58
58
|
"id": "rwavault",
|
|
59
59
|
"name": "RWA Vault",
|
|
60
|
-
"contract": "
|
|
60
|
+
"contract": "0x7a2088a1bFc9d81c55368AE168C2C02570cB814F"
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"pools": {
|
|
64
64
|
"stabilitypool": {
|
|
65
65
|
"id": "stabilitypool",
|
|
66
66
|
"name": "Stability Pool",
|
|
67
|
-
"contract": "
|
|
67
|
+
"contract": "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44"
|
|
68
68
|
},
|
|
69
69
|
"lendingpool": {
|
|
70
70
|
"id": "lendingpool",
|
|
71
71
|
"name": "Lending Pool",
|
|
72
|
-
"contract": "
|
|
72
|
+
"contract": "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE"
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"nfts": {
|
|
76
76
|
"raacnft": {
|
|
77
77
|
"id": "raacnft",
|
|
78
78
|
"name": "RAAC NFT",
|
|
79
|
-
"contract": "
|
|
79
|
+
"contract": "0x9E545E3C0baAB3E08CdfD552C960A1050f373042"
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
"assets": {
|
|
@@ -96,13 +96,13 @@
|
|
|
96
96
|
"id": "rtoken",
|
|
97
97
|
"name": "RToken",
|
|
98
98
|
"decimals": 18,
|
|
99
|
-
"contract": "
|
|
99
|
+
"contract": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82"
|
|
100
100
|
},
|
|
101
101
|
"detoken": {
|
|
102
102
|
"id": "detoken",
|
|
103
103
|
"name": "DEToken",
|
|
104
104
|
"decimals": 18,
|
|
105
|
-
"contract": "
|
|
105
|
+
"contract": "0x59b670e9fA9D0A427751Af201D676719a970857b"
|
|
106
106
|
},
|
|
107
107
|
"raactoken": {
|
|
108
108
|
"id": "raactoken",
|
|
@@ -120,13 +120,13 @@
|
|
|
120
120
|
"id": "debttoken",
|
|
121
121
|
"name": "Debt Token",
|
|
122
122
|
"decimals": 18,
|
|
123
|
-
"contract": "
|
|
123
|
+
"contract": "0x9A676e781A523b5d0C0e43731313A708CB607508"
|
|
124
124
|
},
|
|
125
125
|
"rwaindextoken": {
|
|
126
126
|
"id": "rwaindextoken",
|
|
127
127
|
"name": "Index Token",
|
|
128
128
|
"decimals": 18,
|
|
129
|
-
"contract": "
|
|
129
|
+
"contract": "0x4A679253410272dd5232B3Ff7cF5dbB88f295319"
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
132
|
"adapters": {
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
"raacnftadapter": {
|
|
135
135
|
"id": "raacnftadapter",
|
|
136
136
|
"name": "RAAC NFT Adapter",
|
|
137
|
-
"contract": "
|
|
137
|
+
"contract": "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8",
|
|
138
138
|
"type": "ERC721"
|
|
139
139
|
},
|
|
140
140
|
"rwaindextokenadapter": {
|
|
@@ -148,13 +148,13 @@
|
|
|
148
148
|
"raacnftadapter": {
|
|
149
149
|
"id": "raacnftadapter",
|
|
150
150
|
"name": "RAAC NFT Adapter",
|
|
151
|
-
"contract": "
|
|
151
|
+
"contract": "0x95401dc811bb5740090279Ba06cfA8fcF6113778",
|
|
152
152
|
"type": "ERC721"
|
|
153
153
|
},
|
|
154
154
|
"crvusdadapter": {
|
|
155
155
|
"id": "crvusdadapter",
|
|
156
156
|
"name": "CRVUSD Adapter",
|
|
157
|
-
"contract": "
|
|
157
|
+
"contract": "0x09635F643e140090A9A8Dcd712eD6285858ceBef",
|
|
158
158
|
"type": "ERC20"
|
|
159
159
|
}
|
|
160
160
|
}
|
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 = 8453;
|
|
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,14 +17,16 @@ async function getProvider() {
|
|
|
17
17
|
return new ethers_1.ethers.JsonRpcProvider(config.rpcs[0]);
|
|
18
18
|
}
|
|
19
19
|
async function createWallet(mnemonic, provider) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
//
|
|
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}`);
|
|
20
|
+
const wallet = ethers_1.ethers.Wallet.fromPhrase(mnemonic, provider);
|
|
21
|
+
console.info(`[${chainId}]: Loaded wallet from mnemonic: ${wallet.address}`);
|
|
22
|
+
// the signer is the wallet
|
|
27
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
|
+
// );
|
|
29
|
+
// return wallet;
|
|
28
30
|
}
|
|
29
31
|
async function setup() {
|
|
30
32
|
const provider = await getProvider();
|
|
@@ -34,37 +36,16 @@ async function setup() {
|
|
|
34
36
|
rpc.provider = provider;
|
|
35
37
|
rpc.chainId = chainId;
|
|
36
38
|
// // send myself some CRVUSD
|
|
37
|
-
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
// );
|
|
39
|
+
await rpc.wallet.assets.mintAsset(chainId, "crvusd", 10000000n, signer.address, signer);
|
|
40
|
+
// // set the base uri to instruxi data gateway
|
|
41
|
+
await rpc.nfts.setBaseUri(chainId, "http://44.211.155.244:3000/v1/properties/", signer);
|
|
42
|
+
console.log(await rpc.pools.lendingPool.getLendingPoolInfo(chainId, signer.address, provider));
|
|
43
|
+
console.log(await rpc.wallet.assets.getBalance(chainId, "rtoken", signer.address, provider));
|
|
50
44
|
// console.log(
|
|
51
|
-
// await rpc.
|
|
52
|
-
// chainId,
|
|
53
|
-
// signer.address,
|
|
54
|
-
// provider
|
|
55
|
-
// )
|
|
45
|
+
// await rpc.nfts.getTokensByOwner(chainId, signer.address, provider)
|
|
56
46
|
// );
|
|
57
|
-
// console.log(
|
|
58
|
-
// await rpc.wallet.assets.getBalance(
|
|
59
|
-
// chainId,
|
|
60
|
-
// "rtoken",
|
|
61
|
-
// signer.address,
|
|
62
|
-
// provider
|
|
63
|
-
// )
|
|
64
|
-
// );
|
|
65
|
-
console.log(await rpc.nfts.getTokensByOwner(chainId, signer.address, provider));
|
|
66
47
|
// // // set the oracle address of the RAACHousePrice. TEmporarily simulating that I AM THE ORACLE
|
|
67
|
-
|
|
48
|
+
await rpc.contracts.housePrices.setOracle(chainId, signer.address, signer);
|
|
68
49
|
// // // // // set price for 3 houses
|
|
69
50
|
const housePriceAddress = (0, contracts_1.getContractAddress)(chainId, "raachouseprices");
|
|
70
51
|
const housePriceABI = (0, artifacts_1.getABI)("raachouseprices");
|
|
@@ -74,45 +55,38 @@ async function setup() {
|
|
|
74
55
|
const raacNFTContract = new ethers_1.ethers.Contract(raacNFTAddress, raacNFTABI, signer);
|
|
75
56
|
const countTokens = 3;
|
|
76
57
|
// // // // Generate 10 house prices between 100K and 2M
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// // //
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
//
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
// }
|
|
58
|
+
const housePrices = [];
|
|
59
|
+
for (let i = 1; i <= countTokens; i++) {
|
|
60
|
+
const price = Math.floor(Math.random() * (2000000 - 100000) + 100000);
|
|
61
|
+
housePrices.push(price);
|
|
62
|
+
}
|
|
63
|
+
// // // Mint the new properties
|
|
64
|
+
for (let i = 1; i <= countTokens; i++) {
|
|
65
|
+
const tx = await raacNFTContract.minterMint(signer.address, i);
|
|
66
|
+
await tx.wait();
|
|
67
|
+
console.log("Minted NFT", i);
|
|
68
|
+
}
|
|
69
|
+
// // set house prices
|
|
70
|
+
for (let i = 1; i <= countTokens; i++) {
|
|
71
|
+
const tx = await housePriceContract.setHousePrice(i, (0, ethers_1.parseEther)(housePrices[i - 1].toString()));
|
|
72
|
+
await tx.wait();
|
|
73
|
+
console.log("Price set for house", i);
|
|
74
|
+
}
|
|
75
|
+
for (let i = 1; i <= countTokens; i++) {
|
|
76
|
+
const price = await rpc.nfts.getHousePrice(chainId, i, provider);
|
|
77
|
+
console.log("Price for house", i, price);
|
|
78
|
+
if (price !== housePrices[i - 1].toString() + ".0") {
|
|
79
|
+
throw new Error("Price not set correctly");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
let nftIdStart = countTokens + 1;
|
|
83
|
+
let nftIdEnd = countTokens + 10;
|
|
84
|
+
for (let i = nftIdStart; i <= nftIdEnd; i++) {
|
|
85
|
+
const price = Math.floor(Math.random() * (2000000 - 100000) + 100000);
|
|
86
|
+
const tx = await housePriceContract.setHousePrice(i, (0, ethers_1.parseEther)(price.toString()));
|
|
87
|
+
await tx.wait();
|
|
88
|
+
console.log("Price set for house", i);
|
|
89
|
+
}
|
|
116
90
|
// Generate some random NFT and set price only: not purchased yet
|
|
117
91
|
// let nftIdStart = countTokens + 2;
|
|
118
92
|
// let nftIdEnd = countTokens + 10;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Chain8453
|
|
1
|
+
import { Chain8453 } from "./chain";
|
|
2
2
|
declare const chains: {
|
|
3
3
|
8453: Chain8453;
|
|
4
4
|
17000: Chain8453;
|
|
5
|
-
11155111:
|
|
5
|
+
11155111: Chain8453;
|
|
6
6
|
18453: Chain8453;
|
|
7
7
|
};
|
|
8
8
|
export default chains;
|
|
9
9
|
export declare const configs: {
|
|
10
10
|
8453: Chain8453;
|
|
11
11
|
17000: Chain8453;
|
|
12
|
-
11155111:
|
|
12
|
+
11155111: Chain8453;
|
|
13
13
|
18453: Chain8453;
|
|
14
14
|
};
|
|
15
15
|
export type Configs = typeof chains;
|
|
@@ -2,7 +2,7 @@ import { ChainId } from "./chains/index";
|
|
|
2
2
|
declare function getChainsConfig(): {
|
|
3
3
|
8453: import("./chains/chain").Chain8453;
|
|
4
4
|
17000: import("./chains/chain").Chain8453;
|
|
5
|
-
11155111: import("./chains/chain").
|
|
5
|
+
11155111: import("./chains/chain").Chain8453;
|
|
6
6
|
18453: import("./chains/chain").Chain8453;
|
|
7
7
|
};
|
|
8
8
|
declare function setChainConfig(chainId: ChainId, config: any): void;
|
|
@@ -4,7 +4,7 @@ import { ethers, Provider } from "ethers";
|
|
|
4
4
|
export declare const getConfigs: () => {
|
|
5
5
|
8453: import("../configs/chains/chain").Chain8453;
|
|
6
6
|
17000: import("../configs/chains/chain").Chain8453;
|
|
7
|
-
11155111: import("../configs/chains/chain").
|
|
7
|
+
11155111: import("../configs/chains/chain").Chain8453;
|
|
8
8
|
18453: import("../configs/chains/chain").Chain8453;
|
|
9
9
|
};
|
|
10
10
|
export declare const setOverrideConfig: (chainId: ChainId, newConfig: any) => void;
|
|
@@ -19,7 +19,7 @@ declare const _default: {
|
|
|
19
19
|
getConfigs: () => {
|
|
20
20
|
8453: import("../configs/chains/chain").Chain8453;
|
|
21
21
|
17000: import("../configs/chains/chain").Chain8453;
|
|
22
|
-
11155111: import("../configs/chains/chain").
|
|
22
|
+
11155111: import("../configs/chains/chain").Chain8453;
|
|
23
23
|
18453: import("../configs/chains/chain").Chain8453;
|
|
24
24
|
};
|
|
25
25
|
};
|