Beam 백서

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

ctivePrecompilesAt : eth_getActivePrecompilesAt returns activated precompiles at a specific timestamp. If no timestamp is provided it returns the latest block timestamp. This API is enabled by default with internal-blockchain namespace. ( Details ) JSON-RPC Endpoint To interact with the Beam EVM via the JSON-RPC endpoint: /ext/bc/ blockchainID /rpc Where blockchainID is the ID of the blockchain running the EVM. Find the correct blockchain ID here for Mainnet or Testnet . Example Call curl -X POST --data '{ "jsonrpc": "2.0", "method": "eth_feeConfig", "params": [ "latest" ], "id": 1 }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/ 2tmrrBo1Lgt1mzzvPSFt73kkQKFas5d1AP88tv9cicwoFp8BSn /rpc This calls the function eth_feeConfig for the Beam Mainnet (Blockchain ID 2tmrrBo1Lgt1mzzvPSFt73kkQKFas5d1AP88tv9cicwoFp8BSn ). APIs Overview Beam’s API overview. Find a variety of APIs each designed for a different purpose. Title Description Beam API Beam specific API AvalancheGo AvalancheGo APIs, Postman collection, public servers, and release notes AvalancheJS AvalancheJS APIs Avalanche Metrics API Avalanche Metrics API Glacier API High-performance API for easy access to indexed blockchain data Accounts Network Overview ## /chain/builder/network-overview Chain Build on Beam Network Overview Beam Network Overview Here, you can find a comprehensive overview of the Beam Network. Beam Mainnet Subnet ID : eYwmVU67LmSfZb1RwqCMhBYkFyG8ftxn6jAwqzFmxC9STBWLC VM ID : kLPs8zGsTVZ28DhP1VefPCFbCgS7o5bDNez8JUxPVw9E6Ubbz Blockchain ID : 2tmrrBo1Lgt1mzzvPSFt73kkQKFas5d1AP88tv9cicwoFp8BSn MetaMask / RPC Settings Beam Mainnet Explorer Subnet Overview Github - Addresses of ERC-20 Tokens, Subnet Contracts, Thirdweb Contracts Beam Testnet (Fuji) Subnet ID : ie1wUBR2bQDPkGCRf2CBVzmP55eSiyJsFYqeGXnTYt2r33aKW VM ID : kLPs8zGsTVZ28DhP1VefPCFbCgS7o5bDNez8JUxPVw9E6Ubbz Blockchain ID : y97omoP2cSyEVfdSztQHXD9EnfnVP9YKjZwAxhUfGbLAPYT9t MetaMask / RPC Settings Beam Testnet Explorer Subnet Overview Github - Addresses of ERC-20 Tokens, Subnet Contracts, Thirdweb Contracts APIs Verifying Contracts ## /chain/builder/verifying-contracts Chain Build on Beam Verifying Contracts Verifying Contracts On subnets.avax.network To verify a contract using the official subnets.avax.network explorer, utilize the Verifying Contracts Tool available on avax.network. Follow these steps for verification: Choose Beam for the subnet. Input the contract address of the desired contract for verification. Select and upload all your contract files . Once every file is uploaded, initiate the verification by clicking Submit Verification . For verifying a contract on the Beam testnet, refer to the Verifying Contracts Tool (Testnet) . From the command line The Beam explorer uses Sourcify for contract verification. There are plugins and integrations for different smart contract development environments available. For more information, see the Sourcify documentation on contract verification. Hardhat If you’re using hardhat-deploy to deploy your contracts, verification with Sourcify is supported natively. Simply run this command from your project directory to verify all deployed contracts: # use hardhat --network beam sourcify --endpoint https://sourcify.avax.network For any other Hardhat project, you could use the plugin hardhat-sourcify and verify them one by one: hardhat --network beam verify-sourcify --contract "MyFirstContract" --address 0x12345... hardhat --network beam verify-sourcify --contract "MySecondContract" --address 0x23456... For all available options, check out the plugin’s documentation or run hardhat help verify-sourcify . Foundry Foundry supports Sourcify out of the box. To verify a contract immediately after deploying it, add the --verify --verification-provider sourcify flags to your Foundry deploy command. To verify an existing, already deployed contract, run: forge verify-contract 0x12345... MyFirstContract --chain-id 4337 --verifier sourcify Truffle When deploying contracts with Truffle, you can install truffle-plugin-verify and use it like this: truffle run verify MyFirstContract MySecondContract --network beam Network Overview Contract Addresses ## /chain/builder/contract-addresses Chain Build on Beam Contract Addresses Contract Addresses Beam Mainnet (ChainID: 4337) Beam ERC-20 Tokens Symbol Address Decimals Logo Description BEAM 18 Beam native token WBEAM 0xD51BFa777609213A653a2CD067c9A0132a2D316A 18 Wrapped BEAM LZBEAM 0xF5759Ef6D0E0003cFdF80aD3c9a628fc8736c821 18 LayerZero BEAM (Bridge) USDC 0x76BF5E7d2Bcb06b1444C0a2742780051D8D0E304 6 USD Coin USDT 0x999f90f25a2922ae1b21A06066F7EDEbedad42a9 6 Tether USD AVAX 0x00E69e0b6014d77040b28E04F2b8ac25A6EA5d34 18 Avalanche BEAM Token on Ethereum (bridged via LayerZero) Contract Address Ethereum ERC20 0x62D0A8458eD7719FDAF978fe5929C6D342B0bFcE LayerZero Proxy OFT 0x7Bb83CCB91aAEE77F8E9bDCdd311E83AfF6fF1F9 BEAM Token on Avalanche C-Chain (bridged via LayerZero) Contract Address Beam Avalanche C-Chain ERC20 0x62D0A8458eD7719FDAF978fe5929C6D342B0bFcE Beam Uniswap V2 Pairs Pair Address USDC/WBEAM 0xe510c67dd0A54D06f04fd5af9094fe64Ed605EaB USDT/WBEAM 0x7063F3446223Bc4f5c37B0F9d1e12547F0358e90 AVAX/WBEAM 0xA53DaFAe314075C6a22f44eEb7Df792D672f89d5 RST/WBEAM 0x17E545Be64350E9166B0B33a7580357C802cdBe6 Beam Contracts Contract Address Multicall 3 0x4956f15efdc3dc16645e90cc356eafa65ffc65ec Uniswap v2 factory 0x662b526FB70EBB508962f3f61c9F735f687C8fA5 Uniswap v2 router 0x965B104e250648d01d4B3b72BaC751Cde809D29E Create2Factory 0x4c8d290a1b368ac4728d83a9e8321fc3af2b39b1 Create2Factory 0x3fab184622dc19b6109349b94811493bf2a45362 Entry Point 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 Paymaster 0x37eC246fCD668400Df5dAA5362601dB613BAcC84 Bundler 0x0f642306884aef6611c05434AEf608b253d29b01 Beam Seaport Contracts Contract Address KEYLESS_CREATE2_DEPLOYER_ADDRESS 0x4c8D290a1B368ac4728d83a9e8321fC3af2b39b1 KEYLESS_CREATE2_ADDRESS 0x7A0D94F55792C434d74a40883C6ed8545E406D12 INEFFICIENT_IMMUTABLE_CREATE2_FACTORY_ADDRESS 0xcfA3A7637547094fF06246817a35B8333C315196 IMMUTABLE_CREATE2_FACTORY_ADDRESS 0x0000000000ffe8b47b3e2130213b802212439497 ConduitController 0x00000000F9490004C11Cef243f5400493c00Ad63 Seaport 1.4 0x00000000000001ad428e4906aE43D8F9852d0dD6 Seaport 1.5 0x00000000000000ADc04C56Bf30aC9d3c0aAF14dC Reservoir SeaportV15Module 0x7c5ff94e87a2a2a343d0ef40c820384fbc60d0d1 Beam Safe Contracts Safe v1.3.0 Contracts Address Safe Singleton Factory 0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7 Compatibility Fallback Handler 0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4 Create Call 0x7cbB62EaA69F79e6873cD1ecB2392971036cFAa4 Gnosis Safe 0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552 Gnosis Safe L2 0x3E5c63644E683549055b9Be8653de26E0B4CD36E Multi Send 0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761 Multi Send Call Only 0x40A2aCCbd92BCA938b02010E17A5b8929b49130D Proxy Factory 0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2 Sign Message Lib 0xA65387F16B013cf2Af4605Ad8aA5ec25a2cbA3a2 Simulate Tx Accessor 0x59AD6735bCd8152B84860Cb256dD9e96b85F69Da Safe v1.4.1 Contracts Address Safe Singleton Factory 0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7 Compatibility Fallback Handler 0xfd0732Dc9E303f09fCEf3a7388Ad10A83459Ec99 Create Call 0x9b35Af71d77eaf8d7e40252370304687390A1A52 Multi Send 0x38869bf66a61cF6bDB996A6aE40D5853Fd43B526 Multi Send Call Only 0x9641d764fc13c8B624c04430C7356C1C7C8102e2 Safe 0x41675C099F32341bf84BFc5382aF534df5C7461a Safe L2 0x29fcB43b46531BcA003ddC8FCB67FFE91900C762 Safe Proxy Factory 0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67 Sign Message Lib 0xd53cd0aB83D845Ac265BE939c57F53AD838012c9 Simulate Tx Accessor 0x3d4BA2E0884aa488718476ca2FB8Efc291A46199 Beam Thirdweb Contracts Contract Address tbd tbd Beam Testnet (ChainID: 13337) Fuji Subnet ERC-20 Tokens Symbol Address Decimals Logo Description BEAM 18 Beam mock native token WBEAM 0xF65B6f9c94187276C7d91F4F74134751d248bFeA 18 Mock Wrapped BEAM LZBEAM 0x3438271Fd753b8b217447Bf7B18249347B282CCD 18 LayerZero BEAM (Bridge) USDC 0x007Fdc86FD12924C9116025C7F594843087397E3 6 USD Coin USDT 0x29633Cf4FF2D98347895C7327f83Ab4cd592C808 6 Tether USD AVAX 0x2CC787Ed364600B0222361C4188308Fa8E68bA60 18 Avalanche BEAM Token on Fuji (bridged via LayerZero) Contract Address Fuji Mock ERC20 0x955723e26bd1b2165391BCaf39A92f77b30FFe01 LayerZero Proxy OFT 0xa4125191E017CdF143255371A9E056f83A839b42 Fuji Uniswap V2 Pairs Pair Address USDC/WBEAM 0xA9EA3e595E5b8D0fF3aa4fA3A488ee44d39E357a USDT/WBEAM 0xF5C0a13a53D7216fced72Be56253b083240b27db AVAX/WBEAM 0xF1D464566a5561a058ea271FB25f3Db715E9da9d Fuji Subnet Contracts Contract Address Multicall 1 0x4661e0d785b2eE35B9a101B684303F1a0daf4cc5 Multicall 2 0x680638eB73F5d8a1207f38CC3eF7BAE9281d3F32 Multicall 3 0x9BF49b704EE2A095b95c1f2D4EB9010510c41C9E Uniswap v2 factory 0xfABa62a3B12f7c29F21881F5ed4c56cb6d45E4fb Uniswap v2 router 0xB4cFBc4836c5a0Eb27A502B6008f9baF3Bf8b3Ee Create2Factory 0x7A0D94F55792C434d74a40883C6ed8545E406D12 Create2Factory 0x4e59b44847b379578588920cA78FbF26c0B4956C Entry Point 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 Fuji Subnet Seaport Contracts Contract Address KEYLESS_CREATE2_DEPLOYER_ADDRESS 0x4c8D290a1B368ac4728d83a9e8321fC3af2b39b1 KEYLESS_CREATE2_ADDRESS 0x7A0D94F55792C434d74a40883C6ed8545E406D12 INEFFICIENT_IMMUTABLE_CREATE2_FACTORY_ADDRESS 0xcfA3A7637547094fF06246817a35B8333C315196 IMMUTABLE_CREATE2_FACTORY_ADDRESS 0x0000000000ffe8b47b3e2130213b802212439497 ConduitController 0x00000000F9490004C11Cef243f5400493c00Ad63 Seaport 1.4 0x00000000000001ad428e4906aE43D8F9852d0dD6 Seaport 1.5 0x00000000000000ADc04C56Bf30aC9d3c0aAF14dC Fuji Safe Contracts Safe v1.3.0 Contracts Address Safe Singleton Factory 0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7 Compatibility Fallback Handler 0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4 Create Call 0x7cbB62EaA69F79e6873cD1ecB2392971036cFAa4 Gnosis Safe 0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552 Gnosis Safe L2 0x3E5c63644E683549055b9Be8653de26E0B4CD36E Multi Send 0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761 Multi Send Call Only 0x40A2aCCbd92BCA938b02010E17A5b8929b49130D Proxy Factory 0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2 Sign Message Lib 0xA65387F16B013cf2Af4605Ad8aA5ec25a2cbA3a2 Simulate Tx Accessor 0x59AD6735bCd8152B84860Cb256dD9e96b85F69Da Safe v1.4.1 Contracts Address Safe Singleton Factory 0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7 Compatibility Fallback Handler 0xfd0732Dc9E303f09fCEf3a7388Ad10A83459Ec99 Create Call 0x9b35Af71d77eaf8d7e40252370304687390A1A52 Multi Send 0x38869bf66a61cF6bDB996A6aE40D5853Fd43B526 Multi Send Call Only 0x9641d764fc13c8B624c04430C7356C1C7C8102e2 Safe 0x41675C099F32341bf84BFc5382aF534df5C7461a Safe L2 0x29fcB43b46531BcA003ddC8FCB67FFE91900C762 Safe Proxy Factory 0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67 Sign Message Lib 0xd53cd0aB83D845Ac265BE939c57F53AD838012c9 Simulate Tx Accessor 0x3d4BA2E0884aa488718476ca2FB8Efc291A46199 Fuji Subnet Thirdweb Contracts Contract Address Description Trusted Forwarder 0xe518da278288337FdE7B9b8cCb1217c40B759580 GSN TWRegistry 0x238fC67A71DE52832Ed38cdef6aaD8Cea57cd4b6 Register implementations TWFactory 0xa9eA7C2af311b361f86d435BFC0e8FE2EB310b56 Deploy proxies Multiwrap Implementation 0x5F46D40231c0FfAFf3DB63265C2ea3e6Ec4f19B8 Wrap logic Pack Implementation 0x42A186E3f1012350FB7C829374CC2FAc384189e7 Lootbox logic Multiwrap Proxy 0xa8dDAb412cE207b65440A12aF8B4d7C0dB2eeE5e Wrap ERC20, ERC721 and ERC1155 Pack Proxy 0xE5ccfEFA45601D08B1708500416fa93628A111C3 Lootbox ERC20, ERC721 and ERC1155 Verifying Contracts Omnichain Tokens ## /chain/builder/omnichain-tokens Chain Build on Beam Omnichain Tokens Beam Omnichain Tokens LayerZero is an omnichain interoperability protocol that connects Beam to other networks. It enables everyone to build Omnichain tokens and NFTs on Beam that can be transferred cross-chain, and bridge existing assets from other networks. OnBeam’s LayerZero contracts repository is forked from LayerZero Labs’ example contracts and additionally includes all the necessary setup to get started with Beam, as well as more improvements like upgradeable smart contracts, contract verification and better configuration options under the hood. Contract types LayerZero offers ready-made Omnichain contracts for ERC20-, ERC721- and ERC1155-based assets. There are three different main types of contracts serving as starting points for your contracts: Proxies to wrap existing tokens Regular tokens when deploying a new asset ERC20 only: Native for gas tokens The following extensions are available: Upgradeable contracts ERC20 only: Additional fee for bridging Depending on your use case, you’ll need to combine these differently. You can find common use cases in the examples section. The tables below are meant to help you to find the right contract type to base your Omnichain token on. This repository contains contracts created by LayerZero which have been audited , and contracts built on top of those by The Beam Foundation. The latter haven’t been formally audited yet, and are marked with * below. Omnichain ERC20 tokens Omnichain ERC20 Token Proxy Native Regular OFTV2 ProxyOFTV2 NativeOFTV2 Upgradeable OFTV2Upgradeable * ProxyOFTV2Upgradeable * NativeOFTV2Upgradeable * With Fee OFTWithFee ProxyOFTWithFee NativeOFTWithFee Upgradeable + Fee OFTWithFeeUpgradeable * ProxyOFTWithFeeUpgradeable * NativeOFTWithFeeUpgradeable * Omnichain ERC721 NFTs Omnichain ERC721 Token Proxy Regular ONFT721 ProxyONFT721 Upgradeable ONFT721Upgradeable ProxyONFT721Upgradeable * Others: ExtendedONFT721 & ExtendedONFT721Upgradeable * (Enumerable ONFT721 with on-chain royalties, updatable metadata uri and batch transfers) MinterONFT721 & MinterONFT721Upgradeable * ( ExtendedONFT721 with minting capabilities) ONFT721A Omnichain ERC1155 NFTs Omnichain ERC1155 Token Proxy Regular ONFT1155 ProxyONFT1155 Upgradeable ONFT1155Upgradeable ProxyONFT1155Upgradeable * Examples In the following section, we use OnBeam’s LayerZero contracts repository to walk you through different use cases. The examples are tailored towards Beam, but the instructions can be adapted for any network supported by LayerZero . To use the repository, you’ll have to have NodeJS 16+ installed. Run yarn to install dependencies, then create a .env file based on the provided .env.example , and add your mnemonic phrase. Bridge an existing ERC20 token from Ethereum to Beam First, we have to choose which contracts should serve as a base for our use case. In our example, we’ll bridge USDC from Ethereum to Beam using upgradeable contracts, so we’ll need the Proxy contract on the Ethereum side: ProxyOFTV2Upgradeable an Omnichain ERC20 contract on the Beam side: OFTV2Upgradeable Create a new contract file, and drop it into contracts/contracts-upgradeable/examples/MyUSDCBridge.sol . This is necessary to not cause any clashes with already deployed contracts with the same name. // SPDX-License-Identifier: MIT pragma solidity ^0.8.18 ; import "../token/oft/v2/OFTV2Upgradeable.sol" ; import "../token/oft/v2/ProxyOFTV2Upgradeable.sol" ; contract MyUsdcProxyOFT is ProxyOFTWithFeeUpgradeable {} contract MyUsdcOFT is OFTWithFeeUpgradeable { // custom extensions go here, USDC has 6 decimals function decimals () public view virtual override returns ( uint8 ) { return 6 ; } } Then we update constants/tokenConfig.js and add some config. ERC20 Proxy contracts require the address of the token they’re proxying as input, all other types need a name and symbol for the token. { ... beam : { MyUsdcOFT : { name : "USD Coin" , symbol : "USDC" , } }, ... ethereum : { MyUsdcProxyOFT : { // USDC address on Ethereum: address : "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" , } } } Next we’ll find the deploy scripts for our base contracts in the deploy folder ( ProxyOFTV2Upgradeable.js and OFTV2Upgradeable.js ). Duplicate and rename the files, and update the CONTRACT_NAME constant on the top to match your contracts’ names ( MyUsdcProxyOFT and MyUsdcOFT ): const CONTRACT_NAME = "MyUsdcProxyOFT" ; That being done, we can start deploying our contracts like this: # deploy upgradeable OFT to Beam npx hardhat --network beam deploy --tags MyUsdcOFT # deploy upgradeable ProxyOFT to Ethereum npx hardhat --network ethereum deploy --tags MyUsdcProxyOFT The following command executes all necessary default setup for the contracts we’ve just deployed by running multiple on-chain transactions. # Beam npx hardhat --network beam setupOFT --target-network ethereum --local-contract MyUsdcOFT --remote-contract MyUsdcProxyOFT # Ethereum npx hardhat --network ethereum setupOFT --target-network beam --local-contract MyUsdcProxyOFT --remote-contract MyUsdcOFT All done, let’s test our bridge by transferring 20 USDC from Ethereum to Beam: # grant token allowance to proxy contract npx hardhat --network ethereum approveERC20 --contract MyUsdcProxyOFT # bridge 20 USDC from Ethereum to Beam npx hardhat --network ethereum sendOFT --target-network beam --qty 20 --local-contract MyUsdcProxyOFT --remote-contract MyUsdcOFT Bridge an existing ERC721 NFT from Avalanche Fuji to Beam Testnet In this section we’ll demonstrate how to bridge an ERC721 NFT. To mix things up, we’ll use non-upgradeable contracts here. We’ll start again by selecting our base contracts : ProxyONFT721 for Fuji ExtendedONFT721 for Beam ( ONFT721 with batch-transfers and on-chain royalties) We’ll create a contract file in contracts/examples/MyNFT.sol with the following contents: // SPDX-License-Identifier: MIT pragma solidity ^0.8.18 ; import "../token/onft721/ProxyONFT721.sol" ; import "../token/onft721/extensions/ExtendedONFT721.sol" ; contract MyONFTProxy is ProxyONFT721 {} contract MyONFT is ExtendedONFT721 { // custom extensions go here } …and a configuration in constants/tokenConfig.js like this: { ... 'beam-testnet' : { MyONFT: { name: "Snakes on a chain" , symbol: "SNAKE" , baseUri: "https://snake-on-a-chain-euppi.ondigitalocean.app/token/" , royaltyBasePoints: 500 , // 100 = 1%, defaults to 0 minGas: 100000 , // defaults to 100000 }, }, ... fuji : { MyONFTProxy : { // Snakes on a chain NFT contract address on Fuji: address : "0x588348d84498d0689B76F89438bE58999a5434EE" , minGas : 100000 , // defaults to 100000 } } } Next we’ll duplicate the relevant deploy scripts and update CONTRACT_NAME in the scripts to match ours ( MyONFTProxy , MyONFT ): cp deploy/ProxyONFT721.js deploy/MyONFTProxy.js cp deploy/ExtendedONFT721.js deploy/MyONFT.js sed -i 's/ProxyONFT721/MyONFTProxy/' deploy/MyONFTProxy.js sed -i 's/ExtendedONFT721/MyONFT/' deploy/MyONFT.js Then we deploy and set up the contracts: # deploy npx hardhat --network beam-testnet deploy --tags MyONFT npx hardhat --network fuji deploy --tags MyONFTProxy # setup npx hardhat --network beam-testnet setupONFT721 --target-network fuji --local-contract MyONFT --remote-contract MyONFTProxy npx hardhat --network fuji setupONFT721 --target-network beam-testnet --local-contract MyONFTProxy --remote-contract MyONFT # grant NFT allowance to proxy contract npx hardhat --network fuji approveNFT --contract MyONFTProxy # send NFT #1 from Fuji to Beam Testnet npx hardhat --network fuji sendONFT721 --target-network beam-testnet --token-id 1 --contract MyONFTProxy Verify contracts The repository uses hardhat-deploy , which makes it easy to verify deployed contracts on Etherscan & Co. and Sourcify: # verify on Sourcify.dev (incl. Beam Explorer) npx hardhat --network beam sourcify npx hardhat --network ethereum sourcify # v
프로젝트로 돌아가기