-
Notifications
You must be signed in to change notification settings - Fork 280
[INT-419] Solana OApp Aptos compatibility patch #1599
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f8742fb
Enhance Solana to Move-VM integration with new Aptos support and conf…
AlexanderLiteplo 3385d4a
Making insturctions more clear for wiring solana to aptos
AlexanderLiteplo c60852b
Update aptos-move-send.ts for improved message handling and configura…
AlexanderLiteplo 89bde3d
Refactor aptos-move-send.ts and update README.md for clarity and conf…
AlexanderLiteplo d03f7b0
small fix
AlexanderLiteplo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| // NOTE: This config is an example for wiring Solana -> Aptos. | ||
| // See wiring-to-aptos.md for more information. | ||
| import { EndpointId } from '@layerzerolabs/lz-definitions' | ||
| import { ExecutorOptionType } from '@layerzerolabs/lz-v2-utilities' | ||
| import { OAppOmniGraphHardhat, OmniPointHardhat } from '@layerzerolabs/toolbox-hardhat' | ||
|
|
||
| enum MsgType { | ||
| SEND = 1, | ||
| SEND_AND_CALL = 2, | ||
| } | ||
| const aptosContract: OmniPointHardhat = { | ||
| eid: EndpointId.APTOS_V2_TESTNET as EndpointId, | ||
| address: 'YOUR_DEPLOYED_APTOS_CONTRACT_ADDRESS', | ||
| } | ||
| const solanaContract: OmniPointHardhat = { | ||
| eid: EndpointId.SOLANA_V2_TESTNET as EndpointId, | ||
| address: 'YOUR_DEPLOYED_SOLANA_OAPP_ADDRESS', | ||
| } | ||
|
|
||
| const layerZeroDVNAptosAddress = '0x756f8ab056688d22687740f4a9aeec3b361170b28d08b719e28c4d38eed1043e' | ||
| const layerZeroDVNSolanaAddress = '4VDjp6XQaxoZf5RGwiPU9NR1EXSZn2TP4ATMmiSzLfhb' | ||
|
|
||
| const config: OAppOmniGraphHardhat = { | ||
|
AlexanderLiteplo marked this conversation as resolved.
|
||
| contracts: [ | ||
| { | ||
| contract: solanaContract, | ||
| config: { | ||
| owner: 'YOUR_SOLANA_OWNER_ADDRESS', | ||
| delegate: 'YOUR_SOLANA_OWNER_ADDRESS', | ||
| }, | ||
| }, | ||
| { | ||
| contract: aptosContract, | ||
| config: { | ||
| owner: 'YOUR_APTOS_ACCOUNT_ADDRESS', | ||
| delegate: 'YOUR_APTOS_ACCOUNT_ADDRESS', | ||
| }, | ||
| }, | ||
| ], | ||
| connections: [ | ||
| { | ||
| from: aptosContract, | ||
| to: solanaContract, | ||
| config: { | ||
| enforcedOptions: [ | ||
| { | ||
| msgType: MsgType.SEND_AND_CALL, | ||
| optionType: ExecutorOptionType.LZ_RECEIVE, | ||
| gas: 5_000, | ||
| value: 0, | ||
| }, | ||
| ], | ||
| sendLibrary: '0xcc1c03aed42e2841211865758b5efe93c0dde2cb7a2a5dc6cf25a4e33ad23690', | ||
| receiveLibraryConfig: { | ||
| receiveLibrary: '0xcc1c03aed42e2841211865758b5efe93c0dde2cb7a2a5dc6cf25a4e33ad23690', | ||
| gracePeriod: BigInt(0), | ||
| }, | ||
| sendConfig: { | ||
| executorConfig: { | ||
| maxMessageSize: 10_000, | ||
| executor: '0x93353700091200ef9fdc536ce6a86182cc7e62da25f94356be9421c6310b9585', | ||
| }, | ||
| ulnConfig: { | ||
| confirmations: BigInt(10), | ||
| requiredDVNs: [layerZeroDVNAptosAddress], | ||
| optionalDVNs: [], | ||
| optionalDVNThreshold: 0, | ||
| }, | ||
| }, | ||
| receiveConfig: { | ||
| ulnConfig: { | ||
| confirmations: BigInt(15), | ||
| requiredDVNs: [layerZeroDVNAptosAddress], | ||
| optionalDVNs: [], | ||
| optionalDVNThreshold: 0, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| from: solanaContract, | ||
| to: aptosContract, | ||
| config: { | ||
| enforcedOptions: [ | ||
| { | ||
| msgType: 1, | ||
| optionType: ExecutorOptionType.LZ_RECEIVE, | ||
| gas: 200_000, | ||
| value: 0, | ||
| }, | ||
| ], | ||
| sendLibrary: '7a4WjyR8VZ7yZz5XJAKm39BUGn5iT9CKcv2pmG9tdXVH', | ||
| receiveLibraryConfig: { | ||
| receiveLibrary: '7a4WjyR8VZ7yZz5XJAKm39BUGn5iT9CKcv2pmG9tdXVH', | ||
| gracePeriod: BigInt(0), | ||
| }, | ||
| sendConfig: { | ||
| executorConfig: { | ||
| maxMessageSize: 10_000, | ||
| executor: 'AwrbHeCyniXaQhiJZkLhgWdUCteeWSGaSN1sTfLiY7xK', | ||
| }, | ||
| ulnConfig: { | ||
| confirmations: BigInt(15), | ||
| requiredDVNs: [layerZeroDVNSolanaAddress], | ||
| optionalDVNs: [], | ||
| optionalDVNThreshold: 0, | ||
| }, | ||
| }, | ||
| receiveConfig: { | ||
| ulnConfig: { | ||
| confirmations: BigInt(10), | ||
| requiredDVNs: [layerZeroDVNSolanaAddress], | ||
| optionalDVNs: [], | ||
| optionalDVNThreshold: 0, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| ], | ||
| } | ||
| export default config | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| ### Wiring Solana to Move-VM (Aptos, Initia, Movement, etc.) | ||
|
|
||
| :warning: **Important Limitations for Solana ↔ Move-VM Pathways** | ||
|
|
||
| Currently, you can only perform **one-way wiring from Solana → Move-VM** using this example. For the reverse pathway (Move-VM → Solana), you must use the [OApp Aptos Move example](https://github.com/LayerZero-Labs/devtools/tree/main/examples/oapp-aptos-move). Please follow the deployment instructions in the README.md of the `oapp-aptos-move` example for deploying to Move-VM and configuring the Move-VM → Solana pathway. | ||
|
|
||
| #### Configuration Steps for Solana → Aptos | ||
|
|
||
| :information_source: **For bidirectional Solana ↔ Aptos communication, deploy both examples:** | ||
|
|
||
| - **Solana → Aptos**: Use this example | ||
| - **Aptos → Solana**: Use the [OApp Aptos Move example](https://github.com/LayerZero-Labs/devtools/tree/main/examples/oapp-aptos-move) | ||
|
|
||
| #### Deployment Process | ||
|
|
||
| 1. **Create and Deploy Solana Example** | ||
|
|
||
| - Create the Solana example: `LZ_ENABLE_SOLANA_OAPP_EXAMPLE=1 npx create-lz-oapp@latest` | ||
| - Deploy to Solana following the deployment instructions in the Solana example README | ||
|
|
||
| 2. **Create and Deploy Aptos Move Example** | ||
|
|
||
| - Create the Aptos Move example: `LZ_ENABLE_EXPERIMENTAL_MOVE_VM_EXAMPLES=1 npx create-lz-oapp@latest` | ||
| - Deploy to Aptos following the deployment and initialization instructions in the Aptos example README | ||
|
|
||
| Your directory structure should look like this: | ||
|
|
||
| ``` | ||
| your-folder/ | ||
| ├── your-aptos-example/ | ||
| └── your-solana-example/ | ||
| ``` | ||
|
|
||
| 3. **Configure Solana Example** | ||
|
|
||
| - Navigate to the Solana example directory | ||
| - Use the example configuration at `./docs/move.layerzero.config.ts` | ||
| - Fill out the configuration with your desired values | ||
| - Replace `./layerzero.config.ts` with the completed `move.layerzero.config.ts` file | ||
|
|
||
| 4. **Wire Solana to Aptos** | ||
|
|
||
| Execute the following commands in the Solana example directory: | ||
|
|
||
| ```bash | ||
| npx hardhat lz:oapp:solana:init-config --oapp-config move.layerzero.config.ts | ||
| ``` | ||
|
|
||
| ```bash | ||
| npx hardhat lz:oapp:wire --oapp-config move.layerzero.config.ts | ||
| ``` | ||
|
|
||
| If these commands succeed, you have successfully wired the Solana contract to the Aptos Move contract. | ||
|
|
||
| 5. **Wire Aptos to Solana** | ||
|
|
||
| - Transfer the `move.layerzero.config.ts` file from the Solana example to the Aptos Move example directory | ||
| - In the Aptos Move example directory, run: | ||
| ```bash | ||
| pnpm run lz:sdk:move:wire --oapp-config move.layerzero.config.ts | ||
| ``` | ||
|
|
||
| If this command succeeds, you are ready to test the bidirectional pathway. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.