bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 37쪽 중 37쪽
price is fetched by calling the `getGasPrice` method
* The gas used to execute a transaction is fetched by calling the `estimateGas` method
The total gas fee is thus calculated as:
```
totalEstimatedGasFee = L1RollupFee + L2TxnFee
```
## SDK Installation
{% hint style="info" %}
Before proceeding, please make sure you have `npm` installed and configured in your local environment.
{% endhint %}
Start by installing Mantle SDK and the necessary dependencies in your environment by running the following command:
```bash
npm install @mantleio/sdk
```
{% hint style="warning" %}
If you already have the SDK installed, please make sure you update to the latest version by running the command `npm update @mantleio/sdk` since the L1 rollup fee parameters are only available for **version 0.2.2, or higher**.
{% endhint %}
## Script
You can directly use the following JS code to estimate the total gas fees.
```javascript
const ethers = require("ethers")
const mantleSDK = require("@mantleio/sdk");
async function estimateGasFee() {
const l2RpcProvider = new ethers.providers.JsonRpcProvider("https://rpc.mantle.xyz")
try{
// Arbitrary tx object
const tx = {
to: '0x...',
value: ethers.utils.parseEther("0.1"), // Returns value in wei
};
// By calling the BVM_GasPriceOracle contract method l1basefee()
const gasPrice = await mantleSDK.getL1GasPrice(l2RpcProvider);
const decimals = await mantleSDK.decimals(l2RpcProvider);
const scalar = await mantleSDK.scalar(l2RpcProvider);
const gasUsed = await mantleSDK.overhead(l2RpcProvider);
// L1RollupFee
const l1RollupFee = gasPrice.mul(gasUsed).mul(scalar).div(10**decimals)
// L2TxnFee
const l2Gas = await l2RpcProvider.estimateGas(tx)
const l2GasPrice = await l2RpcProvider.getGasPrice()
const l2TxnFee = l2GasPrice.mul(l2Gas);
// Total estimated Gas Fee
const totalEstimatedGasFee = l1RollupFee.add(l2TxnFee);
console.log(`Total estimated Gas Fee: ${totalEstimatedGasFee.toString()}`);
} catch (error) {
console.error('Error estimating gas:', error);
}
}
estimateGasFee();
```
## Result
`totalEstimatedGasFee` contains the final result of the calculation, as discussed in the [#description](#description "mention") section.
# How to Update the NFT Metadata
A tutorial showing how to update NFT metadata via Mantle Explorer
{% hint style="danger" %}
Mantle v2 Tectonic has been released, please move to the new [documentation](https://docs-v2.mantle.xyz/)!
{% endhint %}
Mantle Explorer now offers a streamlined process for updating NFT metadata, ensuring that your NFT information stays accurate and current. There are two methods to update the metadata
## Manual Update via Explorer Frontend
1. Navigate to the specific NFT's detail page on our explorer.
2. Click the `Refetch Metadata` button manually to initiate an immediate metadata update.
<figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FMmogcXaAC2lZijJVNGvl%2F206edf41-ceda-44db-a559-0a00f67733f1.jpeg?alt=media&token=4ded8b5b-720b-423b-a83b-65c15afb1671" alt=""><figcaption><p>refetch metadata button</p></figcaption></figure>
## Update via the Explorer API
Developers and power users can leverage the Explorer API for a programmatic approach to metadata updates.
1. Make a call to the API endpoint: `https://explorer.mantle.xyz/api/v1/asset/{token_address}/{token_id}`
2. The metadata will be refreshed automatically after the API request is made.
For example: `https://explorer.mantle.xyz/api/v1/asset/0xfebaf2241d4947e5724d136e8ba8cfeeef9b4157/2`
### Batch Updates for Developers
For developers handling multiple NFTs, implementing a loop to call the API interface for various token IDs allows for efficient batch updates.
* Use the endpoint: `https://explorer.mantle.xyz/api/v1/asset/{token_address}/{token_id}` for requesting metadata of multiple token IDs and initiating updates.
# Troubleshooting
{% hint style="danger" %}
Mantle v2 Tectonic has been released, please move to the new [documentation](https://docs-v2.mantle.xyz/)!
{% endhint %}
## General
### - Status code: 429 { "error": "API rate limit exceeded" }
The official Mantle RPC employs rate limiting to ensure stability during traffic spikes. If your particular use case involves calling the Mantle API frequently, you might run into issues that arise due to rate limiting. In case this happens, please consider connecting to third-party RPCs instead. You can find the list of available RPC providers here: [Node RPC Providers](/network/network/for-devs/resources-and-tooling/node-rpc-providers)
### - RPC call Error: timeout
While calling the methods of our rpc (e.g. debug trace / get logs) to sync data from blocks, you may encounter the 'Timeout' issue, that's because the output of certain calls may be a large amount of data(due to big size blocks or large amount of logs) which may needs more time to be synced.
So under such situations if the call lacks of timeout parameter or the default timeout settings is too low, it may result in an error of timeout. So it is recommended that you should add a timeout parameter with the call or set hingher timeout parameter accordingly to solve the timeout issue.
## Smart Contracts
### - Contract deploy error: **ProviderError: too many arguments, want at most 1**
If you run into this issue when deploying your contract, you're probably running a newer version of Hardhat. Try manually specifying the gas limit when deploying your contract, like so: 
```javascript
const MyNFT = await hre.ethers.deployContract("ContractName", {
gasLimit: "0x1000000",
});
```
If the issue persists, we recommend initializing your project with an older version of Hardhat (v2.14) by running the following command:
```bash
npx hardhat@2.14.0
```
### - Contract verification error: Hardhat found multiple contracts in the project (your MyTokenContract and the imported @openzeppelin/contracts/token/ERC20/IERC20.sol), and it doesn't know against which one you want to verify the bytecode
If you see this error, try verifying the contract again by specifying the name of the contract that you're looking to verify. You can do this using the `--contract` option. Here's an example:
{% code overflow="wrap" %}
```bash
npx hardhat verify --contract "contracts/MyTokenContract.sol:MyToken" --network mantleTest 0x3A2b26...
```
{% endcode %}
### - Contract invocation error: Bytecode does not match, please try again
If you encounter this error, check the following:
* Whether the compiler version is the same
* Whether the optimization runs match (if you've enabled optimization)
* Whether the contract name matches exactly as specified in the source code
## Standard Bridge
### - Error when withdrawing: no bridge found for token pair
Try switching to a different RPC provider. Available RPCs: [Node RPC Providers](/network/network/for-devs/resources-and-tooling/node-rpc-providers)
## Explorer
### - Error: Awaiting internal transactions for reason
You may encounter this error if you there are multiple internal transaction calls in the contract being invoked. This does not necessarily mean the transaction has failed, just that the explorer is yet to receive acknowledgements for all the internal transactions.
# Support
Get in touch with us
In case you have any questions, or if you run into any issues during your development journey, feel free to reach out to us through any of the following channels.
<table><thead><tr><th width="136" align="center">Channel</th><th>Link</th></tr></thead><tbody><tr><td align="center">Discord</td><td><a href="https://discord.com/invite/0xMantle">https://discord.com/invite/0xMantle</a></td></tr><tr><td align="center">Telegram</td><td><a href="https://t.me/mantledevs">https://t.me/mantledevs</a></td></tr></tbody></table>
# Audits
Security audit reports on different Mantle Network components
<table><thead><tr><th width="169" align="center">Auditor</th><th width="255">Scope<select multiple><option value="9569f7e25647404a8af24bfe6a2ad84f" label="Bridge" color="blue"></option><option value="0c80fa0539ff4260b9e789de8dd5b836" label="$MNT" color="blue"></option><option value="81ff21e60c6142869578eb0c003d2bc8" label="Migrator" color="blue"></option><option value="4b0e713c0ce6449d80fe124718ca1107" label="Mantle Network" color="blue"></option><option value="6240b42885a54e9e8146e656b90e9f8f" label="DA" color="blue"></option></select></th><th width="118" align="center">Report</th><th align="center">Date</th></tr></thead><tbody><tr><td align="center">OpenZeppelin</td><td><span data-option="9569f7e25647404a8af24bfe6a2ad84f">Bridge, </span><span data-option="0c80fa0539ff4260b9e789de8dd5b836">$MNT, </span><span data-option="81ff21e60c6142869578eb0c003d2bc8">Migrator</span></td><td align="center"><a href="https://blog.openzeppelin.com/mantle-token-and-bridge-audit">Link</a></td><td align="center">23-07-17</td></tr><tr><td align="center">Secure3</td><td><span data-option="4b0e713c0ce6449d80fe124718ca1107">Mantle Network</span></td><td align="center"><a href="https://secure3.io/audit/Mantle">Link</a></td><td align="center">23-07-17</td></tr><tr><td align="center">Sigma Prime</td><td><span data-option="4b0e713c0ce6449d80fe124718ca1107">Mantle Network</span></td><td align="center"><a href="https://github.com/sigp/public-audits/blob/master/mantle/review.pdf">Link</a></td><td align="center">23-07-17</td></tr><tr><td align="center">Quantstamp</td><td><span data-option="9569f7e25647404a8af24bfe6a2ad84f">Bridge, </span><span data-option="0c80fa0539ff4260b9e789de8dd5b836">$MNT, </span><span data-option="81ff21e60c6142869578eb0c003d2bc8">Migrator</span></td><td align="center"><a href="https://certificate.quantstamp.com/full/mantle-network-token-migration/1ef59b13-313b-4382-84cc-9de402ffabcd/index.html">Link 1</a><br><a href="https://certificate.quantstamp.com/full/mantle-network-bridge-contracts/b3babf24-0c57-449a-bc29-8133c665734a/index.html">Link 2</a></td><td align="center">23-07-14</td></tr><tr><td align="center">Zellic</td><td><span data-option="9569f7e25647404a8af24bfe6a2ad84f">Bridge, </span><span data-option="0c80fa0539ff4260b9e789de8dd5b836">$MNT, </span><span data-option="81ff21e60c6142869578eb0c003d2bc8">Migrator</span></td><td align="center"><a href="https://github.com/Zellic/publications/blob/master/Mantle%20-%20Zellic%20Audit%20Report.pdf">Link</a></td><td align="center">23-07-11</td></tr></tbody></table>
## Component Definitions
* **Bridge:** Refers to the bridging contracts [`L1StandardBridge`](https://github.com/mantlenetworkio/mantle/blob/main/packages/contracts/contracts/L1/messaging/L1StandardBridge.sol) and [`L2StandardBridge`](https://github.com/mantlenetworkio/mantle/blob/main/packages/contracts/contracts/L2/messaging/L2StandardBridge.sol) for the official [Mantle Bridge](https://bridge.mantle.xyz/).
* **$MNT:** Refers to the $MNT [token contract](https://etherscan.io/address/0x3c3a81e81dc49a522a592e7622a7e711c06bf354#code).
* **Migrator:** Refers to the [migrator contract](https://etherscan.io/address/0xffb94c81d9a283ab4373ab4ba3534dc4fb8d1295#code) that migrates $BIT to $MNT 1:1.
* **Mantle Network:** Refers to the code and the contracts that implement Mantle Network's core rollup protocol. Can be found on [Github](https://github.com/mantlenetworkio/mantle#directory-structure).
# Official Links
### Communication and Socials
**Website:** <https://mantle.xyz>
**Twitter:** <https://twitter.com/0xMantle>
**Telegram:** <https://t.me/mantlenetwork>
**Discord:** <https://discord.com/invite/0xMantle>
**Reddit:** <https://reddit.com/r/0xMantle/>
**Blog:** <https://www.mantle.xyz/blog>
**YouTube:** <https://www.youtube.com/@0xMantle>
**LinkedIn:** <https://www.linkedin.com/company/0xmantle/>
**GitHub:** <https://github.com/mantlenetworkio>프로젝트로 돌아가기