Filecoin 백서

Filecoin

원문

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

tened source file for upload: ![](https://3376433986-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxNWFG7bQkjLkl5BBGjbD%2Fuploads%2Fgit-blob-310fe5672b9385691c64ca594996b13a0e38fa26%2Fsmart-contracts-developing-contracts-verify-a-contract-remix.jpg?alt=media) 2. **Flatten your contract:** * In the **File Explorer** sidebar, under **contracts**, right-click on your contract * Select **Flatten** from the menu * This creates a `<contract-name>_flattened.sol` file with all dependencies included 3. **Verify contract details:** * Ensure the license and Solidity version match your original contract * Click **Save** to save the flattened contract 4. **Download the flattened contract:** * Right-click on `<contract-name>_flattened.sol` * Select **Download** to save the file locally 5. **Gather required information:** * Contract deployment address * Contract license type (if any) * Solidity compiler version used for deployment * Optimization settings, optimizer runs, EVM version, and `viaIR` setting * Constructor arguments, if your contract constructor used arguments ### Step 2: Submit for Verification 6. **Access Filfox verification page:** * For Filecoin mainnet, navigate to the [Filfox Contract Verification](https://filfox.info/en/contract) page. Mainnet uses chain ID `314`. * For Calibration testnet, navigate to the [Calibration Filfox Contract Verification](https://calibration.filfox.info/en/contract) page. Calibration uses chain ID `314159`. 7. **Fill in contract information:** * Enter your contract's deployment address * Select the appropriate license type * Choose the compiler version used for deployment * Match any prompted compiler and constructor settings to the original deployment ![](https://3376433986-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxNWFG7bQkjLkl5BBGjbD%2Fuploads%2Fgit-blob-27edc9d5bb8f04ff63f4f9847d9b516869ea999e%2Fsmart-contracts-developing-contracts-verify-a-contract-filfox.jpg?alt=media\&token=dce7ed83-ce47-46e7-9b97-21af1c0a4362) 8. **Upload source code:** * Click **Continue** to proceed * Click **Select .sol files** * Choose your flattened `.sol` file * Click **Verify and Publish** to submit ### Step 3: Verification Complete Once submitted, Filfox will process your verification request. Upon successful verification, you'll see a success message confirming your contract is now verified. ![](https://3376433986-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxNWFG7bQkjLkl5BBGjbD%2Fuploads%2Fgit-blob-a685fdd73bcdadac73384df58ecfd2c66a9d49df%2Fsmart-contracts-developing-contracts-verify-a-contract-success.jpg?alt=media\&token=ba4eff1a-445a-4233-95d2-31278115ab11) ## Viewing Your Verified Contract 1. **Navigate to your contract:** * Enter your contract address in the [Filfox search bar](https://filfox.info/) * This will take you to your contract's page ![](https://3376433986-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxNWFG7bQkjLkl5BBGjbD%2Fuploads%2Fgit-blob-0ad1d1989930fdd622b22eac13d0aa83423d9ad2%2Fsmart-contracts-developing-contracts-verify-a-contract-contract-tab.jpg?alt=media\&token=5e4b71c6-6bd1-4341-b742-035cc0c99396) 2. **View verification status:** * Scroll down and select the **Contract** tab * Look for the **Contract Source Code Verified** banner * Your contract's source code and ABI will now be publicly visible 3. **Explore verified contracts:** * Browse [other verified contracts on Filfox](https://filfox.info/en/fevm/verified-contracts) * Learn from verified contract examples in the ecosystem ![](https://3376433986-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxNWFG7bQkjLkl5BBGjbD%2Fuploads%2Fgit-blob-240756ee226bef15eb3223ab7c7f33d183e81bdc%2Fsmart-contracts-developing-contracts-verify-a-contract-verified-contract-list.jpg?alt=media\&token=82a6b119-3d91-4a66-b378-e419cf98417b) # Advanced Advanced tools and integrations for smart contract developers building on Filecoin. This section covers advanced integrations and services available to smart contract developers on Filecoin, including bridges, oracles, databases, and automation tools. For programmable storage, retrieval, and payments, start with [Filecoin Onchain Cloud](/build-on-filecoin/filecoin-onchain-cloud). ## Table of contents * [Wrapped FIL](/build-on-filecoin/advanced/wrapped-fil) — ERC-20 token that bridges native FIL to other blockchains * [Oracles](/build-on-filecoin/advanced/oracles) — connect smart contracts to external data sources * [Multicall](/build-on-filecoin/advanced/multicall) — batch multiple contract calls into a single transaction * [Multisig](/build-on-filecoin/advanced/multisig) — wallets that require multiple signatures for transactions * [FEVM indexers](/build-on-filecoin/advanced/fevm-indexers) — query Filecoin chain data without running an archival node * [Cross-chain bridges](/build-on-filecoin/advanced/cross-chain-bridges) — transfer assets between Filecoin and other networks * [Contract automation](/build-on-filecoin/advanced/contract-automation) — trigger smart contract actions based on off-chain events * [Relay](/build-on-filecoin/advanced/relay) — meta-transactions that let users interact without paying gas * [Decentralized databases](/build-on-filecoin/advanced/decentralized-databases) — store application data using Tableland on Filecoin * [Privacy and access control](/build-on-filecoin/advanced/privacy-and-access-control) — tools for managing data access and privacy * [Interplanetary consensus](/getting-started/interplanetary-consensus) — scalable consensus for cross-chain communication [Was this page helpful?](https://airtable.com/apppq4inOe4gmSSlk/pagoZHC2i1iqgphgl/form?prefill_Page+URL=https://docs.filecoin.io/build/advanced) # Wrapped FIL Wrapped FIL (wFIL) is the canonical wrapper token of the native Filecoin (FIL) token. Wrapped FIL features a 1-to-1 ratio pegged to FIL. Wrapped FIL (wFIL) is a wrapper token based on the ERC-20 token standard for the native Filecoin token (FIL). It allows FIL to be bridged and used in Ethereum-compatible decentralized applications (dapps) hosted on other blockchains, such as decentralized exchanges (DEXs), lending platforms, and other places where FIL is not natively supported. Wrapped FIL operates like any other ERC20-wrapped native blockchain token: a user deposits FIL into the wFIL contract and gets back an equal number of wFIL tokens. When users want to convert their wFIL back to FIL, they can burn the wFIL and unlock the same amount of FIL that was initially locked in the wFIL contract. Overall, wFIL provides additional liquidity and interoperability for FIL tokens, making the Filecoin network more accessible for a broader range of decentralized finance (defi) use cases across multiple blockchains. {% hint style="danger" %} When wrapping and unwrapping FIL ensure you are using the correct wFIL contract address on Filecoin. {% endhint %} ### Wrapped FIL contract addresses Only use the following addresses when wrapping and unwrapping FIL: * Mainnet: `0x60E1773636CF5E4A227d9AC24F20fEca034ee25A` * Calibration testnet: `0xaC26a4Ab9cF2A8c5DBaB6fb4351ec0F4b07356c4` ### Wrapping and unwrapping process There are a couple of options for users to wrap and unwrap FIL using a web browser: * [Glif](https://www.glif.io/en) * [Squid](https://app.squidrouter.com/?chains=314%2C314\&tokens=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee%2C0x60e1773636cf5e4a227d9ac24f20feca034ee25a) To wrap FIL into wFIL, follow these steps: 1. **Obtain FIL**: Ensure you have FIL in your MetaMask wallet before wrapping it. 2. **Connect your wallet**: You will need to connect your wallet to a platform that supports wFIL wrapping, such as [Glif](https://www.glif.io/en) or [Squid](https://app.squidrouter.com/?chains=314%2C314\&tokens=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee%2C0x60e1773636cf5e4a227d9ac24f20feca034ee25a). 3. **Wrap your FIL**: After you’ve connected your wallet, you can wrap your FIL by following the platform’s instructions. Generally, you’ll need to select the amount of FIL you want to wrap and confirm the transaction on MetaMask. The platform will then mint an equivalent amount of wFIL and deposit it into your wallet. 4. **Use wFIL**: Once you have wFIL in your wallet, you can use it on various Defi products that support token swapping or bridging wFIL to other blockchains. To unwrap FIL and receive FIL back to your wallet, users can directly go to supported platforms such as [Glif](https://www.glif.io/en) or [Squid](https://app.squidrouter.com/?chains=314%2C314\&tokens=0x60e1773636cf5e4a227d9ac24f20feca034ee25a%2C0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) to unwrap FIL following the platform’s instructions. Once the network confirms the unwrap transaction, FIL tokens are transferred back to your wallet address. ### Programmatic interaction Developers integrating wFIL into applications or protocols can wrap and unwrap FIL programmatically. The wFIL smart contract is deployed on the Filecoin Mainnet and Calibration testnet. #### Wrap FIL To add wrapping features to a project, developers must interact with the wFIL smart contract that manages the wFIL minting and burning process. The source code of the wFIL smart contract is in the [wFIL GitHub repo](https://github.com/glifio/wfil). Do not directly send FIL to the wFIL contract address. Also, ensure you do not send FIL using the `METHOD_SEND` method. Always use the `InvokeEVM` method. There are two options to wrap FIL: 1. Call the `deposit()` method in the wFIL contract and attach the amount of FIL tokens users want to wrap. This process will mint wFIL 1:1 and transfer to the `msg.sender` address. ```solidity function deposit() public payable virtual { _mint(msg.sender, msg.value); emit Deposit(msg.sender, msg.value); } ``` 2. Since the wFIL implements the receive function, you can send FIL to the wFIL contract using the `InvokeEVM` method to wrap FIL. This method will trigger the `deposit` function, minting the caller with wFIL 1:1. ```solidity receive() external payable virtual { deposit(); } ``` #### Unwrap FIL To unwrap wFIL into FIL, developers need to call the `withdraw` method in the wFIL contract and specify how many wFIL you would like to unwrap. The `withdraw` method looks like this: ```solidity function withdraw(uint _amount) public virtual { _burn(msg.sender, _amount); emit Withdrawal(msg.sender, _amount); payable(msg.sender).sendValue(_amount); } ``` This process will burn the amount of wFIL from the caller’s balance and transfer the unwrapped FIL 1:1 back to the caller’s address. [Was this page helpful?](https://airtable.com/apppq4inOe4gmSSlk/pagoZHC2i1iqgphgl/form?prefill_Page+URL=https://docs.filecoin.io/build/advanced/wrapped-fil) # Oracles Oracles act as a bridge between the Filecoin network and external data sources. Secure oracles allow smart contracts on the FVM to access and use external data sources. In the Filecoin network, on-chain data and the state of smart contracts are isolated from external data sources. They cannot access real-world information without breaking the deterministic attributes of the network. Since smart contracts cannot access information outside the Filecoin network, oracles are used as trusted entities to provide external data to the network. Oracles are an essential component of many blockchain applications, as they enable the blockchain to interact with the real world and provide more functionality to blockchain-based systems. Oracles can retrieve data from external sources, verify the data, and submit it to the blockchain for use by smart contracts and decentralized applications (dapps). Oracles enable builders to integrate the following features into their projects: * **Price feeds**: DeFi protocols like cross-chain lending rely on oracles for various token or token pair prices. * **Cross-chain storage deal verification**: enable applications running on any blockchains to use the Filecoin decentralized storage and allow them to verify deal status and proofs. * **Perpetual storage**: enable automated deal renewal and repair with the oracle providing deal status off-chain. ## Available oracles There are several oracle-protocols built upon the FVM. Builders can integrate these oracles into their applications today. ### [Pyth](https://pyth.network/) Pyth data is sourced directly from financial institutions across both traditional finance and the cryptocurrency industry. Pyth publishes both the price feed and a confidence interval for each product. Learn more about [Pyth confidence intervals](https://docs.pyth.network/price-feeds/best-practices#confidence-intervals). **Pyth smart contracts** Pyth’s smart contracts are live on the Filecoin Mainnet and Calibration testnet. | Name | Address | Mainnet | Calibration | | ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------- | ------- | ----------- | | [Pyth - Mainnet](https://filecoin.blockscout.com/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729?tab=contract) | `0xA2aa501b19aff244D90cc15a4Cf739D2725B5729` | ✔️ | | | [Pyth - Calibration](https://calibration.filfox.info/en/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | `0xA2aa501b19aff244D90cc15a4Cf739D2725B5729` | | ✔️ | **Pyth x Filecoin Price Feed IDs** Price Feed IDs for FIL are also available on various chains. These can be found at [Pyth - Price Feed IDs](https://pyth.network/developers/price-feed-ids) and search for 'FIL'. #### **Further Pyth resources** * [Pyth docs](https://docs.pyth.network/) * [Pyth - Best Practices](https://docs.pyth.network/price-feeds/best-practices) * [Pyth Benchmarks - historical price feeds](https://docs.pyth.network/metrics/) ### [Tellor](https://tellor.io/) Tellor is an *optimistic* oracle. Builders should not accept instant price quotes and should wait a few minutes before locking in details. Tellor supports a price feed oracle and a data oracle for the Filecoin network. The data oracle can provide Filecoin-specific data, such as the reputation of storage providers, which helps lending protocols determine interest rates for SPs. **Tellor smart contracts** Tellor’s smart contracts are live on the Filecoin Mainnet and Calibration testnet. | Name | Address | Mainnet | Calibration | | ---------------- | -------------------------------------------- | ------- | ----------- | | Bridged TRB | `0x045CE60839d108B43dF9e703d4b25402a6a28a0d` | ✔️ | | | Playground/TRB | `0x15e6Cc0D69A162151Cadfba035aa10b82b12b970` | | ✔️ | | Oracle | `0xb2CB696fE5244fB9004877e58dcB680cB86Ba444` | ✔️ | ✔️ | | Governance | `0xb55bB55f7D8b4F26Bd18198088C96488D95cab39` | ✔️ | ✔️ | | Autopay | `0x60cBf3991F05a0671250e673Aa166e9D1A0C662E` | ✔️ | ✔️ | | TellorFlex | `0xb2CB696fE5244fB9004877e58dcB680cB86Ba444` | ✔️ | ✔️ | | QueryDataStorage | `0xf44166ca8bdB612268a4D401e4c5147968E5a190` | ✔️ | ✔️ | | Multisig | `0x34Fae97547E990ef0E05e05286c51E4645bf1A85` | ✔️ | ✔️ | #### **Further Tellor resources** * [Tellor docs](https://docs.tellor.io/) * [Filecoin Storage Insurance Contract](https://github.com/tellor-io/filecoin-query-insurance-impl/tree/main) * [Getting Tellor Data for any use case](https://www.youtube.com/watch?v=AQIDqTLguyI) - FVM Dataverse Hackathon ### [eOracle](https://www.eoracle.io/) eOracle extends Ethereum's trust to connect decentralized applications with off-chain data as the largest restaking protocol backed by over $5B of stake ETH through 120,000 stakers and over 110 validators distributed around the globe. eOracle provides reliable and secure on-chain price feeds, as well as custom data feeds. **eOracle Smart Contracts** eOracle's smart contracts are live on the Filecoin Calibration testnet. | Name | Address | Mainnet | Calibration | | ------------------------------ | -------------------------------------------- | ------- | ----------- | | EOFeedManager | `0x4BCafd5f3fB32221BaEAF6B986d1449772885D1E` | | ✔️ | | EOFeedAdapter - AUD/USD | `0x6243357B9241Fe9C3BAfbA79DeD3300a855113FA` | | ✔️ | | EOFeedAdapter - BTC/USD | `0x705256d9B37950628F97A1a8De7Ab557345a0A80` | | ✔️ | | EOFeedAdapter - ETH/USD | `0x2bada837140A310f4A1d9D0e7fab114da6b87031` | | ✔️ | | EOFeedAdapter - EUR/USD | `0x7C01e105B9c3772Bc72ef55F450b9B96f81EDE82` | | ✔️ | | EOFeedAdapter - FIL/USD | `0x335C47CF754cf7f5d6DF78EF9fAb065aa5988D89` | | ✔️ | | EOFeedAdapter - GBP/USD | `0x2Af9bb239936aC3e5a35CC804CD09a8CF3B589e7` | | ✔️ | | EOFeedAdapter - LINK/USD | `0x7E8326Fd75aCa5A7dF43E999A1119c392EDFC93a` | | ✔️ | | EOFeedAdapter - SOL/USD | `0x7E3e2953d69890f6B7E5831144986113E9199593` | | ✔️ | | EOFeedAdapter - USDT/USD | `0x30f43F80279b7BB1b9206896DB90Aabf69494c16` | | ✔️ | | EOFeedAdapter - XAU/USD | `0x8609B3087D473cD2B6bc7674dD54FF13c909027f` | | ✔️ | | EOFeedAdapter - sFRAX/FRAX | `0xd56f6CC400f3bFC77faeC4bBb1e0400c6A26A925` | | ✔️ | | EOFeedAdapter - sfrxETH/frxETH | `0x626A1Cb309289Eb542710D6093C6341562769983` | | ✔️ | | EOFeedAdapter - stETH/ETH | `0x0834Bb4baf2758a3642636C89D18F97ED6672D1C` | | ✔️ | #### **Further eOracle resources** * [eOracle GitHub](https://github.com/eoracle) [Was this page helpful?](https://airtable.com/apppq4inOe4gmSSlk/pagoZHC2i1iqgphgl/form?prefill_Page+URL=https://docs.filecoin.io/build/advanced/oracles) # Multicall Multicall allows you to aggregate multiple contract reads into a single JSON-RPC request, and execute multiple state-changing calls in a single transaction on the FVM. ## Multicall3 [Multicall3](https://www.multicall3.com/) is a powerful tool that offers batch contract calls to smart contracts on the Filecoin Virtual Machine (FVM). Multicall3 is deployed on over 100 chains at `0xcA11bde05977b3631167028862bE2a173976CA11`. A sortable, searchable list of all chains it's deployed on can be found [here](https://multicall3.com/deployments). The [multicall3 ABI](https://multicall3.com/abi) can be downloaded or copied to the clipboard in various formats, including: * Solidity interface. * JSON ABI, prettified. * JSON ABI, minified. * [ethers.js](https://docs.ethers.org/v5/) human readable ABI. * [viem](https://viem.sh/) human readable ABI. Alternatively, you can: * Download the ABI from the [releases](https://github.com/mds1/multicall/releases) page. * Copy the ABI from [Etherscan](https://etherscan.io/address/0xcA11bde05977b3631167028862bE2a173976CA11#code). * Install [Foundry](https://github.com/gakonst/foundry/) and run `cast interface 0xcA11bde05977b3631167028862bE2a173976CA11`. ### Contract address Multicall has the same, precomputed address for all of the networks it is deployed on. | Name | Address | Mainnet | Calibration | | ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------- | ------- | ----------- | | [Multicall - Mainnet](https://filfox.info/en/address/0xcA11bde05977b3631167028862bE2a173976CA11?t=3) | `0xcA11bde05977b3631167028862bE2a173976CA11` | ✔️ | ❌ | | [Multicall - Calibration](https://calibration.filscan.io/en/address/0xcA11bde05977b3631167028862bE2a173976CA11/) | `0xcA11bde05977b3631167028862bE2a173976CA11` | ❌ | ✔️ | ### Usage To use Multicall3 to send batch contract read/write to your smart contract, you will need to: 1. Obtain the Multicall3 contract address for the network you're using (Filecoin mainnet or Calibration testnet). 2. Get the Multicall3 ABI, which can be downloaded or copied from various sources mentioned above. 3. Create an instance of the Multicall3 contract using a web3 library like ethers.js or viem. 4. Prepare your batch calls, including the target contract addresses, function selectors, and input data. 5. Use the appropriate Multicall3 method (e.g., `aggregate3` for multiple calls) to execute your batch operations. 6. Process the returned data from the Multicall3 contra
프로젝트로 돌아가기