Skip to content

Conversation

@ryangoree
Copy link
Member

Adds bindings for calculate_short_bonds_given_deposit.

Commits tell the story.

@changeset-bot
Copy link

changeset-bot bot commented Oct 9, 2024

🦋 Changeset detected

Latest commit: 574b53f

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

This PR includes changesets to release 4 packages
Name Type
@delvtech/hyperdrive-js-core Minor
@delvtech/hyperdrive-wasm Patch
@delvtech/fixed-point-wasm Patch
@delvtech/hyperdrive-viem 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

@vercel
Copy link

vercel bot commented Oct 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hyperdrive-mainnet-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 7:11am
hyperdrive-sepolia-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 7:11am
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
hyperdrive-js ⬜️ Ignored (Inspect) Visit Preview Oct 9, 2024 7:11am
hyperdrive-mainnet-production ⬜️ Ignored (Inspect) Visit Preview Oct 9, 2024 7:11am
hyperdrive-sepolia-production ⬜️ Ignored (Inspect) Visit Preview Oct 9, 2024 7:11am
testnet-v1 ⬜️ Ignored (Inspect) Oct 9, 2024 7:11am
testnet-v1.0.6 ⬜️ Ignored (Inspect) Visit Preview Oct 9, 2024 7:11am
trading-competition ⬜️ Ignored (Inspect) Visit Preview Oct 9, 2024 7:11am

asBase: true,
});

assert(targetDeposit.absDiff(traderDeposit).lte(tolerance));
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

amountIn: bigint;
asBase: boolean;
/**
* The maximum difference between the target and actual base amount.
Copy link
Contributor

Choose a reason for hiding this comment

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

1e9 is decent for 18 decimal numbers, but for usdc (6 decimals) we'll definitely want to set a smaller tolerance. Should we capture this in the TokenConfig, HyperdriveConfig, or just inline a bit of logic in our hook to look at the token decimals and map that to a known good tolerance?

Copy link
Contributor

Choose a reason for hiding this comment

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

We could also just make the default tolerance in ReadHyperdrive dynamic based on hyperdrive.decimals. 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. I'd confirm with @dpaiton on how far this tolerance can go before it stops working, but if the tolerance a pool uses is data based on other data (e.g., the token's decimals) then I'd inline it to keep the config data more normalized.

Copy link
Contributor

@DannyDelott DannyDelott left a comment

Choose a reason for hiding this comment

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

I'm so excited for this! 🚀

@ryangoree ryangoree merged commit 18482c3 into main Oct 9, 2024
@ryangoree ryangoree deleted the ryan-short-bonds-wasm branch October 9, 2024 16:29
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