Skip to content

Feat/OPDATA-6509 implied price decimals#4789

Merged
mmcallister-cll merged 10 commits intomainfrom
feat/OPDATA-6509-implied-price-decimals
Apr 8, 2026
Merged

Feat/OPDATA-6509 implied price decimals#4789
mmcallister-cll merged 10 commits intomainfrom
feat/OPDATA-6509-implied-price-decimals

Conversation

@mmcallister-cll
Copy link
Copy Markdown
Contributor

@mmcallister-cll mmcallister-cll commented Apr 1, 2026

Closes #OPDATA-6509

Description

Adds optional outputDecimals, operand1Decimals, operand2Decimals input params to computedPrice endpoint which can used to scale result to a number of output decimals based on input decimals.

Changes

  • Added outputDecimals, operand1Decimals, operand2Decimals input params
  • Updated result processing to scale result by necessary number of decimals to achieve outputDecimals -- this is different based on operation
  • Added tests for new functionality

Steps to Test

  1. yarn test implied-price
  2. test with the following payload: Remove the outputDecimals, operand1Decimals, operand2Decimals to get the existing behaviour output.
{
    "data": {
        "endpoint": "computedPrice",
        "operand1Sources": [
            "data_engine"
        ],
        "operand1Input": "{\"endpoint\":\"redemptionRate-v7\",\"feedId\":\"0x0007621b6f5eb0b5bd5a8bb3d52902b3e19498ba45781e5ddf92ce7e03d7ecef\",\"resultPath\":\"exchangeRate\"}",
        "operand1Decimals": 18,
        "operand2Sources": [
            "data_engine"
        ],
        "operand2Input": "{\"endpoint\":\"crypto-v3\",\"feedId\":\"0x0003fb73b717523a65721ee943f35ee7ca447dc623433c0f645126b7721c57d9\",\"resultPath\": \"price\"}",
        "operand2Decimals": 18,
        "operation": "divide",
        "outputDecimals": 18
    }
}

Quality Assurance

  • If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant infra-k8s configuration file.
  • If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant adapter-secrets configuration file.
  • If a new adapter was made, or a new endpoint was added, update the test-payload.json file with relevant requests.
  • The branch naming follows git flow (feature/x, chore/x, release/x, hotfix/x, fix/x) or is created from Jira.
  • This is related to a maximum of one Jira story or GitHub issue.
  • Types are safe (avoid TypeScript/TSLint features like any and disable, instead use more specific types).
  • All code changes have 100% unit and integration test coverage. If testing is not applicable or too difficult to justify doing, the reasoning should be documented explicitly in the PR.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 1, 2026

🦋 Changeset detected

Latest commit: c461a01

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@chainlink/implied-price-test-adapter Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mmcallister-cll mmcallister-cll requested a review from a team April 1, 2026 00:34
mxiao-cll
mxiao-cll previously approved these changes Apr 8, 2026
@mmcallister-cll mmcallister-cll merged commit 18a27a1 into main Apr 8, 2026
20 of 21 checks passed
@mmcallister-cll mmcallister-cll deleted the feat/OPDATA-6509-implied-price-decimals branch April 8, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants