-
Notifications
You must be signed in to change notification settings - Fork 255
DEVREL-599 feat(oft-solana): conditional ata value #1689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces conditional value handling for Solana Associated Token Account (ATA) creation when sending OFT tokens cross-chain. Instead of always including rent value in enforced options, the system now dynamically determines the required value based on whether the recipient's ATA exists.
- Adds utility functions to check ATA existence and compute conditional value for Solana sends
- Updates the send logic to dynamically set msg.value only when ATA creation is needed
- Removes static value from Solana enforced options to avoid wasteful rent payments
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| examples/oft-solana/tasks/solana/utils.ts | Adds functions to check ATA existence and compute conditional rent value for token account creation |
| examples/oft-solana/tasks/common/sendOFT.ts | Implements conditional value logic for Solana sends and prevents double value setting |
| examples/oft-solana/layerzero.config.ts | Removes static value from enforced options and updates comments to explain conditional approach |
| .changeset/two-cups-prove.md | Documents the change for release notes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Converted to draft. We need to coordinate with Stargate as currently OFTs on Stargate are required to have enforcedOptions. |
|
Note: I will be amending this PR to first check enforcedOptions before adding value |
Co-authored-by: Copilot <[email protected]>
|
Changes from original implementation
|
|
note: I'll amend the PR with one last change: get token account size for Token2022 dynamically. will do this tomorrow. EDIT: this is done |
|
Currently blocked. We'll only merge after Stargate drops the requirement of having enforcedOptions.value for sends to Solana |
🚨 E2E Tests FailedThe E2E tests failed during CI. These tests validate real blockchain interactions and may fail due to:
This is non-blocking and does not prevent merging. Check the action logs above for detailed failure information. |
Motivation
Read: https://docs.layerzero.network/v2/developers/solana/oft/account#conditional-msgvalue-for-ata-creation
Changes
valuein enforced options when sending to SolanaProof of Tests
First send - https://testnet.layerzeroscan.com/tx/0x028261e4cf2de488e3f73facf35ab5bd7ad1b6718116fe23d2c7a6eb90b9032f
(has value)
Subsequent send - https://testnet.layerzeroscan.com/tx/0x5ae75e635504975b97520601374ee9b1fae915489f204cecd98b0730cb2cdbd9
(no value)
EDIT: Enhanced to support Token2022 token accounts
Token2022 Mint: https://solscan.io/account/Dn6hECYyQQmeA7ZuWVQcYFdD5gjS1FEeKhpxu7YyohnL?cluster=devnet
Created with Permanent Delegate extension.
Created OFT in MABA mode.
Example token account: 4RzxArQWnhfAmS4j6Wv5vUvaAs3VLznqRXyCFFUCiSU4
Token account size: 170 bytes
Proof of Tests
Test recipient: 8yToDJqkD31aikucY1sPvCmKFAPQt6ZVZLyyUUH6M36N
First send to test recipient: https://testnet.layerzeroscan.com/tx/0xe5ce462c7f40145ab41378f02f6fc58c4b2e781e27878da73a9f6b40f242226e
Value provided
Second send to test recipient: https://testnet.layerzeroscan.com/tx/0x50831f7116589f037a4e08a39d11343795151cdeef73fe1c6bc8fe8c3de3269b
No value provided