Skip to content

Conversation

@codebycarson
Copy link
Collaborator

@codebycarson codebycarson commented Sep 18, 2025

The current docs for precompiles use the ethereum standard for decimal places (18) where the Sei precompiles expect the Cosmos standard (6 decimals). This PR adjusts the examples in the docs to let developers know about this difference.

@changeset-bot
Copy link

changeset-bot bot commented Sep 18, 2025

⚠️ No Changeset found

Latest commit: bbd729d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Updates the staking precompile documentation to use 6 decimal places instead of 18, aligning with Cosmos standards rather than Ethereum standards for SEI token amounts.

  • Replaced parseEther() calls with raw numeric values using 6 decimal places
  • Updated import statements to remove unused parseEther function
  • Added clarifying comments indicating amounts use 6 decimals

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov-commenter
Copy link

codecov-commenter commented Sep 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.29%. Comparing base (91a3e9c) to head (bbd729d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #294   +/-   ##
=======================================
  Coverage   79.29%   79.29%           
=======================================
  Files          82       82           
  Lines        1280     1280           
  Branches      184      184           
=======================================
  Hits         1015     1015           
  Misses        259      259           
  Partials        6        6           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

This comment was marked as resolved.

This comment was marked as resolved.

@codebycarson codebycarson marked this pull request as ready for review September 18, 2025 15:47
@codebycarson codebycarson changed the title Adjusted precompiles docs to use six decimal places instead of eighteen Adjusted precompiles docs to use 6 decimal places instead of 18 Sep 18, 2025
const success = await stakingContract.delegate(
"seivaloper1...",
{ value: parseEther("100") } // Delegate 100 SEI
{ value: 100000000 } // Delegate 100 SEI (6 decimals)

Choose a reason for hiding this comment

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

While using delegate, specifically this one function uses 18 decimals inputs truncated to 6 decimals. Basically, you do something like:

10.123456789 -> 10.123456 -> parseEther(10.123456)

Best practice would be to always have amount.toFixed(6) -> parseEther(fixedAmount)

We need to change from having 6 decimals in delegate function to 18 decimals which is truncated to 6 decimals

functionName: 'delegate',
args: [validatorAddress],
value: parseEther(amount)
value: amount // (6 decimals)

Choose a reason for hiding this comment

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

18 decimals truncated to 6 decimals

const stakingWithSigner = stakingContract.connect(signer);

const tx = await stakingWithSigner.delegate(validatorAddress, {
value: ethers.parseEther(amount)

Choose a reason for hiding this comment

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

parseEther was correct as its delegate function but have a amount.toFixed(6)

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.

4 participants