From df085387f0b904fbfb5d40488cfd616e82e7fc74 Mon Sep 17 00:00:00 2001 From: Nazreen Date: Thu, 5 Dec 2024 02:45:13 +0800 Subject: [PATCH] docs(oft-solana): mention rent (#1094) --- examples/oft-solana/README.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/examples/oft-solana/README.md b/examples/oft-solana/README.md index d0cef435d..10837ea82 100644 --- a/examples/oft-solana/README.md +++ b/examples/oft-solana/README.md @@ -142,8 +142,35 @@ Replace `9UovNrJD8pQyBLheeHNayuG1wJSEAoxkmM14vw5gcsTT` with the programId that y Ensure you have Docker running before running the build command. +#### Build the Solana OFT program + ```bash anchor build -v # verification flag enabled +``` + +#### Preview Rent Costs for the Solana OFT + +:information_source: The majority of the SOL required to deploy your program will be for [**rent**](https://solana.com/docs/core/fees#rent) (specifically, for the minimum balance of SOL required for [rent-exemption](https://solana.com/docs/core/fees#rent-exempt)), which is calculated based on the amount of bytes the program or account uses. Programs typically require more rent than PDAs as more bytes are required to store the program's executable code. + +In our case, the OFT Program's rent accounts for roughly 99% of the SOL needed during deployment, while the other accounts' rent, OFT Store, Mint, Mint Authority Multisig and Escrow make up for only a fraction of the SOL needed. + +You can preview how much SOL would be needed for the program account. Note that the total SOL required would to be slightly higher than just this, to account for the other accounts that need to be created. + +```bash +solana rent $(wc -c < target/verifiable/oft.so) +``` + +You should see an output such as + +```bash +Rent-exempt minimum: 3.87415872 SOL +``` + +:information_source: LayerZero's default deployment path for Solana OFTs require you to deploy your own OFT program as this means you own the Upgrade Authority and don't rely on LayerZero to manage that authority for you. Read [this](https://neodyme.io/en/blog/solana_upgrade_authority/) to understand more no why this is important. + +#### Deploy the Solana OFT + +```bash solana program deploy --program-id target/deploy/oft-keypair.json target/verifiable/oft.so -u devnet ``` @@ -151,7 +178,7 @@ solana program deploy --program-id target/deploy/oft-keypair.json target/verifia :warning: If the deployment is slow, it could be that the network is congested. If so, you can either wait it out or opt to include a `priorityFee`. -### (optional) Deploying with a priority fee +#### (optional) Deploying with a priority fee This section only applies if you are unable to land your deployment transaction due to network congestion.