-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
10,362 additions
and
1 deletion.
There are no files selected for viewing
Submodule oft-solana
deleted from
c81c33
This file contains 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,3 @@ | ||
module.exports = { | ||
...require('@layerzerolabs/prettier-config-next'), | ||
}; |
This file contains 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,3 @@ | ||
module.exports = { | ||
extends: ['solhint:recommended', require.resolve('@layerzerolabs/solhint-config')], | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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,23 @@ | ||
compressionLevel: mixed | ||
|
||
enableGlobalCache: true | ||
globalFolder: .yarn/berry | ||
|
||
nodeLinker: node-modules | ||
|
||
unsafeHttpWhitelist: | ||
- localhost | ||
|
||
npmRegistries: | ||
"//localhost:4873": | ||
npmAuthToken: "${LOCAL_NPM_TOKEN-}" | ||
//registry.npmjs.org: | ||
npmAuthToken: "${NPM_TOKEN-}" | ||
|
||
npmScopes: | ||
layerzerolabs: | ||
npmAlwaysAuth: true | ||
npmPublishRegistry: "${NPM_REGISTRY-https://registry.npmjs.org}" | ||
npmRegistryServer: "${NPM_REGISTRY-https://registry.npmjs.org}" | ||
|
||
yarnPath: .yarn/releases/yarn-4.0.2.cjs |
This file contains 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,69 @@ | ||
<div align="center"> | ||
<a href="https://layerzero.network"> | ||
<img alt="LayerZero" style="width: 60%" src="https://layerzero.network/static/logo.svg"/> | ||
</a> | ||
|
||
<h1>LayerZero OFT</h1> | ||
|
||
<p> | ||
<strong>Omnichain Fungible Token(Beta)</strong> | ||
</p> | ||
|
||
<p> | ||
<a href="https://docs.layerzero.network/v2/home/protocol/contract-standards#oft"><img alt="Tutorials" src="https://img.shields.io/badge/docs-tutorials-blueviolet" /></a> | ||
</p> | ||
</div> | ||
|
||
The Omnichain Fungible Token (OFT) Standard allows fungible tokens to be transferred across multiple blockchains without asset wrapping or middlechains. | ||
|
||
This standard works by burning tokens on the source chain whenever an omnichain transfer is initiated, sending a message via the protocol, and delivering a function call to the destination contract to mint the same number of tokens burned. This creates a unified supply across all networks LayerZero supports that the OFT is deployed on. | ||
|
||
![title](oft.jpg) | ||
|
||
[Audit Reports](https://github.com/LayerZero-Labs/Audits) | ||
|
||
## Prepare ProgramId | ||
|
||
create programId keypair files if not existed | ||
|
||
``` | ||
cd packages/solana/contracts | ||
solana-keygen new -o target/deploy/endpoint-keypair.json | ||
solana-keygen new -o target/deploy/oft-keypair.json | ||
anchor keys sync | ||
``` | ||
|
||
## Build & Test | ||
|
||
```bash | ||
yarn && yarn build && yarn test | ||
``` | ||
|
||
## Deploy | ||
|
||
``` | ||
cd packages/solana/contracts | ||
``` | ||
|
||
1. with anchor | ||
|
||
```bash | ||
anchor build -v | ||
solana program deploy --program-id target/deploy/oft-keypair.json target/verifiable/oft.so -u mainnet-beta | ||
``` | ||
|
||
or | ||
|
||
2. with solana-verify | ||
```bash | ||
solana-verify build | ||
solana program deploy --program-id target/deploy/oft-keypair.json target/deploy/oft.so -u mainnet-beta | ||
``` | ||
|
||
please visit [Solana Verify CLI](https://github.com/Ellipsis-Labs/solana-verifiable-build) and [Deploy a Solana Program with the CLI](https://docs.solanalabs.com/cli/examples/deploy-a-program) for more detail. | ||
|
||
#### Notice | ||
|
||
If you encounter issues during compilation and testing, it might be due to the versions of Solana and Anchor. You can switch to Solana version `1.17.31` and Anchor version `0.29.0`, as these are the versions we have tested and verified to be working. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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,25 @@ | ||
{ | ||
"name": "@layerzerolabs/oft", | ||
"version": "0.0.1", | ||
"private": true, | ||
"workspaces": [ | ||
"packages/**" | ||
], | ||
"scripts": { | ||
"build": "$npm_execpath workspaces foreach --all run build", | ||
"clean": "$npm_execpath workspaces foreach --all run clean", | ||
"test": "$npm_execpath workspaces foreach --all run test" | ||
}, | ||
"devDependencies": { | ||
"@layerzerolabs/prettier-config-next": "^2.0.1", | ||
"@layerzerolabs/solhint-config": "^2.0.1", | ||
"prettier": "^3.1.0", | ||
"rimraf": "^5.0.5", | ||
"solhint": "^4.0.0", | ||
"typescript": "^4.3.5" | ||
}, | ||
"packageManager": "[email protected]", | ||
"engines": { | ||
"node": ">=18.12.0" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
examples/oft-solana/packages/solana/contracts/.prettierignore
This file contains 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,8 @@ | ||
|
||
.anchor | ||
.DS_Store | ||
target | ||
node_modules | ||
dist | ||
build | ||
test-ledger |
This file contains 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,20 @@ | ||
[toolchain] | ||
anchor_version = "0.29.0" | ||
solana_version = "1.17.31" | ||
|
||
[features] | ||
seeds = false | ||
skip-lint = false | ||
|
||
[programs.localnet] | ||
oft = "HRPXLCqspQocTjfcX4rvAPaY9q6Gwb1rrD3xXWrfJWdW" | ||
|
||
[registry] | ||
url = "https://api.apr.dev" | ||
|
||
[provider] | ||
cluster = "Localnet" | ||
wallet = "~/.config/solana/id.json" | ||
|
||
[scripts] | ||
test = "yarn run ts-mocha -b -p ./tsconfig.json -t 1000000 tests/**/*.test.ts" |
Oops, something went wrong.