Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/lzapp-migration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ solana program deploy --program-id target/deploy/oft-keypair.json target/verifia

:information_source: For **OFT** and **OFT Mint-and-Burn Adapter**, the SPL token's Mint Authority is set to the **Mint Authority Multisig**, which always has the **OFT Store** as a signer. The multisig is fixed to needing 1 of N signatures.

:information_source: For **OFT** and **OFT Mint-And-Burn Adapter**, you have the option to specify additional signers through the `--additional-minters` flag. If you choose not to, you must pass in `--only-oft-store true`, which means only the **OFT Store** will be a signer for the \_Mint Authority Multisig\*.
:information_source: For **OFT** and **OFT Mint-And-Burn Adapter**, you have the option to specify additional signers through the `--additional-minters` flag. If you choose not to, you must pass in `--only-oft-store`, which means only the **OFT Store** will be a signer for the \_Mint Authority Multisig\*.

:warning: If you choose to go with `--only-oft-store`, you will not be able to add in other signers/minters or update the Mint Authority, and the Freeze Authority will be immediately renounced. The token Mint Authority will be fixed Mint Authority Multisig address while the Freeze Authority will be set to None.

Expand All @@ -227,7 +227,7 @@ solana program deploy --program-id target/deploy/oft-keypair.json target/verifia
pnpm hardhat lz:oft:solana:create --eid 40168 --program-id <PROGRAM_ID>
```

:warning: Use `--additional-minters` flag to add a CSV of additional minter addresses to the Mint Authority Multisig. If you do not want to, you must specify `--only-oft-store true`.
:warning: Use `--additional-minters` flag to add a CSV of additional minter addresses to the Mint Authority Multisig. If you do not want to, you must specify `--only-oft-store`.

:information_source: You can also specify `--amount <AMOUNT>` to have the OFT minted to your deployer address upon token creation.

Expand Down
12 changes: 5 additions & 7 deletions examples/lzapp-migration/tasks/solana/createOFT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,9 @@ task('lz:oft:solana:create', 'Mints new SPL Token and creates new OFT Store acco
.addParam('symbol', 'Token Symbol', 'MOFT', devtoolsTypes.string)
.addParam('tokenMetadataIsMutable', 'Token metadata is mutable', true, devtoolsTypes.boolean)
.addParam('additionalMinters', 'Comma-separated list of additional minters', undefined, devtoolsTypes.csv, true)
.addOptionalParam(
.addFlag(
'onlyOftStore',
'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.',
false,
devtoolsTypes.boolean
'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.'
)
.addParam(
'tokenProgram',
Expand Down Expand Up @@ -205,13 +203,13 @@ task('lz:oft:solana:create', 'Mints new SPL Token and creates new OFT Store acco
if (!additionalMintersAsStrings) {
if (!onlyOftStore) {
throw new Error(
'If you want to proceed with only the OFT Store having the ability to mint, please specify --only-oft-store true. Note that this also means the Freeze Authority will be immediately renounced, unless --freeze-authority is specified.'
'If you want to proceed with only the OFT Store having the ability to mint, please specify --only-oft-store. Note that this also means the Freeze Authority will be immediately renounced, unless --freeze-authority is specified.'
)
}
}

if (freezeAuthorityStr && !onlyOftStore) {
throw new Error('`--freeze-authority` is only supported in `--only-oft-store true` mode')
throw new Error('`--freeze-authority` is only supported in `--only-oft-store` mode')
}

if (onlyOftStore && additionalMintersAsStrings && additionalMintersAsStrings?.length > 0) {
Expand All @@ -222,7 +220,7 @@ task('lz:oft:solana:create', 'Mints new SPL Token and creates new OFT Store acco

if (onlyOftStore && !ci) {
const continueWithOnlyOftStore = await promptToContinue(
`You have chosen \`--only-oft-store true\`. This means that only the OFT Store will be able to mint new tokens${freezeAuthorityStr ? '' : ' and that the Freeze Authority will be immediately renounced'}. Continue?`
`You have chosen \`--only-oft-store\`. This means that only the OFT Store will be able to mint new tokens${freezeAuthorityStr ? '' : ' and that the Freeze Authority will be immediately renounced'}. Continue?`
)
if (!continueWithOnlyOftStore) {
return
Expand Down
10 changes: 3 additions & 7 deletions examples/lzapp-migration/tasks/solana/setAuthority.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,9 @@ task('lz:oft:solana:setauthority', 'Create a new Mint Authority SPL multisig and
.addParam('programId', 'The OFT Program id')
.addParam('escrow', 'The OFT Escrow public key')
.addParam('additionalMinters', 'Comma-separated list of additional minters', undefined, devtoolsTypes.csv, true)
.addOptionalParam(
.addFlag(
'onlyOftStore',
'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.',
false,
devtoolsTypes.boolean
'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.'
)
.addParam(
'tokenProgram',
Expand All @@ -123,9 +121,7 @@ task('lz:oft:solana:setauthority', 'Create a new Mint Authority SPL multisig and
const tokenProgram = publicKey(tokenProgramStr)
if (!additionalMintersAsStrings) {
if (!onlyOftStore) {
throw new Error(
'If you want to proceed with only the OFTStore, please specify --only-oft-store true'
)
throw new Error('If you want to proceed with only the OFTStore, please specify --only-oft-store')
}
console.log(
'No additional minters specified. This will result in only the OFTStore being able to mint new tokens.'
Expand Down
15 changes: 7 additions & 8 deletions examples/oft-solana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ solana program deploy --program-id target/deploy/oft-keypair.json target/verifia
### Create the Solana OFT

```bash
pnpm hardhat lz:oft:solana:create --eid 40168 --program-id <PROGRAM_ID> --only-oft-store true --amount 100000000000
pnpm hardhat lz:oft:solana:create --eid 40168 --program-id <PROGRAM_ID> --only-oft-store --amount 100000000000
```

The above command will create a Solana OFT which will have only the OFT Store as the Mint Authority and will also mint 100 OFT (given the default 9 decimals on Solana, this would be `100_000_000_000` in raw amount).
Expand Down Expand Up @@ -317,7 +317,7 @@ This section explains the three different options available for creating OFTs on
- **Note**: Preferred option when you don't have an existing token

```bash
pnpm hardhat lz:oft:solana:create --eid 40168 --program-id <PROGRAM_ID> --only-oft-store true --amount 100000000000
pnpm hardhat lz:oft:solana:create --eid 40168 --program-id <PROGRAM_ID> --only-oft-store --amount 100000000000
```

### OFT Adapter
Expand Down Expand Up @@ -452,9 +452,8 @@ npx hardhat --help
Comma-separated list of additional minters
_Default: undefined_

- **`--only-oft-store`** (boolean)
If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.
_Default: false_
- **`--only-oft-store`** (flag)
If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.

- **`--freeze-authority`** (string)
The Freeze Authority address (only supported in onlyOftStore mode)
Expand All @@ -476,13 +475,13 @@ The following parameters are only used for Mint-And-Burn Adapter (MABA) mode:

:information_source: For **OFT**, the SPL token's Mint Authority is set to the **Mint Authority Multisig**, which always has the **OFT Store** as a signer. The multisig is fixed to needing 1 of N signatures.

:information_source: You have the option to specify additional signers through the `--additional-minters` flag. If you choose not to, you must pass in `--only-oft-store true`, which means only the **OFT Store** will be a signer for the **Mint Authority Multisig**.
:information_source: You have the option to specify additional signers through the `--additional-minters` flag. If you choose not to, you must pass in `--only-oft-store`, which means only the **OFT Store** will be a signer for the **Mint Authority Multisig**.

:warning: If you choose to go with `--only-oft-store`, you will not be able to add in other signers/minters or update the Mint Authority, and the Freeze Authority will be immediately renounced. The token Mint Authority will be fixed Mint Authority Multisig address while the Freeze Authority will be set to None.

##### Important Notes

:warning: Use `--additional-minters` flag to add a CSV of additional minter addresses to the Mint Authority Multisig. If you do not want to, you must specify `--only-oft-store true`.
:warning: Use `--additional-minters` flag to add a CSV of additional minter addresses to the Mint Authority Multisig. If you do not want to, you must specify `--only-oft-store`.

<details>
<summary> <a href="https://docs.layerzero.network/v2/developers/evm/create-lz-oapp/deploying"><code>pnpm hardhat lz:oft:solana:debug --eid <SOLANA_EID></code></a> </summary>
Expand Down Expand Up @@ -512,7 +511,7 @@ const solanaContract: OmniPointHardhat = {

This is only relevant for **OFT**. If you opted to include the `--amount` flag in the create step, that means you already have minted some Solana OFT and you can skip this section.

:information_source: This is only possible if you specified your deployer address as part of the `--additional-minters` flag when creating the Solana OFT. If you had chosen `--only-oft-store true`, you will not be able to mint your OFT on Solana.
:information_source: This is only possible if you specified your deployer address as part of the `--additional-minters` flag when creating the Solana OFT. If you had chosen `--only-oft-store`, you will not be able to mint your OFT on Solana.

First, you need to create the Associated Token Account for your address.

Expand Down
12 changes: 5 additions & 7 deletions examples/oft-solana/tasks/solana/createOFT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,9 @@ task('lz:oft:solana:create', 'Mints new SPL Token and creates new OFT Store acco
.addParam('symbol', 'Token Symbol', 'MOFT', devtoolsTypes.string)
.addParam('tokenMetadataIsMutable', 'Token metadata is mutable', true, devtoolsTypes.boolean)
.addParam('additionalMinters', 'Comma-separated list of additional minters', undefined, devtoolsTypes.csv, true)
.addOptionalParam(
.addFlag(
'onlyOftStore',
'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.',
false,
devtoolsTypes.boolean
'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.'
)
.addParam(
'tokenProgram',
Expand Down Expand Up @@ -205,13 +203,13 @@ task('lz:oft:solana:create', 'Mints new SPL Token and creates new OFT Store acco
if (!additionalMintersAsStrings) {
if (!onlyOftStore) {
throw new Error(
'If you want to proceed with only the OFT Store having the ability to mint, please specify --only-oft-store true. Note that this also means the Freeze Authority will be immediately renounced, unless --freeze-authority is specified.'
'If you want to proceed with only the OFT Store having the ability to mint, please specify --only-oft-store. Note that this also means the Freeze Authority will be immediately renounced, unless --freeze-authority is specified.'
)
}
}

if (freezeAuthorityStr && !onlyOftStore) {
throw new Error('`--freeze-authority` is only supported in `--only-oft-store true` mode')
throw new Error('`--freeze-authority` is only supported in `--only-oft-store` mode')
}

if (onlyOftStore && additionalMintersAsStrings && additionalMintersAsStrings?.length > 0) {
Expand All @@ -222,7 +220,7 @@ task('lz:oft:solana:create', 'Mints new SPL Token and creates new OFT Store acco

if (onlyOftStore && !ci) {
const continueWithOnlyOftStore = await promptToContinue(
`You have chosen \`--only-oft-store true\`. This means that only the OFT Store will be able to mint new tokens${freezeAuthorityStr ? '' : ' and that the Freeze Authority will be immediately renounced'}. Continue?`
`You have chosen \`--only-oft-store\`. This means that only the OFT Store will be able to mint new tokens${freezeAuthorityStr ? '' : ' and that the Freeze Authority will be immediately renounced'}. Continue?`
)
if (!continueWithOnlyOftStore) {
return
Expand Down
10 changes: 3 additions & 7 deletions examples/oft-solana/tasks/solana/setAuthority.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,9 @@ task('lz:oft:solana:setauthority', 'Create a new Mint Authority SPL multisig and
.addParam('programId', 'The OFT Program id')
.addParam('escrow', 'The OFT Escrow public key')
.addParam('additionalMinters', 'Comma-separated list of additional minters', undefined, devtoolsTypes.csv, true)
.addOptionalParam(
.addFlag(
'onlyOftStore',
'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.',
false,
devtoolsTypes.boolean
'If you plan to have only the OFTStore and no additional minters. This is not reversible, and will result in losing the ability to mint new tokens by everything but the OFTStore.'
)
.addParam(
'tokenProgram',
Expand All @@ -123,9 +121,7 @@ task('lz:oft:solana:setauthority', 'Create a new Mint Authority SPL multisig and
const tokenProgram = publicKey(tokenProgramStr)
if (!additionalMintersAsStrings) {
if (!onlyOftStore) {
throw new Error(
'If you want to proceed with only the OFTStore, please specify --only-oft-store true'
)
throw new Error('If you want to proceed with only the OFTStore, please specify --only-oft-store')
}
console.log(
'No additional minters specified. This will result in only the OFTStore being able to mint new tokens.'
Expand Down