Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 50 additions & 14 deletions .pnp.cjs

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

Binary file not shown.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,10 @@
"resolutions": {
"ethereum-cryptography@^1.1.2": "patch:ethereum-cryptography@npm%3A1.1.2#./.yarn/patches/ethereum-cryptography-npm-1.1.2-c16cfd7e8a.patch",
"ethereum-cryptography@^1.0.3": "patch:ethereum-cryptography@npm%3A1.1.2#./.yarn/patches/ethereum-cryptography-npm-1.1.2-c16cfd7e8a.patch"
},
"dependenciesMeta": {
"@chainlink/external-adapter-framework@2.9.0": {
"unplugged": true
}
}
}
Empty file.
3 changes: 3 additions & 0 deletions packages/composites/cusd-feed/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Chainlink External Adapter for example-adapter

This README will be generated automatically when code is merged to `main`. If you would like to generate a preview of the README, please run `yarn generate:readme example-adapter`.
42 changes: 42 additions & 0 deletions packages/composites/cusd-feed/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "@chainlink/cusd-feed-adapter",
"version": "0.0.0",
"description": "Chainlink cusd-feed adapter. Calculates the CUSD feed price by dividing aggregated AUM by the total supply of the cUSD token on Ethereum.",
"keywords": [
"Chainlink",
"LINK",
"blockchain",
"oracle",
"cusd-feed"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"repository": {
"url": "https://github.com/smartcontractkit/external-adapters-js",
"type": "git"
},
"license": "MIT",
"scripts": {
"clean": "rm -rf dist && rm -f tsconfig.tsbuildinfo",
"prepack": "yarn build",
"build": "tsc -b",
"server": "node -e 'require(\"./index.js\").server()'",
"server:dist": "node -e 'require(\"./dist/index.js\").server()'",
"start": "yarn server:dist"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "22.14.1",
"nock": "13.5.6",
"typescript": "5.8.3"
},
"dependencies": {
"@chainlink/external-adapter-framework": "2.11.4",
"decimal.js": "^10.3.1",
"ethers": "^6.13.0",
"tslib": "2.4.1"
}
}
35 changes: 35 additions & 0 deletions packages/composites/cusd-feed/src/config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { AdapterConfig } from '@chainlink/external-adapter-framework/config'

export const config = new AdapterConfig({
ETHEREUM_RPC_URL: {
description: 'RPC URL for Ethereum mainnet',
type: 'string',
required: true,
},
ETHEREUM_CHAIN_ID: {
description: 'Chain ID for Ethereum mainnet',
type: 'number',
default: 1,
},
PROOF_OF_RESERVES_ADAPTER_URL: {
description: 'URL of the proof-of-reserves EA',
type: 'string',
required: true,
},
CUSD_CONTRACT_ADDRESS: {
description: 'Address of the cUSD token contract on Ethereum',
type: 'string',
default: '0xcCcc62962d17b8914c62D74FfB843d73B2a3cccC',
},
POR_ADDRESS_LIST_CONTRACT: {
description: 'Address of the CapChainlinkPoRAddressList contract on Ethereum',
type: 'string',
default: '0x69A22f0fc7b398e637BF830B862C75dd854b2BbF',
},
BACKGROUND_EXECUTE_MS: {
description:
'The amount of time the background execute should sleep before performing the next request',
type: 'number',
default: 10_000,
},
})
3 changes: 3 additions & 0 deletions packages/composites/cusd-feed/src/config/overrides.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cusd-feed": {}
}
1 change: 1 addition & 0 deletions packages/composites/cusd-feed/src/endpoint/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { endpoint as price } from './price'
23 changes: 23 additions & 0 deletions packages/composites/cusd-feed/src/endpoint/price.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { AdapterEndpoint } from '@chainlink/external-adapter-framework/adapter'
import { EmptyInputParameters } from '@chainlink/external-adapter-framework/validation/input-params'
import { config } from '../config'
import { cusdFeedTransport } from '../transport/price'

export type BaseEndpointTypes = {
Parameters: EmptyInputParameters
Response: {
Result: string
Data: {
result: string
aum: string
totalSupply: string
ratio: string
}
}
Settings: typeof config.settings
}

export const endpoint = new AdapterEndpoint({
name: 'price',
transport: cusdFeedTransport,
})
13 changes: 13 additions & 0 deletions packages/composites/cusd-feed/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { expose, ServerInstance } from '@chainlink/external-adapter-framework'
import { Adapter } from '@chainlink/external-adapter-framework/adapter'
import { config } from './config'
import { price } from './endpoint'

export const adapter = new Adapter({
defaultEndpoint: price.name,
name: 'CUSD_FEED',
config,
endpoints: [price],
})

export const server = (): Promise<ServerInstance | undefined> => expose(adapter)
Loading
Loading