Skip to content

Commit

Permalink
Fix underscore in token allocation (#3537)
Browse files Browse the repository at this point in the history
* Fix underscore in token allocation

* Fix typo

---------

Co-authored-by: mmcallister-cll <[email protected]>
  • Loading branch information
mxiao-cll and mmcallister-cll authored Nov 5, 2024
1 parent d8023b9 commit 07644a2
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/gentle-gorillas-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/token-allocation-adapter': minor
---

Fix blocksize-capital as source
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ export const inputParameters: InputParameters<TInputParameters> = {
}

export const execute = async (input: AdapterRequest, config: Config): Promise<AdapterResponse> => {
if (input.data) {
input.data.source = (input.data.source as string)?.replace('-', '_') || ''
}

const paramOptions = makeOptions(config)
const validator = new Validator(input, inputParameters, paramOptions)
if (validator.error) throw validator.error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,36 @@ exports[`execute additional input parameter pass through should return the corre
}
`;

exports[`execute additional input parameter pass through should return the correct price for source blocksize-capital with additional input 1`] = `
{
"data": {
"payload": {
"DAI": {
"quote": {
"EUR": {
"price": 130.27,
},
},
},
"WBTC": {
"quote": {
"EUR": {
"price": 130.27,
},
},
},
},
"result": 260.54,
"sources": [],
},
"debug": undefined,
"jobRunID": "1",
"providerStatusCode": 200,
"result": 260.54,
"statusCode": 200,
}
`;

exports[`execute additional input parameter pass through should return the correct price for source coinapi with additional input 1`] = `
{
"data": {
Expand Down Expand Up @@ -360,6 +390,36 @@ exports[`execute marketcap method should return the correct price for source blo
}
`;

exports[`execute marketcap method should return the correct price for source blocksize-capital 1`] = `
{
"data": {
"payload": {
"DAI": {
"quote": {
"EUR": {
"marketCap": 130.27,
},
},
},
"WBTC": {
"quote": {
"EUR": {
"marketCap": 130.27,
},
},
},
},
"result": 260.54,
"sources": [],
},
"debug": undefined,
"jobRunID": "1",
"providerStatusCode": 200,
"result": 260.54,
"statusCode": 200,
}
`;

exports[`execute marketcap method should return the correct price for source coinapi 1`] = `
{
"data": {
Expand Down Expand Up @@ -690,6 +750,36 @@ exports[`execute price method should return the correct price for source blocksi
}
`;

exports[`execute price method should return the correct price for source blocksize-capital 1`] = `
{
"data": {
"payload": {
"DAI": {
"quote": {
"EUR": {
"price": 130.27,
},
},
},
"WBTC": {
"quote": {
"EUR": {
"price": 130.27,
},
},
},
},
"result": 260.54,
"sources": [],
},
"debug": undefined,
"jobRunID": "1",
"providerStatusCode": 200,
"result": 260.54,
"statusCode": 200,
}
`;

exports[`execute price method should return the correct price for source coinapi 1`] = `
{
"data": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ export const dataProviderConfig: TokenAllocationTest = {
providerUrlEnvVar: 'TIINGO_ADAPTER_URL',
additional: {},
},
'blocksize-capital': {
providerUrl: 'http://localhost:3010',
providerUrlEnvVar: 'BLOCKSIZE_CAPITAL_ADAPTER_URL',
additional: {},
},
blocksize_capital: {
providerUrl: 'http://localhost:3010',
providerUrlEnvVar: 'BLOCKSIZE_CAPITAL_ADAPTER_URL',
Expand Down

0 comments on commit 07644a2

Please sign in to comment.