Mantle 백서

Mantle

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 37쪽 중 32쪽

s between Mantle network and Ethereum. <table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td></td><td> <strong>Bridging $MNT</strong></td><td></td><td><a href="/network/network/for-devs/tutorials/bridging-usdmnt-using-mantle-sdk">Bridging $MNT using Mantle SDK</a></td></tr><tr><td></td><td> <strong>Bridging $ETH</strong></td><td></td><td><a href="https://mantlenetworkio.github.io/mantle-tutorial/cross-dom-bridge-eth/">https://mantlenetworkio.github.io/mantle-tutorial/cross-dom-bridge-eth/</a></td></tr><tr><td></td><td> <strong>Bridging ERC20 tokens</strong></td><td></td><td><a href="https://mantlenetworkio.github.io/mantle-tutorial/cross-dom-bridge-erc20/">https://mantlenetworkio.github.io/mantle-tutorial/cross-dom-bridge-erc20/</a></td></tr></tbody></table> ## Deposits $MNT/$ETH/ERC20/ERC721 token deposits into L2 from the Ethereum mainnet can be triggered using the following SDK methods. <table><thead><tr><th width="170" align="center">Token Type</th><th>SDK Methods</th></tr></thead><tbody><tr><td align="center">$ETH</td><td><code>depositETH</code></td></tr><tr><td align="center">$MNT, ERC20</td><td><code>depositERC20</code></td></tr><tr><td align="center">ERC721</td><td>Coming soon!</td></tr></tbody></table> {% hint style="warning" %} You must first approve the Mantle Bridge to use the amount of $MNT/$ETH/ERC20/ERC721 tokens that you are moving to L2, or the deposit will fail. {% endhint %} {% hint style="info" %} $ETH deposits can alternatively be triggered by sending $ETH directly to the [L1StandardBridge](https://github.com/mantlenetworkio/mantle/blob/main/packages/contracts/contracts/L1/messaging/L1StandardBridge.sol). Your account will be funded with the corresponding amount once the transaction is detected and finalized. {% endhint %} ## Withdrawals $MNT/$ETH/ERC20/ERC721 token withdrawals from L2 to the Ethereum mainnet can be triggered using the following SDK methods. {% hint style="info" %} All withdrawals use $MNT for gas fees.&#x20; {% endhint %} <table><thead><tr><th width="148" align="center">Token Type</th><th width="139">SDK Methods</th><th>L2 Token Address</th></tr></thead><tbody><tr><td align="center">$MNT</td><td><code>withdraw</code></td><td><code>0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000</code></td></tr><tr><td align="center">$ETH</td><td><code>withdraw</code></td><td><code>0xdEAddEaDdeadDEadDEADDEAddEADDEAddead1111</code></td></tr><tr><td align="center">ERC20</td><td><code>withdraw</code></td><td>-</td></tr><tr><td align="center">ERC721</td><td>Coming soon!</td><td>-</td></tr></tbody></table> ## The Token List The Mantle Bridge allows a one-to-many mapping between L1 and L2 tokens, meaning that there can be multiple Mantle implementations of an L1 token.&#x20; However, there is always a one-to-one mapping between L1 and L2 tokens listed on the [Mantle token list](https://token-list.mantle.xyz/mantle.tokenlist.json). The token list is used as the source of truth for the [Mantle Bridge](https://bridge.mantle.xyz) which is the main portal for moving assets between Layer 1 and Layer 2. ### Adding a Token to the List If you want to have your token added to the token list, you'll need to make a pull request against the [Mantle token list repository](https://github.com/mantlenetworkio/mantle-token-lists) . You'll need the addresses for both the L1 and L2 tokens, as well as a logo for the token. {% hint style="info" %} For reference, take a look at [this simple pull request](https://github.com/mantlenetworkio/mantle-token-lists#adding-a-token-to-the-list) that adds a token to the token list. {% endhint %} ## Sending Messages Contracts on Mantle can invoke contract functions on Ethereum, and vice versa. This enables dApps on Mantle and Ethereum to interact with each other. {% hint style="info" %} Here's a [step-by-step guide](https://github.com/mantlenetworkio/mantle-tutorial/tree/main/cross-dom-comm#communication-between-contracts-on-l1-and-l2) on how to enable communication between L1 and L2. {% endhint %} # Mantle Client SDK Helping devs familiarize with the available tools {% hint style="danger" %} Mantle v2 Tectonic has been released, please move to the new [documentation](https://docs-v2.mantle.xyz/)! {% endhint %} We recommend reading the following sections prior to using the SDK. * To understand the opcode behaviour differences between Mantle Network and Ethereum read [Solidity Support](/network/network/for-devs/solidity-support) * To understand how gas fees are calculated read [Transaction Fees on L2](/network/network/introduction/transaction-fees-on-l2) ## Javascript SDK Use the link below to navigate to our SDK reference docs. {% embed url="<https://sdk.mantle.xyz/>" %} ## SDK Tutorials {% content-ref url="/pages/cFG57e8MwTyZ3Tf4MqOj" %} [Bridging $MNT using Mantle SDK](/network/network/for-devs/tutorials/bridging-usdmnt-using-mantle-sdk) {% endcontent-ref %} {% content-ref url="/pages/TdiWhufTWjMVR6zXGrHD" %} [Viewing Transactions between Layers](/network/network/for-devs/tutorials/viewing-transactions-between-layers) {% endcontent-ref %} # Thirdweb SDK How to use Thirdweb CLI to deploy contracts and connect your dApps to Mantle Network {% hint style="danger" %} Mantle v2 Tectonic has been released, please move to the new [documentation](https://docs-v2.mantle.xyz/)! 2023/12/04 Thirdweb released a report about recent security vulnerabilities in the commonly used open-source library for web3 smart contracts. All developers who have previously deployed contracts are advised to ensure that the contract is secure, see details [here](https://blog.thirdweb.com/security-vulnerability/). {% endhint %} [thirdweb](https://portal.thirdweb.com/) is a complete web3 development framework that provides everything you need to connect your apps and games to decentralized networks like Mantle Network.&#x20; {% hint style="info" %} Visit the [thirdweb docs](https://portal.thirdweb.com/cli) to find more info and instructions on the thirdweb CLI {% endhint %} ## Installing Thirdweb CLI You can install the thirdweb CLI globally on your machine using `npm` by running the following command. ```bash npm i -g @thirdweb-dev/cli ``` ## Creating a New Project To create a new project with thirdweb installed and configured, run: ``` npx thirdweb create ``` ## Deploying a Contract See the section on deploying a contract [Deploying Contracts](/network/network/for-devs/tutorials/deploying-contracts#using-thirdweb-cli) . ## Connecting Your App thirdweb offers SDKs for a range of programming languages, such as [React](https://portal.thirdweb.com/react), [React Native](https://portal.thirdweb.com/react-native), [TypeScript](https://portal.thirdweb.com/typescript), [Python](https://portal.thirdweb.com/python), [Go](https://portal.thirdweb.com/go), and [Unity](https://portal.thirdweb.com/unity). ### Creating a New App Run the following command to start creating a new application: ```bash npx thirdweb create --app ``` Input your preferences for the command line prompts: 1. Give your project a name 2. Choose your network: We will choose EVM for Mantle Network 3. Choose your preferred framework: Next.js, CRA, Vite, React Native, Node.js, or Express 4. Choose your preferred language: JavaScript or TypeScript To create a new application pre-configured with thirdweb’s SDKs, run the following command and choose your preferred configurations: ```bash npx thirdweb create app --evm ``` ### Install Into an Existing Project You can install thirdweb into your existing project by running: ```bash npx thirdweb install ``` ### Initialize SDK on Mantle Network Wrap your application in the `ThirdwebProvider` component and change the `activeChain` to Mantle Network. ```javascript import { ThirdwebProvider } from "@thirdweb-dev/react"; import { Mantle } from "@thirdweb-dev/chains"; const App = () => { return ( <ThirdwebProvider activeChain={ Mantle }> <YourApp /> </ThirdwebProvider> ); }; ``` ### Get Contract To connect to your contract, use the SDK’s [`getContract`](https://portal.thirdweb.com/typescript/sdk.thirdwebsdk.getcontract) method. ```javascript import { useContract } from "@thirdweb-dev/react"; function App() { const { contract, isLoading, error } = useContract("{{contract_address}}"); } ``` ### Calling Contract Functions * For extension based functions, use the built-in supported hooks. The following is an example using the NFTs extension to access a list of NFTs owned by an address- `useOwnedNFTs` ```javascript import { useOwnedNFTs, useContract, useAddress } from "@thirdweb-dev/react"; // Your smart contract address const contractAddress = "{{contract_address}}"; function App() { const address = useAddress(); const { contract } = useContract(contractAddress); const { data, isLoading, error } = useOwnedNFTs(contract, address); } ``` {% hint style="info" %} Complete reference available here: <https://portal.thirdweb.com/react/react.usenft> {% endhint %} * Use the `useContractRead` hook to call any read functions on your contract by passing in the name of the function you want to use. ```javascript import { useContractRead, useContract } from "@thirdweb-dev/react"; // Your smart contract address const contractAddress = "{{contract_address}}"; function App() { const { contract } = useContract(contractAddress); const { data, isLoading, error } = useContractRead(contract, "getName"); } ``` {% hint style="info" %} Complete reference available here: <https://portal.thirdweb.com/react/react.usecontractread> {% endhint %} * Use the `useContractWrite` hook to call any write functions on your contract by passing in the name of the function you want to use. ```javascript import { useContractWrite, useContract, Web3Button } from "@thirdweb-dev/react"; // Your smart contract address const contractAddress = "{{contract_address}}"; function App() { const { contract } = useContract(contractAddress); const { mutateAsync, isLoading, error } = useContractWrite( contract, "setName", ); return ( <Web3Button contractAddress={contractAddress} // Calls the "setName" function on your smart contract with "My Name" as the first argument action={() => mutateAsync({ args: ["My Name"] })} > Send Transaction </Web3Button> ); } ``` {% hint style="info" %} Complete reference available here: <https://portal.thirdweb.com/react/react.usecontractwrite> {% endhint %} ### Connect Wallet Create a custom connect wallet experience by declaring supported wallets passed to your provider. ```javascript import { ThirdwebProvider, metamaskWallet, coinbaseWallet, walletConnectV1, walletConnect, safeWallet, paperWallet, } from "@thirdweb-dev/react"; function MyApp() { return ( <ThirdwebProvider supportedWallets={[ metamaskWallet(), coinbaseWallet(), walletConnect({ projectId: "YOUR_PROJECT_ID", // optional }), walletConnectV1(), safeWallet(), paperWallet({ clientId: "YOUR_CLIENT_ID", // required }), ]} activeChain={ Mantle } > <App /> </ThirdwebProvider> ); } ``` Add in a connect wallet button to prompt end-users to log in with any of the above supported wallets. ```javascript import { ConnectWallet } from "@thirdweb-dev/react"; function App() { return <ConnectWallet />; } ``` {% hint style="info" %} Complete reference available here: <https://portal.thirdweb.com/react/connecting-wallets> {% endhint %} ## Deploying Your App Use the following command to deploy your static web application on IPFS: ```bash npx thirdweb deploy --app ``` Upon running this command: * Your app is built for production and stored using thirdweb's [Storage](https://portal.thirdweb.com/storage) solution * The production build is uploaded to IPFS * A unique URL is generated for your application that serves as a permanent hosting location {% hint style="info" %} Learn more here: <https://blog.thirdweb.com/guides/how-to-host-your-web-app-on-ipfs/> {% endhint %} ## Support In case you have questions, or if you run into issues during deployment, feel free to reach out to us via [Discord](https://discord.com/invite/0xMantle) / [Telegram](https://t.me/mantledevs), or get in touch with the thirdweb support at [https://support.thirdweb.com](http://support.thirdweb.com/). # Multisig Wallet ## Safe{Wallet} The most trusted decentralized custody protocol and collective asset management platform. {% embed url="<https://multisig.mantle.xyz/>" %} # Graph Endpoints Graph service endpoint reference ### Mantle Subgraph Studio [Subgraph](https://docs.ormi.xyz/mantle-subgraphs/) is a customized, open-source solution for indexing and accessing real-time blockchain data through the GraphQL API. They provide developers with powerful tools to build, customize and access blockchain data according to their needs. {% embed url="<https://subgraph.mantle.xyz/>" %} # Covalent Data Indexing API [Covalent](https://www.covalenthq.com/?utm_source=mantle\&utm_medium=partner-docs) is a hosted blockchain data solution providing access to historical and current on-chain data for [100+ supported blockchains](https://www.covalenthq.com/docs/networks/?utm_source=mantle\&utm_medium=partner-docs), including [Mantle Network](https://www.covalenthq.com/docs/networks/mantle/?utm_source=mantle\&utm_medium=partner-docs). Covalent maintains a full archival copy of the chain data, meaning every balance, transaction, log event, and NFT asset data is available from the genesis block. This data is available via: 1. [**Unified API**](https://file+.vscode-resource.vscode-cdn.net/Users/hans/Downloads/mantle.md#unified-api) - Incorporate blockchain data into your app with a familiar REST API 2. [**Increment**](https://file+.vscode-resource.vscode-cdn.net/Users/hans/Downloads/mantle.md#increment) - Create and embed custom charts with no-code analytics ## Unified API <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FJAXhAQsN5PT3m83MgGw7%2F1689811599-example-api-response-json-mantle.png?alt=media&amp;token=7ccaa66d-48cf-4a25-bdca-aa6e3f61f1b6" alt=""><figcaption><p><a href="https://www.covalenthq.com/docs/api/balances/get-token-balances-for-address/"><em>Link to the above endpoint</em></a></p></figcaption></figure> The Covalent API is RESTful and offers the following features: <table><thead><tr><th width="402">Features</th><th></th></tr></thead><tbody><tr><td>Response Formats</td><td>JSON, CSV</td></tr><tr><td>Real-Time Data Latency</td><td>2 blocks</td></tr><tr><td>Batch Data Latency</td><td>30 minutes</td></tr><tr><td>Supported Networks (<code>chainName</code>, <code>chainId</code>)</td><td>Mainnet: <code>mantle-mainnet</code>, <code>5000</code><br>Testnet: <code>mantle-testnet</code>, <code>5001</code></td></tr><tr><td>API Tiers</td><td><a href="https://www.covalenthq.com/docs/unified-api/pricing/?utm_source=mantle&#x26;utm_medium=partner-docs#free-tier">Free tier</a><br><a href="https://www.covalenthq.com/docs/unified-api/pricing/?utm_source=mantle&#x26;utm_medium=partner-docs#premium-tier">Premium tier</a></td></tr><tr><td>API Categories</td><td><a href="https://www.covalenthq.com/docs/api/balances/get-token-balances-for-address/?utm_source=mantle&#x26;utm_medium=partner-docs">Balances</a><br><a href="https://www.covalenthq.com/docs/api/nft/get-nfts-for-address/?utm_source=mantle&#x26;utm_medium=partner-docs">NFTs</a><br><a href="https://www.covalenthq.com/docs/api/transactions/get-transactions-for-address/?utm_source=mantle&#x26;utm_medium=partner-docs">Transactions</a><br><a href="https://www.covalenthq.com/docs/api/security/get-token-approvals-for-address/?utm_source=mantle&#x26;utm_medium=partner-docs">Security</a><br><a href="https://www.covalenthq.com/docs/api/base/get-log-events-by-contract-address/?utm_source=mantle&#x26;utm_medium=partner-docs">Log Events &#x26; Others</a></td></tr></tbody></table> ### Get Started * [API Key](https://www.covalenthq.com/platform/?utm_source=mantle\&utm_medium=partner-docs) - sign up for free * [Quickstart](https://www.covalenthq.com/docs/unified-api/quickstart/?utm_source=mantle\&utm_medium=partner-docs) - summary of key resources to get you building immediately on blockchain * [API Reference](https://www.covalenthq.com/docs/api/?utm_source=mantle\&utm_medium=partner-docs) - try all the endpoints directly from your browser * [Guides](https://www.covalenthq.com/docs/unified-api/guides/?utm_source=mantle\&utm_medium=partner-docs) - learn how to build dApps, fetch data and extend your Web3 knowledge ## Increment <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2FKh3W0vVMONlxo70PzQsV%2F1684974544-increment-example-partner-docs.png?alt=media&amp;token=db0f8631-b2a8-4035-8738-0ec0902df27f" alt=""><figcaption><p><a href="https://www.covalenthq.com/platform/increment/#/?utm_source=mantle&#x26;utm_medium=partner-docs"><em>Link to the above dashboard</em></a></p></figcaption></figure> Increment is a novel no-code charting and reporting tool powered by Covalent, revolutionizing how the Web3 space approaches analytics. Many analytics tools let you write SQL to create charts, but *Increment is the only one to encode business logic - Reach, Retention, and Revenue - into an SQL compiler that can write valid SQL for you.* ### Use Cases Increment can be used for: * [Analyzing Blockchain Networks](https://www.covalenthq.com/docs/increment/data-models/chain-gdp/?utm_source=mantle\&utm_medium=partner-docs) * [Analyzing DEXs](https://www.covalenthq.com/docs/increment/data-models/swap-land/?utm_source=mantle\&utm_medium=partner-docs) * [Analyzing NFT Marketplaces](https://www.covalenthq.com/docs/increment/data-models/jpeg-analysis/?utm_source=mantle\&utm_medium=partner-docs) For example, the following table (use the link in the caption to navigate to the page) shows the latest number of active wallets, transactions and tokens by day, week, month or year for Mantle: <figure><img src="https://3701411312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNHXgeqhgrznnRobzznxl%2Fuploads%2F3BBSWCfFbGfcPUTxByQx%2F1686100924-example_network_status_increment_general%20copy%20edited.png?alt=media&amp;token=7283ecfb-9773-4e58-9659-1e1b6b8e9403" alt=""><figcaption><p><a href="https://www.covalenthq.com/docs/networks/mantle/?utm_source=mantle&#x26;utm_medium=partner-docs#network-status"><em>Network Status Table Link</em></a></p></figcaption></figure> ### Get Started * [Increment](https://www.covalenthq.com/platform/increment/#/?utm_source=mantle\&utm_medium=partner-docs) - login via the Covalent Platform * [Docs](https://www.covalenthq.com/docs/increment/?utm_source=mantle\&utm_medium=partner-docs) - learn how to use Increment to build dynamic, custom charts * [Data Models Demo](https://www.covalenthq.com/docs/increment/data-models/model-intro/?utm_source=mantle\&utm_medium=partner-docs) - build analytics in 3 clicks * [Explore Models](https://www.covalenthq.com/platform/increment/#/pages/covalent/chain-gdp/?utm_source=mantle\&utm_medium=partner-docs) - browse all data models * [Use Models](https://www.covalenthq.com/platform/increment/#/sql/query_b6c88fd8604f49d5920ca86fa7/?utm_source=mantle\&utm_medium=partner-docs) - use a data model # Chain Data and Monitoring ## Block Explorers Block explorers provide access to real-time and historical transaction data via a UI and API. Here's a list of all the Mantle block explorers. * [**Blockscout**](https://explorer.mantle.xyz/) ## Covalent Covalent collects and indexes historical data points from over a 100 different chain networks and makes them available via one unified API. This can come in handy for developers working on multi-chain dApps. You can use Covalent if you need: * Structured and enhanced on-chain data well beyond what you get fro
프로젝트로 돌아가기