Skip to content

feat: Add ppm precision to swap v2 fees#472

Merged
Dewyer merged 2 commits into
mainfrom
feat/add-fee-precision
Apr 8, 2025
Merged

feat: Add ppm precision to swap v2 fees#472
Dewyer merged 2 commits into
mainfrom
feat/add-fee-precision

Conversation

@Dewyer
Copy link
Copy Markdown
Contributor

@Dewyer Dewyer commented Apr 4, 2025

About

In this PR i increased the possible precision for the dynamic platform and referrer fees.
This required a bit of trickery hence the swap v2 account still used the swap v1 argument instruction data, so that the two implementations could share a context. Which has to broken here because the size of the referer fee ppm needs to be increased to u64 from u16 breaking wire compatibility. This introduces some duplication. The hack were the constraints are moved out of the account validator don't work because the instruction data still needs to deserialize properly even if we werent using fee token data.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 4, 2025

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

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
swap-staging ⬜️ Ignored (Inspect) Visit Preview Apr 7, 2025 4:52pm

Comment thread contracts/svm/programs/express_relay/src/lib.rs Outdated
@Dewyer Dewyer force-pushed the feat/add-fee-precision branch from 3097111 to 237ad70 Compare April 4, 2025 14:35
@Dewyer Dewyer force-pushed the feat/add-fee-precision branch from 237ad70 to 8719866 Compare April 4, 2025 14:37
Comment thread contracts/svm/programs/express_relay/src/state.rs Outdated
Copy link
Copy Markdown
Contributor

@guibescos guibescos left a comment

Choose a reason for hiding this comment

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

maybe you could add a test for wrong fee token program

Comment thread contracts/svm/programs/express_relay/src/state.rs Outdated
Comment thread contracts/svm/programs/express_relay/src/lib.rs Outdated
Comment thread contracts/svm/programs/express_relay/src/lib.rs Outdated
Comment thread contracts/svm/testing/tests/swap.rs
Comment thread contracts/svm/testing/tests/swap.rs
Comment thread contracts/svm/testing/tests/swap.rs Outdated
@Dewyer Dewyer force-pushed the feat/add-fee-precision branch from e94ceb1 to 4612bcc Compare April 7, 2025 17:48
@Dewyer Dewyer merged commit b8ae982 into main Apr 8, 2025
6 checks passed
@Dewyer Dewyer deleted the feat/add-fee-precision branch April 8, 2025 08:33
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