Skip to content

Commit 68d4356

Browse files
authored
Build JLP for Solv (#3637)
* Build JLP for Solv * Comments * Fix build
1 parent 7b75af6 commit 68d4356

File tree

20 files changed

+748
-4
lines changed

20 files changed

+748
-4
lines changed

.changeset/eleven-terms-thank.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@chainlink/token-balance-adapter': patch
3+
---
4+
5+
Add endpoint to handle JLP tokens on Solana for Solv

.changeset/tall-monkeys-behave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@chainlink/por-address-list-adapter': patch
3+
---
4+
5+
Handle new contract for Solv which includes Solana

.pnp.cjs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[
2+
{
3+
"inputs": [
4+
{ "internalType": "uint256", "name": "startIndex_", "type": "uint256" },
5+
{ "internalType": "uint256", "name": "endIndex_", "type": "uint256" }
6+
],
7+
"name": "getPoRAddressList",
8+
"outputs": [
9+
{
10+
"components": [
11+
{ "internalType": "string", "name": "tokenSymbol", "type": "string" },
12+
{ "internalType": "string", "name": "chain", "type": "string" },
13+
{ "internalType": "uint64", "name": "chainId", "type": "uint64" },
14+
{ "internalType": "string", "name": "tokenAddress", "type": "string" },
15+
{ "internalType": "string", "name": "vaultAddress", "type": "string" }
16+
],
17+
"internalType": "struct IPoRAddressListMulti.TokenVaultInfo[]",
18+
"name": "tokenVaultInfos_",
19+
"type": "tuple[]"
20+
}
21+
],
22+
"stateMutability": "view",
23+
"type": "function"
24+
},
25+
{
26+
"inputs": [],
27+
"name": "getPoRAddressListLength",
28+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
29+
"stateMutability": "view",
30+
"type": "function"
31+
}
32+
]

packages/sources/por-address-list/src/endpoint/multichainAddress.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ export const inputParameters = new InputParameters(
2020
abiName: {
2121
description: 'Used to select the ABI by name',
2222
type: 'string',
23-
options: ['MultiEVMPoRAddressList', 'PoRAddressListMulti', 'SolvMultiAddressList'],
23+
options: [
24+
'MultiEVMPoRAddressList',
25+
'PoRAddressListMulti',
26+
'SolvMultiAddressList',
27+
'SolvSolanaMultiAddressList',
28+
],
2429
required: true,
2530
},
2631
type: {

packages/sources/por-address-list/src/transport/multichainAddress.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { TransportDependencies } from '@chainlink/external-adapter-framework/tra
44
import { AdapterResponse, sleep } from '@chainlink/external-adapter-framework/util'
55
import PoRAddressListMultiABI from '../config/PoRAddressListMulti.json'
66
import SolvMultiAddressListABI from '../config/SolvMultiAddressList.json'
7+
import SolvSolanaMultiAddressListABI from '../config/SolvSolanaMultiAddressList.json'
78
import MultiEVMPoRAddressListABI from '../config/MultiEVMPoRAddressList.json'
89
import { BaseEndpointTypes, inputParameters } from '../endpoint/multichainAddress'
910
import { ethers } from 'ethers'
@@ -115,6 +116,8 @@ export class AddressTransport extends SubscriptionTransport<AddressTransportType
115116
return PoRAddressListMultiABI
116117
case 'SolvMultiAddressList':
117118
return SolvMultiAddressListABI
119+
case 'SolvSolanaMultiAddressList':
120+
return SolvSolanaMultiAddressListABI
118121
default:
119122
throw new AdapterInputError({
120123
errorResponse: 'abiName not found',
@@ -152,6 +155,8 @@ const buildTokenResponse = (addressList: ResponseSchema[][], vaultPlaceHolder?:
152155
k,
153156
{
154157
chainId: v[0].chainId.toString(),
158+
network: v[0].chain,
159+
token: v[0].tokenSymbol,
155160
contractAddress: v[0].tokenAddress,
156161
wallets: v.map((v) => v.vaultAddress),
157162
},

packages/sources/por-address-list/test/integration/__snapshots__/adapter-multichain.test.ts.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ exports[`execute multichainAddress endpoint should return success 1`] = `
2727
{
2828
"chainId": "56",
2929
"contractAddress": "token1",
30+
"network": "bnb",
31+
"token": "BTCB",
3032
"wallets": [
3133
"vault1",
3234
"vault2",
@@ -35,6 +37,8 @@ exports[`execute multichainAddress endpoint should return success 1`] = `
3537
{
3638
"chainId": "223",
3739
"contractAddress": "token3",
40+
"network": "b2",
41+
"token": "B2 BTC",
3842
"wallets": [
3943
"vault3",
4044
],

packages/sources/token-balance/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"start": "yarn server:dist"
2929
},
3030
"devDependencies": {
31+
"@solana/web3.js": "^1.95.8",
3132
"@types/jest": "27.5.2",
3233
"@types/node": "16.18.115",
3334
"nock": "13.5.4",
Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
[
2+
{
3+
"inputs": [
4+
{ "internalType": "address", "name": "_aggregator", "type": "address" },
5+
{ "internalType": "address", "name": "_accessController", "type": "address" }
6+
],
7+
"stateMutability": "nonpayable",
8+
"type": "constructor"
9+
},
10+
{
11+
"anonymous": false,
12+
"inputs": [
13+
{ "indexed": true, "internalType": "int256", "name": "current", "type": "int256" },
14+
{ "indexed": true, "internalType": "uint256", "name": "roundId", "type": "uint256" },
15+
{ "indexed": false, "internalType": "uint256", "name": "updatedAt", "type": "uint256" }
16+
],
17+
"name": "AnswerUpdated",
18+
"type": "event"
19+
},
20+
{
21+
"anonymous": false,
22+
"inputs": [
23+
{ "indexed": true, "internalType": "uint256", "name": "roundId", "type": "uint256" },
24+
{ "indexed": true, "internalType": "address", "name": "startedBy", "type": "address" },
25+
{ "indexed": false, "internalType": "uint256", "name": "startedAt", "type": "uint256" }
26+
],
27+
"name": "NewRound",
28+
"type": "event"
29+
},
30+
{
31+
"anonymous": false,
32+
"inputs": [
33+
{ "indexed": true, "internalType": "address", "name": "from", "type": "address" },
34+
{ "indexed": true, "internalType": "address", "name": "to", "type": "address" }
35+
],
36+
"name": "OwnershipTransferRequested",
37+
"type": "event"
38+
},
39+
{
40+
"anonymous": false,
41+
"inputs": [
42+
{ "indexed": true, "internalType": "address", "name": "from", "type": "address" },
43+
{ "indexed": true, "internalType": "address", "name": "to", "type": "address" }
44+
],
45+
"name": "OwnershipTransferred",
46+
"type": "event"
47+
},
48+
{
49+
"inputs": [],
50+
"name": "acceptOwnership",
51+
"outputs": [],
52+
"stateMutability": "nonpayable",
53+
"type": "function"
54+
},
55+
{
56+
"inputs": [],
57+
"name": "accessController",
58+
"outputs": [
59+
{ "internalType": "contract AccessControllerInterface", "name": "", "type": "address" }
60+
],
61+
"stateMutability": "view",
62+
"type": "function"
63+
},
64+
{
65+
"inputs": [],
66+
"name": "aggregator",
67+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
68+
"stateMutability": "view",
69+
"type": "function"
70+
},
71+
{
72+
"inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }],
73+
"name": "confirmAggregator",
74+
"outputs": [],
75+
"stateMutability": "nonpayable",
76+
"type": "function"
77+
},
78+
{
79+
"inputs": [],
80+
"name": "decimals",
81+
"outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
82+
"stateMutability": "view",
83+
"type": "function"
84+
},
85+
{
86+
"inputs": [],
87+
"name": "description",
88+
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
89+
"stateMutability": "view",
90+
"type": "function"
91+
},
92+
{
93+
"inputs": [{ "internalType": "uint256", "name": "_roundId", "type": "uint256" }],
94+
"name": "getAnswer",
95+
"outputs": [{ "internalType": "int256", "name": "", "type": "int256" }],
96+
"stateMutability": "view",
97+
"type": "function"
98+
},
99+
{
100+
"inputs": [{ "internalType": "uint80", "name": "_roundId", "type": "uint80" }],
101+
"name": "getRoundData",
102+
"outputs": [
103+
{ "internalType": "uint80", "name": "roundId", "type": "uint80" },
104+
{ "internalType": "int256", "name": "answer", "type": "int256" },
105+
{ "internalType": "uint256", "name": "startedAt", "type": "uint256" },
106+
{ "internalType": "uint256", "name": "updatedAt", "type": "uint256" },
107+
{ "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }
108+
],
109+
"stateMutability": "view",
110+
"type": "function"
111+
},
112+
{
113+
"inputs": [{ "internalType": "uint256", "name": "_roundId", "type": "uint256" }],
114+
"name": "getTimestamp",
115+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
116+
"stateMutability": "view",
117+
"type": "function"
118+
},
119+
{
120+
"inputs": [],
121+
"name": "latestAnswer",
122+
"outputs": [{ "internalType": "int256", "name": "", "type": "int256" }],
123+
"stateMutability": "view",
124+
"type": "function"
125+
},
126+
{
127+
"inputs": [],
128+
"name": "latestRound",
129+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
130+
"stateMutability": "view",
131+
"type": "function"
132+
},
133+
{
134+
"inputs": [],
135+
"name": "latestRoundData",
136+
"outputs": [
137+
{ "internalType": "uint80", "name": "roundId", "type": "uint80" },
138+
{ "internalType": "int256", "name": "answer", "type": "int256" },
139+
{ "internalType": "uint256", "name": "startedAt", "type": "uint256" },
140+
{ "internalType": "uint256", "name": "updatedAt", "type": "uint256" },
141+
{ "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }
142+
],
143+
"stateMutability": "view",
144+
"type": "function"
145+
},
146+
{
147+
"inputs": [],
148+
"name": "latestTimestamp",
149+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
150+
"stateMutability": "view",
151+
"type": "function"
152+
},
153+
{
154+
"inputs": [],
155+
"name": "owner",
156+
"outputs": [{ "internalType": "address payable", "name": "", "type": "address" }],
157+
"stateMutability": "view",
158+
"type": "function"
159+
},
160+
{
161+
"inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }],
162+
"name": "phaseAggregators",
163+
"outputs": [
164+
{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }
165+
],
166+
"stateMutability": "view",
167+
"type": "function"
168+
},
169+
{
170+
"inputs": [],
171+
"name": "phaseId",
172+
"outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }],
173+
"stateMutability": "view",
174+
"type": "function"
175+
},
176+
{
177+
"inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }],
178+
"name": "proposeAggregator",
179+
"outputs": [],
180+
"stateMutability": "nonpayable",
181+
"type": "function"
182+
},
183+
{
184+
"inputs": [],
185+
"name": "proposedAggregator",
186+
"outputs": [
187+
{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }
188+
],
189+
"stateMutability": "view",
190+
"type": "function"
191+
},
192+
{
193+
"inputs": [{ "internalType": "uint80", "name": "_roundId", "type": "uint80" }],
194+
"name": "proposedGetRoundData",
195+
"outputs": [
196+
{ "internalType": "uint80", "name": "roundId", "type": "uint80" },
197+
{ "internalType": "int256", "name": "answer", "type": "int256" },
198+
{ "internalType": "uint256", "name": "startedAt", "type": "uint256" },
199+
{ "internalType": "uint256", "name": "updatedAt", "type": "uint256" },
200+
{ "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }
201+
],
202+
"stateMutability": "view",
203+
"type": "function"
204+
},
205+
{
206+
"inputs": [],
207+
"name": "proposedLatestRoundData",
208+
"outputs": [
209+
{ "internalType": "uint80", "name": "roundId", "type": "uint80" },
210+
{ "internalType": "int256", "name": "answer", "type": "int256" },
211+
{ "internalType": "uint256", "name": "startedAt", "type": "uint256" },
212+
{ "internalType": "uint256", "name": "updatedAt", "type": "uint256" },
213+
{ "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }
214+
],
215+
"stateMutability": "view",
216+
"type": "function"
217+
},
218+
{
219+
"inputs": [{ "internalType": "address", "name": "_accessController", "type": "address" }],
220+
"name": "setController",
221+
"outputs": [],
222+
"stateMutability": "nonpayable",
223+
"type": "function"
224+
},
225+
{
226+
"inputs": [{ "internalType": "address", "name": "_to", "type": "address" }],
227+
"name": "transferOwnership",
228+
"outputs": [],
229+
"stateMutability": "nonpayable",
230+
"type": "function"
231+
},
232+
{
233+
"inputs": [],
234+
"name": "version",
235+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
236+
"stateMutability": "view",
237+
"type": "function"
238+
}
239+
]

packages/sources/token-balance/src/config/index.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
import { AdapterConfig } from '@chainlink/external-adapter-framework/config'
22

33
export const config = new AdapterConfig({
4+
ARBITRUM_RPC_URL: {
5+
description: 'RPC url of Arbitrum node',
6+
type: 'string',
7+
default: '',
8+
},
9+
ARBITRUM_RPC_CHAIN_ID: {
10+
description: 'Arbitrum chain id',
11+
type: 'number',
12+
default: 42161,
13+
},
14+
SOLANA_RPC_URL: {
15+
description: 'Solana Rpc Url',
16+
type: 'string',
17+
default: '',
18+
},
19+
SOLANA_COMMITMENT: {
20+
description: 'Solana transaction commitment level',
21+
type: 'string',
22+
default: 'finalized',
23+
},
424
BACKGROUND_EXECUTE_MS: {
525
description:
626
'The amount of time the background execute should sleep before performing the next request',

0 commit comments

Comments
 (0)