Skip to content

Commit

Permalink
Build JLP for Solv (#3637)
Browse files Browse the repository at this point in the history
* Build JLP for Solv

* Comments

* Fix build
  • Loading branch information
mxiao-cll authored Jan 20, 2025
1 parent 7b75af6 commit 68d4356
Show file tree
Hide file tree
Showing 20 changed files with 748 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/eleven-terms-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/token-balance-adapter': patch
---

Add endpoint to handle JLP tokens on Solana for Solv
5 changes: 5 additions & 0 deletions .changeset/tall-monkeys-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/por-address-list-adapter': patch
---

Handle new contract for Solv which includes Solana
1 change: 1 addition & 0 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"inputs": [
{ "internalType": "uint256", "name": "startIndex_", "type": "uint256" },
{ "internalType": "uint256", "name": "endIndex_", "type": "uint256" }
],
"name": "getPoRAddressList",
"outputs": [
{
"components": [
{ "internalType": "string", "name": "tokenSymbol", "type": "string" },
{ "internalType": "string", "name": "chain", "type": "string" },
{ "internalType": "uint64", "name": "chainId", "type": "uint64" },
{ "internalType": "string", "name": "tokenAddress", "type": "string" },
{ "internalType": "string", "name": "vaultAddress", "type": "string" }
],
"internalType": "struct IPoRAddressListMulti.TokenVaultInfo[]",
"name": "tokenVaultInfos_",
"type": "tuple[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getPoRAddressListLength",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ export const inputParameters = new InputParameters(
abiName: {
description: 'Used to select the ABI by name',
type: 'string',
options: ['MultiEVMPoRAddressList', 'PoRAddressListMulti', 'SolvMultiAddressList'],
options: [
'MultiEVMPoRAddressList',
'PoRAddressListMulti',
'SolvMultiAddressList',
'SolvSolanaMultiAddressList',
],
required: true,
},
type: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { TransportDependencies } from '@chainlink/external-adapter-framework/tra
import { AdapterResponse, sleep } from '@chainlink/external-adapter-framework/util'
import PoRAddressListMultiABI from '../config/PoRAddressListMulti.json'
import SolvMultiAddressListABI from '../config/SolvMultiAddressList.json'
import SolvSolanaMultiAddressListABI from '../config/SolvSolanaMultiAddressList.json'
import MultiEVMPoRAddressListABI from '../config/MultiEVMPoRAddressList.json'
import { BaseEndpointTypes, inputParameters } from '../endpoint/multichainAddress'
import { ethers } from 'ethers'
Expand Down Expand Up @@ -115,6 +116,8 @@ export class AddressTransport extends SubscriptionTransport<AddressTransportType
return PoRAddressListMultiABI
case 'SolvMultiAddressList':
return SolvMultiAddressListABI
case 'SolvSolanaMultiAddressList':
return SolvSolanaMultiAddressListABI
default:
throw new AdapterInputError({
errorResponse: 'abiName not found',
Expand Down Expand Up @@ -152,6 +155,8 @@ const buildTokenResponse = (addressList: ResponseSchema[][], vaultPlaceHolder?:
k,
{
chainId: v[0].chainId.toString(),
network: v[0].chain,
token: v[0].tokenSymbol,
contractAddress: v[0].tokenAddress,
wallets: v.map((v) => v.vaultAddress),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ exports[`execute multichainAddress endpoint should return success 1`] = `
{
"chainId": "56",
"contractAddress": "token1",
"network": "bnb",
"token": "BTCB",
"wallets": [
"vault1",
"vault2",
Expand All @@ -35,6 +37,8 @@ exports[`execute multichainAddress endpoint should return success 1`] = `
{
"chainId": "223",
"contractAddress": "token3",
"network": "b2",
"token": "B2 BTC",
"wallets": [
"vault3",
],
Expand Down
1 change: 1 addition & 0 deletions packages/sources/token-balance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"start": "yarn server:dist"
},
"devDependencies": {
"@solana/web3.js": "^1.95.8",
"@types/jest": "27.5.2",
"@types/node": "16.18.115",
"nock": "13.5.4",
Expand Down
239 changes: 239 additions & 0 deletions packages/sources/token-balance/src/config/EACAggregatorProxy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
[
{
"inputs": [
{ "internalType": "address", "name": "_aggregator", "type": "address" },
{ "internalType": "address", "name": "_accessController", "type": "address" }
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "int256", "name": "current", "type": "int256" },
{ "indexed": true, "internalType": "uint256", "name": "roundId", "type": "uint256" },
{ "indexed": false, "internalType": "uint256", "name": "updatedAt", "type": "uint256" }
],
"name": "AnswerUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "uint256", "name": "roundId", "type": "uint256" },
{ "indexed": true, "internalType": "address", "name": "startedBy", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "startedAt", "type": "uint256" }
],
"name": "NewRound",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "from", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "to", "type": "address" }
],
"name": "OwnershipTransferRequested",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "from", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "to", "type": "address" }
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [],
"name": "acceptOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "accessController",
"outputs": [
{ "internalType": "contract AccessControllerInterface", "name": "", "type": "address" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "aggregator",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }],
"name": "confirmAggregator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "description",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "_roundId", "type": "uint256" }],
"name": "getAnswer",
"outputs": [{ "internalType": "int256", "name": "", "type": "int256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint80", "name": "_roundId", "type": "uint80" }],
"name": "getRoundData",
"outputs": [
{ "internalType": "uint80", "name": "roundId", "type": "uint80" },
{ "internalType": "int256", "name": "answer", "type": "int256" },
{ "internalType": "uint256", "name": "startedAt", "type": "uint256" },
{ "internalType": "uint256", "name": "updatedAt", "type": "uint256" },
{ "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "_roundId", "type": "uint256" }],
"name": "getTimestamp",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "latestAnswer",
"outputs": [{ "internalType": "int256", "name": "", "type": "int256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "latestRound",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "latestRoundData",
"outputs": [
{ "internalType": "uint80", "name": "roundId", "type": "uint80" },
{ "internalType": "int256", "name": "answer", "type": "int256" },
{ "internalType": "uint256", "name": "startedAt", "type": "uint256" },
{ "internalType": "uint256", "name": "updatedAt", "type": "uint256" },
{ "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "latestTimestamp",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [{ "internalType": "address payable", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }],
"name": "phaseAggregators",
"outputs": [
{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "phaseId",
"outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }],
"name": "proposeAggregator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "proposedAggregator",
"outputs": [
{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint80", "name": "_roundId", "type": "uint80" }],
"name": "proposedGetRoundData",
"outputs": [
{ "internalType": "uint80", "name": "roundId", "type": "uint80" },
{ "internalType": "int256", "name": "answer", "type": "int256" },
{ "internalType": "uint256", "name": "startedAt", "type": "uint256" },
{ "internalType": "uint256", "name": "updatedAt", "type": "uint256" },
{ "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "proposedLatestRoundData",
"outputs": [
{ "internalType": "uint80", "name": "roundId", "type": "uint80" },
{ "internalType": "int256", "name": "answer", "type": "int256" },
{ "internalType": "uint256", "name": "startedAt", "type": "uint256" },
{ "internalType": "uint256", "name": "updatedAt", "type": "uint256" },
{ "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "_accessController", "type": "address" }],
"name": "setController",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "_to", "type": "address" }],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "version",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
}
]
20 changes: 20 additions & 0 deletions packages/sources/token-balance/src/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
import { AdapterConfig } from '@chainlink/external-adapter-framework/config'

export const config = new AdapterConfig({
ARBITRUM_RPC_URL: {
description: 'RPC url of Arbitrum node',
type: 'string',
default: '',
},
ARBITRUM_RPC_CHAIN_ID: {
description: 'Arbitrum chain id',
type: 'number',
default: 42161,
},
SOLANA_RPC_URL: {
description: 'Solana Rpc Url',
type: 'string',
default: '',
},
SOLANA_COMMITMENT: {
description: 'Solana transaction commitment level',
type: 'string',
default: 'finalized',
},
BACKGROUND_EXECUTE_MS: {
description:
'The amount of time the background execute should sleep before performing the next request',
Expand Down
1 change: 1 addition & 0 deletions packages/sources/token-balance/src/endpoint/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { endpoint as evm } from './evm'
export { endpoint as solvJlp } from './solvJlp'
Loading

0 comments on commit 68d4356

Please sign in to comment.