Skip to content

Conversation

Subarna-Singh
Copy link
Contributor

Closes #OPDATA-3775

https://smartcontract-it.atlassian.net/browse/OPDATA-3775

Description

Remove viewFunctionIndexerResultDecimals input param

Changes

view-function-multi-chain queries decimals method on contract and returns value in result data

Steps to Test

yarn test packages/source/view-function-multi-chain/test

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 or update the soak testing blacklist.
  • 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.

Copy link

changeset-bot bot commented Oct 14, 2025

🦋 Changeset detected

Latest commit: 45f156a

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

This PR includes changesets to release 3 packages
Name Type
@chainlink/proof-of-reserves-adapter Major
@chainlink/view-function-multi-chain-adapter Minor
@chainlink/renvm-address-set-adapter Patch

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

'@chainlink/view-function-multi-chain-adapter': minor
---

USDO PoR EA Update - Remove viewFunctionIndexerResultDecimals input param
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For major need to add more details on what the NOP should do

}
}

async _get_decimals(networkName: string, address: string): Promise<number> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do this instead? Simpler

const abi = [
  "function decimals() view returns (uint8)"
];

const token = new ethers.Contract(tokenAddress, abi, provider);
const decimals = await token.decimals();

const [decodedDecimals] = decimalsIface.decodeFunctionResult('decimals', decimalsEncoded)
decimals = Number(decodedDecimals)
} catch (err) {
logger.warn(`Error fetching decimals, defaulting to 0: ${err}`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think defaulting to 0 is the right thing to do, we should prob throw an exception

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.

2 participants