diff --git a/.github/workflows/deployment.yaml b/.github/workflows/deployment.yaml index 4a402d2a0..0eb217135 100644 --- a/.github/workflows/deployment.yaml +++ b/.github/workflows/deployment.yaml @@ -4,6 +4,7 @@ on: push: branches: - main + - gh-pages env: NODE_VERSION: 18.x @@ -38,5 +39,8 @@ jobs: aws s3 sync ./build s3://${{ secrets.AWS_S3_BUCKET }} --exact-timestamps --delete --region ${{ secrets.AWS_REGION }} $* - name: Invalidate cache run: | - aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} --paths "/*" - + if [ "${{ secrets.AWS_CF_DISTRIBUTION_ID }}" != '' ]; then + aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} --paths "/*" + else + echo "AWS_CF_DISTRIBUTION_ID is not set. Skipping cache invalidation." + fi \ No newline at end of file diff --git a/docs/building-on-lisk/using-oracle-data/redstone-pull.md b/docs/building-on-lisk/using-oracle-data/redstone-pull.md new file mode 100644 index 000000000..2c24b7b9c --- /dev/null +++ b/docs/building-on-lisk/using-oracle-data/redstone-pull.md @@ -0,0 +1,162 @@ +--- +title: ...with Redstone (Pull) +slug: /building-on-lisk/using-oracle-data/redstone-pull +description: A guide on using Redstone Data Feeds to access real-world data such as asset prices, directly from your smart contracts on the Lisk testnet. +keywords: [ + Oracle + Oracles, + Redstone, + price feeds, + data feeds, + smart contract, + Lisk blockchain, + Lisk network, + Lisk testnet, + Lisk test network, + app development, + dapp development, + build a dapp on Lisk, + build on Lisk, + ] +--- + +# Accessing real-world data using the Redstone Oracle + +This page will explain how you can access oracle data using Redstone. + +RedStone is a data ecosystem that delivers frequently updated, reliable, and diverse data for your dApp and smart contracts deployed on Lisk. + +## How to pull oracle data from Redstone + +To create a smart contract that directly fetches the latest data from the Redstone oracle, follow this guide. + +This guide uses the [Redstone Pull model](https://docs.redstone.finance/docs/get-started/models/redstone-pull) to fetch the data. + +For an overview of the different modules that Redstone offers to receive oracle data, go to [Oracles > Redstone](../../lisk-tools/oracles#redstone). + +[Hardhat](https://hardhat.org/) is used in this guide to create the smart contract. +In case you want to use Foundry, check out the [Redstone docs](https://docs.redstone.finance/docs/get-started/models/redstone-pull#foundry) for instructions. + +### Dependencies + +- ethers ^5.7.2 +- hardhat ^2.14.0 + +### Install the evm connector +Install the [@redstone-finance/evm-connector](https://www.npmjs.com/package/@redstone-finance/evm-connector) package. + +```sh +npm install @redstone-finance/evm-connector +``` + +### Import the evm connector + +```solidity +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.9; + +/** +* Imports the EVM connector +*/ +import "@redstone-finance/evm-connector/contracts/data-services/RapidDemoConsumerBase.sol"; + +contract YourContract is RapidDemoConsumerBase { + + // ... + +} +``` +### Get oracle data + +Get the oracle data using the functions provided by the EVM connector. + +#### Get a single value + +To get a single price feed, use the function `getOracleNumericValueFromTxMsg()` and provide the data feed ID as a parameter. + +```solidity +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.9; + +/** +* Imports the EVM connector +*/ +import "@redstone-finance/evm-connector/contracts/data-services/RapidDemoConsumerBase.sol"; + +contract YourContract is RapidDemoConsumerBase { + + // ... + + /** + * Returns the latest price of ETH + */ + function getLatestEthPrice() public view returns (uint256) { + bytes32 dataFeedId = bytes32("ETH"); + return getOracleNumericValueFromTxMsg(dataFeedId); + } +} +``` + +#### Get multiple values + +To get data from multiple price feeds, use the function `getOracleNumericValuesFromTxMsg()` and provide the data feed ID array as a parameter. + +```solidity +/** +* Returns the latest prices of ETH and BTC +*/ +function getLatestEthBtcPrices() public view returns (uint256[] memory) { + bytes32[] memory dataFeedIds = new bytes32[](2); + dataFeedIds[0] = bytes32("ETH"); + dataFeedIds[1] = bytes32("BTC"); + uint256[] memory values = getOracleNumericValuesFromTxMsg(dataFeedIds); + return values; +} +``` + +### Testing + +In order to test the EVM connector related functions in your contract, it is necessary to wrap the contract using the `WrapperBuilder` provided by the `@redstone-finance/evm-connector` package. + +```typescript title="test/YourContract.ts" +import { expect } from "chai"; +import { ethers } from "hardhat"; +import { WrapperBuilder } from "@redstone-finance/evm-connector"; + +describe("YourContract", function () { + describe("Redstone", function () { + it("Get ETH price securely", async function () { + const YourContract = await ethers.getContractFactory("YourContract"); + const contract = await YourContract.deploy(); + const wrappedContract = WrapperBuilder.wrap(contract).usingDataService({ + dataFeeds: ["ETH"], + }); + + // Interact with the contract (getting oracle value securely) + const ethPriceFromContract = await wrappedContract.getLatestEthPrice(); + console.log("Latest ETH price:"); + console.log({ ethPriceFromContract }); + }); + }); +}); +``` + +Now run the test: + +```bash +npx hardhat test +``` + +This should output the latest ETH price in the console: + +``` title="Output" +Latest ETH price: +{ ethPriceFromContract: BigNumber { value: "250255087192" } } +``` + +## Deploying on Lisk + +To deploy the smart contract on Lisk Sepolia or Lisk Mainnet, follow the guides + +- [Deploying a smart contract with Hardhat](../deploying-smart-contract/with-Hardhat), or +- [Deploying a smart contract with Foundry](../deploying-smart-contract/with-Foundry) \ No newline at end of file diff --git a/docs/building-on-lisk/using-oracle-data/tellor.md b/docs/building-on-lisk/using-oracle-data/tellor.md new file mode 100644 index 000000000..99b7f1dbb --- /dev/null +++ b/docs/building-on-lisk/using-oracle-data/tellor.md @@ -0,0 +1,205 @@ +--- +title: ...with Tellor +slug: /building-on-lisk/using-oracle-data/tellor +description: A guide on using Redstone Data Feeds to access real-world data such as asset prices, directly from your smart contracts on the Lisk testnet. +keywords: [ + Oracle + Oracles, + Redstone, + price feeds, + data feeds, + smart contract, + Lisk blockchain, + Lisk network, + Lisk testnet, + Lisk test network, + app development, + dapp development, + build a dapp on Lisk, + build on Lisk, + ] +--- + +# Using oracle data with Tellor +[Tellor](https://tellor.io/) is an immutable decentralized oracle protocol where parties can request the value of an offchain data point (e.g. ETH/USD, LSK/USD) and reporters compete to add this value to an onchain databank. +The inputs to this databank are secured by a network of staked reporters. + +Tellor utilizes crypto-economic incentive mechanisms, rewarding honest data submissions by reporters and punishing bad actors through the issuance of Tellorโ€™s token, Tributes (TRB) and a dispute mechanism. + +This incentivizes an open, permissionless network of data reporting and data validation, ensuring that data can be provided by anyone and checked by everyone. + +## Installation +The first thing you'll want to do is install the basic tools necessary for using Tellor as your oracle. + +To install [usingtellor](https://github.com/tellor-io/usingtellor), run one the following commands: + +- Hardhat: `npm install usingtellor` +- Foundry: `forge install tellor-io/usingtellor` + +Once installed, this will allow your contracts to inherit the functions from the 'UsingTellor' contract. + +Great! Now that you've got the tools ready, let's go through a simple exercise where we retrieve the `eth/usd` and `lsk/usd` prices from Tellor. + +## Import + +```solidity +pragma solidity >=0.8.0; + +import "usingtellor/contracts/UsingTellor.sol"; +/** + * Network: Lisk Mainnet + * Address: 0x896419Ed2E0dC848a1f7d2814F4e5Df4b9B9bFcc +*/ +contract MyContract is UsingTellor { + + constructor(address payable _tellorOracle) UsingTellor(_tellorOracle) { + + } + + // ... + +} +``` + +To import the UsingTellor contract into your Solidity file, pass the desired Tellor Oracle address as a parameter. +For the Lisk Mainnet, the Tellor Oracle address is: [0x896419Ed2E0dC848a1f7d2814F4e5Df4b9B9bFcc](https://blockscout.lisk.com/address/0x896419Ed2E0dC848a1f7d2814F4e5Df4b9B9bFcc) + +## Reading data + +In the example below, we add two functions: + +- `getETHSpotPrice()` that reads the ETH/USD price feed and another function +- `getLSKSpotPrice()` that reads the LSK/USD price feed from the Oracle + +```solidity +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.0; + +import { UsingTellor } from "usingtellor/contracts/UsingTellor.sol"; + +contract MyContract is UsingTellor { + + uint256 public ethLastStoredTimestamp; + uint256 public ethLastStoredPrice; + uint256 public lskLastStoredTimestamp; + uint256 public lskLastStoredPrice; + bytes32 public immutable ethQueryId; + bytes32 public immutable lskQueryId; + uint256 public constant DISPUTE_BUFFER = 20 minutes; + uint256 public constant STALENESS_AGE = 12 hours; + + error StalePrice(uint256 price, uint256 timestamp); + error NoValueRetrieved(uint256 timestamp); + + /** + * @dev the constructor sets the Tellor address and the ETH and LSK queryIds + * @param _tellorOracle is the address of the Tellor oracle + */ + constructor (address payable _tellorOracle) UsingTellor(_tellorOracle) { + // set the ETH queryId + bytes memory _ethQueryData = abi.encode("SpotPrice", abi.encode("eth", "usd")); + ethQueryId = keccak256(_ethQueryData); + // set the LSK queryId + bytes memory _lskQueryData = abi.encode("SpotPrice", abi.encode("lsk", "usd")); + lskQueryId = keccak256(_lskQueryData); + } + + /** + * @dev Allows a user contract to read the ETH price from Tellor and perform some + * best practice checks on the retrieved data + * @return _value the ETH spot price from Tellor, with 18 decimal places + * @return timestamp the value's timestamp + */ + function getETHSpotPrice() + public + returns ( + uint256 _value, + uint256 timestamp + ) + { + // retrieve the most recent 20+ minute old ETH price. + // the buffer allows time for a bad value to be disputed + (bytes memory _data, uint256 _timestamp) = _getDataBefore(ethQueryId, block.timestamp - DISPUTE_BUFFER); + + // check whether any value was retrieved + if (_timestamp == 0 || _data.length == 0) revert NoValueRetrieved(_timestamp); + + // decode the value from bytes to uint256 + _value = abi.decode(_data, (uint256)); + + // prevent a back-in-time dispute attack by caching the most recent value and timestamp. + // this stops an attacker from disputing tellor values to manupulate which price is used + // by your protocol + if (_timestamp > ethLastStoredTimestamp) { + // if the new value is newer than the last stored value, update the cache + ethLastStoredTimestamp = _timestamp; + ethLastStoredPrice = _value; + } else { + // if the new value is older than the last stored value, use the cached value + _value = ethLastStoredPrice; + _timestamp = ethLastStoredTimestamp; + } + + // check whether value is too old + if (block.timestamp - _timestamp > STALENESS_AGE) revert StalePrice(_value, _timestamp); + + // return the value and timestamp + return (_value, _timestamp); + } + + /** + * @dev Allows a user contract to read the LSK price from Tellor and perform some + * best practice checks on the retrieved data + * @return _value the LSK spot price from Tellor, with 18 decimal places + * @return timestamp the value's timestamp + */ + function getLSKSpotPrice() + public + returns ( + uint256 _value, + uint256 timestamp + ) + { + (bytes memory _data, uint256 _timestamp) = _getDataBefore(lskQueryId, block.timestamp - DISPUTE_BUFFER); + + if (_timestamp == 0 || _data.length == 0) revert NoValueRetrieved(_timestamp); + + _value = abi.decode(_data, (uint256)); + + if (_timestamp > lskLastStoredTimestamp) { + lskLastStoredTimestamp = _timestamp; + lskLastStoredPrice = _value; + } else { + _value = lskLastStoredPrice; + _timestamp = lskLastStoredTimestamp; + } + + if (block.timestamp - _timestamp > STALENESS_AGE) revert StalePrice(_value, _timestamp); + + return (_value, _timestamp); + } +} +``` + +You can adapt this contract to your needs. +The example utilizes some best practices[^1] for using Tellor by implementing a dispute time buffer and a data staleness check. +In addition, it also seeks to mitigate back-in-time dispute attacks by caching the most recent value and timestamp. + +[^1]: Based on examples in [Tellor's best practices repository](https://github.com/tellor-io/best-practices-user/tree/main) + +:::tip +For a general overview of best practices using Tellor, go to the [User checklists](https://docs.tellor.io/tellor/getting-data/user-checklists) in the Tellor docs. +::: + +## Deploying on Lisk + +To deploy the smart contract on Lisk Sepolia or Lisk Mainnet, follow the guides + +- [Deploying a smart contract with Hardhat](../deploying-smart-contract/with-Hardhat), or +- [Deploying a smart contract with Foundry](../deploying-smart-contract/with-Foundry) + +## Further resources + +- For a more robust implementation of the Tellor oracle, check out the full list of available functions [here](https://github.com/tellor-io/usingtellor/blob/master/README.md). +- Have a specific Data Feed Request? [Fill out this form](https://github.com/tellor-io/dataSpecs/issues/new?assignees=&labels=&template=new_query_type.yaml&title=%5BNew+Data+Request+Form%5D%3A+). +- Still have question? Reach out to the Tellor team on Discord [here](https://discord.gg/tellor). \ No newline at end of file diff --git a/docs/lisk-tools/oracles.md b/docs/lisk-tools/oracles.md index 8b90c0de7..769e36dfd 100644 --- a/docs/lisk-tools/oracles.md +++ b/docs/lisk-tools/oracles.md @@ -11,6 +11,7 @@ keywords: Lisk Testnet, Lisk network, Redstone, + Tellor, price feeds, data feeds, ] @@ -39,4 +40,27 @@ Interested in integration? [Get in contact](https://discord.com/invite/PVxBZKFr4 #### Supported Networks - Lisk -- Lisk Sepolia \ No newline at end of file +- Lisk Sepolia + +### Guides + +- [Accessing oracle data with Redstone (Pull)](../building-on-lisk/using-oracle-data/redstone-pull.md) + +## Tellor + +Tellor is an immutable decentralized oracle protocol where parties can request the value of an offchain data point (e.g. ETH/USD) and reporters compete to add this value to an onchain databank. +The inputs to this databank are secured by a network of staked reporters. + +Tellor utilizes crypto-economic incentive mechanisms, rewarding honest data submissions by reporters and punishing bad actors through the issuance of Tellorโ€™s token, Tributes (TRB) and a dispute mechanism. + +This incentivizes an open, permissionless network of data reporting and data validation, ensuring that data can be provided by anyone and checked by everyone. + +[A list of all the Tellor contracts deployed on Lisk is available on their documentation](https://docs.tellor.io/tellor/the-basics/contracts-reference#lisk) + +#### Supported Networks + +- Lisk +- Lisk Sepolia + +### Guides +- [Accessing oracle data with Tellor](../building-on-lisk/using-oracle-data/tellor.md) \ No newline at end of file diff --git a/docusaurus.config.js b/docusaurus.config.js index cb8991e1a..4398106c5 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -23,9 +23,9 @@ const config = { // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these. - organizationName: 'LiskHQ', // Usually your GitHub org/user name. + /* organizationName: 'LiskHQ', // Usually your GitHub org/user name. projectName: 'lisk-documentation', // Usually your repo name. - trailingSlash: false, + trailingSlash: false, */ onBrokenLinks: 'throw', onBrokenMarkdownLinks: 'throw', @@ -35,7 +35,12 @@ const config = { // may want to replace "en" with "zh-Hans". i18n: { defaultLocale: 'en', - locales: ['en'], + locales: ['en', 'ind'], + localeConfigs: { + ind: { + label: 'Indonesian', + }, + }, }, scripts: [ @@ -94,6 +99,12 @@ const config = { srcDark: '/img/lisk-docs-dark.svg', }, items: [ + /*{ + TODO: Uncomment when all localozed pages are translated + /* { + type: 'localeDropdown', + position: 'right', + }, */ { type: 'doc', position: 'left', diff --git a/git-deploy-github.sh b/git-deploy-github.sh deleted file mode 100644 index 8a4ad802a..000000000 --- a/git-deploy-github.sh +++ /dev/null @@ -1,2 +0,0 @@ -export LISK_DOC_BASE_URL=/lisk-documentation/ -GIT_USER=TalhaMaliktz yarn deploy \ No newline at end of file diff --git a/i18n/ind/code.json b/i18n/ind/code.json new file mode 100644 index 000000000..779a13a37 --- /dev/null +++ b/i18n/ind/code.json @@ -0,0 +1,482 @@ +{ + "theme.ErrorPageContent.title": { + "message": "Terjadi kesalahan.", + "description": "The title of the fallback page when the page crashed" + }, + "theme.BackToTopButton.buttonAriaLabel": { + "message": "Gulir kembali ke atas", + "description": "The ARIA label for the back to top button" + }, + "theme.blog.paginator.navAriaLabel": { + "message": "Navigasi entri blog", + "description": "The ARIA label for the blog pagination" + }, + "theme.blog.paginator.newerEntries": { + "message": "Entri lebih baru", + "description": "The label used to navigate to the newer blog posts page (previous page)" + }, + "theme.blog.paginator.olderEntries": { + "message": "Entri lebih lama", + "description": "The label used to navigate to the older blog posts page (next page)" + }, + "theme.blog.archive.title": { + "message": "Arsip", + "description": "The page & hero title of the blog archive page" + }, + "theme.blog.archive.description": { + "message": "Arsip", + "description": "The page & hero description of the blog archive page" + }, + "theme.blog.post.paginator.navAriaLabel": { + "message": "Navigasi halaman pos blog", + "description": "The ARIA label for the blog posts pagination" + }, + "theme.blog.post.paginator.newerPost": { + "message": "Pos lebih baru", + "description": "The blog post button label to navigate to the newer/previous post" + }, + "theme.blog.post.paginator.olderPost": { + "message": "Pos lebih lama", + "description": "The blog post button label to navigate to the older/next post" + }, + "theme.tags.tagsPageLink": { + "message": "Lihat Semua Tag", + "description": "The label of the link targeting the tag list page" + }, + "theme.colorToggle.ariaLabel": { + "message": "Ubah antara modus gelap dan modus terang (saat ini {mode})", + "description": "The ARIA label for the navbar color mode toggle" + }, + "theme.colorToggle.ariaLabel.mode.dark": { + "message": "modus gelap", + "description": "The name for the dark color mode" + }, + "theme.colorToggle.ariaLabel.mode.light": { + "message": "modus terang", + "description": "The name for the light color mode" + }, + "theme.docs.breadcrumbs.navAriaLabel": { + "message": "Runut navigasi", + "description": "The ARIA label for the breadcrumbs" + }, + "theme.docs.DocCard.categoryDescription.plurals": { + "message": "1 butir|{count} butir", + "description": "The default description for a category card in the generated index about how many items this category includes" + }, + "theme.docs.paginator.navAriaLabel": { + "message": "Halaman dokumentasi", + "description": "The ARIA label for the docs pagination" + }, + "theme.docs.paginator.previous": { + "message": "Sebelum", + "description": "The label used to navigate to the previous doc" + }, + "theme.docs.paginator.next": { + "message": "Berikut", + "description": "The label used to navigate to the next doc" + }, + "theme.docs.versionBadge.label": { + "message": "Versi: {versionLabel}" + }, + "theme.docs.tagDocListPageTitle.nDocsTagged": { + "message": "Satu dokumentasi memiliki tag|{count} dokumentasi memiliki tag", + "description": "Pluralized label for \"{count} docs tagged\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.docs.tagDocListPageTitle": { + "message": "{nDocsTagged} dengan \"{tagName}\"", + "description": "The title of the page for a docs tag" + }, + "theme.docs.versions.unreleasedVersionLabel": { + "message": "Ini adalah dokumentasi yang belum dirilis untuk {siteTitle} {versionLabel}.", + "description": "The label used to tell the user that he's browsing an unreleased doc version" + }, + "theme.docs.versions.unmaintainedVersionLabel": { + "message": "Ini adalah dokumentasi untuk {siteTitle} {versionLabel}, yang tidak lagi aktif dikelola.", + "description": "The label used to tell the user that he's browsing an unmaintained doc version" + }, + "theme.docs.versions.latestVersionSuggestionLabel": { + "message": "Untuk dokumentasi terbaru, lihat {latestVersionLink} ({versionLabel}).", + "description": "The label used to tell the user to check the latest version" + }, + "theme.docs.versions.latestVersionLinkLabel": { + "message": "versi terbaru", + "description": "The label used for the latest version suggestion link label" + }, + "theme.common.editThisPage": { + "message": "Sunting halaman ini", + "description": "The link label to edit the current page" + }, + "theme.lastUpdated.atDate": { + "message": " pada {date}", + "description": "The words used to describe on which date a page has been last updated" + }, + "theme.lastUpdated.byUser": { + "message": " oleh {user}", + "description": "The words used to describe by who the page has been last updated" + }, + "theme.lastUpdated.lastUpdatedAtBy": { + "message": "Diperbaharui{atDate}{byUser}", + "description": "The sentence used to display when a page has been last updated, and by who" + }, + "theme.common.headingLinkTitle": { + "message": "Taut langsung ke {heading}", + "description": "Title for link to heading" + }, + "theme.NotFound.title": { + "message": "Halaman Tak Ditemukan", + "description": "The title of the 404 page" + }, + "theme.navbar.mobileVersionsDropdown.label": { + "message": "Versi", + "description": "The label for the navbar versions dropdown on mobile view" + }, + "theme.tags.tagsListLabel": { + "message": "Tag:", + "description": "The label alongside a tag list" + }, + "theme.AnnouncementBar.closeButtonAriaLabel": { + "message": "Tutup", + "description": "The ARIA label for close button of announcement bar" + }, + "theme.admonition.caution": { + "message": "waspada", + "description": "The default label used for the Caution admonition (:::caution)" + }, + "theme.admonition.danger": { + "message": "bahaya", + "description": "The default label used for the Danger admonition (:::danger)" + }, + "theme.admonition.info": { + "message": "info", + "description": "The default label used for the Info admonition (:::info)" + }, + "theme.admonition.note": { + "message": "catatan", + "description": "The default label used for the Note admonition (:::note)" + }, + "theme.admonition.tip": { + "message": "tip", + "description": "The default label used for the Tip admonition (:::tip)" + }, + "theme.admonition.warning": { + "message": "peringatan", + "description": "The default label used for the Warning admonition (:::warning)" + }, + "theme.blog.sidebar.navAriaLabel": { + "message": "Navigasi pos blog terbaru", + "description": "The ARIA label for recent posts in the blog sidebar" + }, + "theme.CodeBlock.wordWrapToggle": { + "message": "Alihkan pembungkus kata", + "description": "The title attribute for toggle word wrapping button of code block lines" + }, + "theme.CodeBlock.copied": { + "message": "Disalin", + "description": "The copied button label on code blocks" + }, + "theme.CodeBlock.copyButtonAriaLabel": { + "message": "Salin kode ke papan klip", + "description": "The ARIA label for copy code blocks button" + }, + "theme.CodeBlock.copy": { + "message": "Salin", + "description": "The copy button label on code blocks" + }, + "theme.DocSidebarItem.expandCategoryAriaLabel": { + "message": "Perluas kategori bilah sisi '{label}'", + "description": "The ARIA label to expand the sidebar category" + }, + "theme.DocSidebarItem.collapseCategoryAriaLabel": { + "message": "Ciutkan kategori bilah sisi '{label}'", + "description": "The ARIA label to collapse the sidebar category" + }, + "theme.NavBar.navAriaLabel": { + "message": "Utama", + "description": "The ARIA label for the main navigation" + }, + "theme.NotFound.p1": { + "message": "Kami tak dapat menemukan yang anda cari.", + "description": "The first paragraph of the 404 page" + }, + "theme.NotFound.p2": { + "message": "Silakan hubungi pemilik situs yang mengarahkan anda ke URL asli dan beri tahu mereka bahwa tautan mereka salah.", + "description": "The 2nd paragraph of the 404 page" + }, + "theme.TOCCollapsible.toggleButtonLabel": { + "message": "Pada halaman ini", + "description": "The label used by the button on the collapsible TOC component" + }, + "theme.navbar.mobileLanguageDropdown.label": { + "message": "Bahasa", + "description": "The label for the mobile language switcher dropdown" + }, + "theme.blog.post.readMore": { + "message": "Baca Selengkapnya", + "description": "The label used in blog post item excerpts to link to full blog posts" + }, + "theme.blog.post.readMoreLabel": { + "message": "Baca selengkapnya mengenai {title}", + "description": "The ARIA label for the link to full blog posts from excerpts" + }, + "theme.blog.post.readingTime.plurals": { + "message": "Satu menit membaca|{readingTime} menit membaca", + "description": "Pluralized label for \"{readingTime} min read\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.docs.breadcrumbs.home": { + "message": "Halaman utama", + "description": "The ARIA label for the home page in the breadcrumbs" + }, + "theme.docs.sidebar.collapseButtonTitle": { + "message": "Ciutkan bilah sisi", + "description": "The title attribute for collapse button of doc sidebar" + }, + "theme.docs.sidebar.collapseButtonAriaLabel": { + "message": "Ciutkan bilah sisi", + "description": "The title attribute for collapse button of doc sidebar" + }, + "theme.docs.sidebar.navAriaLabel": { + "message": "Bilah sisi dokumentasi", + "description": "The ARIA label for the sidebar navigation" + }, + "theme.docs.sidebar.closeSidebarButtonAriaLabel": { + "message": "Tutup bilah sisi", + "description": "The ARIA label for close button of mobile sidebar" + }, + "theme.docs.sidebar.expandButtonTitle": { + "message": "Perluas bilah sisi", + "description": "The ARIA label and title attribute for expand button of doc sidebar" + }, + "theme.docs.sidebar.expandButtonAriaLabel": { + "message": "Perluas bilah sisi", + "description": "The ARIA label and title attribute for expand button of doc sidebar" + }, + "theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel": { + "message": "โ† Kembali ke menu utama", + "description": "The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)" + }, + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": { + "message": "Alihkan bilah sisi", + "description": "The ARIA label for hamburger menu button of mobile navigation" + }, + "theme.SearchBar.seeAll": { + "message": "Lihat semua {count} hasilnya" + }, + "theme.SearchBar.label": { + "message": "Cari", + "description": "The ARIA label and placeholder for search button" + }, + "theme.SearchModal.searchBox.resetButtonTitle": { + "message": "Hapus teks pencarian", + "description": "The label and ARIA label for search box reset button" + }, + "theme.SearchModal.searchBox.cancelButtonText": { + "message": "Batalkan", + "description": "The label and ARIA label for search box cancel button" + }, + "theme.SearchModal.startScreen.recentSearchesTitle": { + "message": "Terbaru", + "description": "The title for recent searches" + }, + "theme.SearchModal.startScreen.noRecentSearchesText": { + "message": "Tak ada riwayat pencarian", + "description": "The text when no recent searches" + }, + "theme.SearchModal.startScreen.saveRecentSearchButtonTitle": { + "message": "Simpan pencarian ini", + "description": "The label for save recent search button" + }, + "theme.SearchModal.startScreen.removeRecentSearchButtonTitle": { + "message": "Hapus pencarian ini dari riwayat", + "description": "The label for remove recent search button" + }, + "theme.SearchModal.startScreen.favoriteSearchesTitle": { + "message": "Favorit", + "description": "The title for favorite searches" + }, + "theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle": { + "message": "Hapus pencarian ini dari favorit", + "description": "The label for remove favorite search button" + }, + "theme.SearchModal.errorScreen.titleText": { + "message": "Gagal mendapatkan hasilnya", + "description": "The title for error screen of search modal" + }, + "theme.SearchModal.errorScreen.helpText": { + "message": "Barangkali anda perlu memerika koneksi jaringan anda.", + "description": "The help text for error screen of search modal" + }, + "theme.SearchModal.footer.selectText": { + "message": "memilih", + "description": "The explanatory text of the action for the enter key" + }, + "theme.SearchModal.footer.selectKeyAriaLabel": { + "message": "Tombol Enter", + "description": "The ARIA label for the Enter key button that makes the selection" + }, + "theme.SearchModal.footer.navigateText": { + "message": "navigasi", + "description": "The explanatory text of the action for the Arrow up and Arrow down key" + }, + "theme.SearchModal.footer.navigateUpKeyAriaLabel": { + "message": "Panah ke atas", + "description": "The ARIA label for the Arrow up key button that makes the navigation" + }, + "theme.SearchModal.footer.navigateDownKeyAriaLabel": { + "message": "Panah ke bawah", + "description": "The ARIA label for the Arrow down key button that makes the navigation" + }, + "theme.SearchModal.footer.closeText": { + "message": "menutup", + "description": "The explanatory text of the action for Escape key" + }, + "theme.SearchModal.footer.closeKeyAriaLabel": { + "message": "Tombol Escape", + "description": "The ARIA label for the Escape key button that close the modal" + }, + "theme.SearchModal.footer.searchByText": { + "message": "Cari dengan teks", + "description": "The text explain that the search is making by Algolia" + }, + "theme.SearchModal.noResultsScreen.noResultsText": { + "message": "Tak ada hasil untuk", + "description": "The text explains that there are no results for the following search" + }, + "theme.SearchModal.noResultsScreen.suggestedQueryText": { + "message": "Coba lakukan pencarian untuk", + "description": "The text for the suggested query when no results are found for the following search" + }, + "theme.SearchModal.noResultsScreen.reportMissingResultsText": { + "message": "Yakin pencarian ini seharusnya memberikan hasil?", + "description": "The text for the question where the user thinks there are missing results" + }, + "theme.SearchModal.noResultsScreen.reportMissingResultsLinkText": { + "message": "Beri tahu kami.", + "description": "The text for the link to report missing results" + }, + "theme.SearchModal.placeholder": { + "message": "Cari dokumentasi", + "description": "The placeholder of the input of the DocSearch pop-up modal" + }, + "theme.SearchPage.documentsFound.plurals": { + "message": "Satu dokumen ditemukan|{count} dokumen ditemukan", + "description": "Pluralized label for \"{count} documents found\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.SearchPage.existingResultsTitle": { + "message": "Hasil pencarian untuk \"{query}\"", + "description": "The search page title for non-empty query" + }, + "theme.SearchPage.emptyResultsTitle": { + "message": "Cari dokumentasi", + "description": "The search page title for empty query" + }, + "theme.SearchPage.inputPlaceholder": { + "message": "Tulis pencarian anda di sini", + "description": "The placeholder for search page input" + }, + "theme.SearchPage.inputLabel": { + "message": "Cari", + "description": "The ARIA label for search page input" + }, + "theme.SearchPage.algoliaLabel": { + "message": "Pencarian oleh Algolia", + "description": "The ARIA label for Algolia mention" + }, + "theme.SearchPage.noResultsText": { + "message": "Tak ada hasil yang ditemukan", + "description": "The paragraph for empty search result" + }, + "theme.SearchPage.fetchingNewResults": { + "message": "Mendapatkan hasil pencarian...", + "description": "The paragraph for fetching new search results" + }, + "theme.blog.post.plurals": { + "message": "Satu pos|{count} pos", + "description": "Pluralized label for \"{count} posts\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.blog.tagTitle": { + "message": "{nPosts} memiliki tag \"{tagName}\"", + "description": "The title of the page for a blog tag" + }, + "theme.blog.author.pageTitle": { + "message": "{authorName} - {nPosts}", + "description": "The title of the page for a blog author" + }, + "theme.blog.authorsList.pageTitle": { + "message": "Authors", + "description": "The title of the authors page" + }, + "theme.blog.authorsList.viewAll": { + "message": "View All Authors", + "description": "The label of the link targeting the blog authors page" + }, + "theme.contentVisibility.unlistedBanner.title": { + "message": "Halaman tak terdaftar", + "description": "The unlisted content banner title" + }, + "theme.contentVisibility.unlistedBanner.message": { + "message": "Halaman ini tidak terdaftar. Mesin pencari tidak akan mengindeksnya, dan hanya pengguna yang memiliki tautan langsung yang dapat mengaksesnya.", + "description": "The unlisted content banner message" + }, + "theme.contentVisibility.draftBanner.title": { + "message": "Draft page", + "description": "The draft content banner title" + }, + "theme.contentVisibility.draftBanner.message": { + "message": "This page is a draft. It will only be visible in dev and be excluded from the production build.", + "description": "The draft content banner message" + }, + "theme.ErrorPageContent.tryAgain": { + "message": "Coba kembali", + "description": "The label of the button to try again rendering when the React error boundary captures an error" + }, + "theme.common.skipToMainContent": { + "message": "Lewati ke konten utama", + "description": "The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation" + }, + "theme.tags.tagsPageTitle": { + "message": "Tag", + "description": "The title of the tag list page" + }, + "Explore our comprehensive knowledge base tailored for both developers and users! Find in-depth technical information and helpful guides all about the Lisk blockchain.": { + "message": "Jelajahi basis pengetahuan komprehensif kami yang dirancang khusus untuk pengembang dan pengguna! Temukan informasi teknis mendalam dan panduan bermanfaat tentang blockchain Lisk." + }, + "Welcome to the Lisk Documentation ๐ŸŽ‰": { + "message": "Selamat datang di Dokumentasi Lisk ๐ŸŽ‰" + }, + "Let's build with Lisk ๐Ÿ› ": { + "message": "Mari membangun dengan Lisk ๐Ÿ› " + }, + "Lisk offers a highly efficient, lightning-fast, and easily scalable Layer 2 (L2) network built on Optimism (OP) and secured by Ethereum.": { + "message": "Lisk menawarkan jaringan Layer 2 (L2) yang sangat efisien, sangat cepat, dan mudah diskalakan yang dibangun di atas Optimism (OP) dan diamankan oleh Ethereum." + }, + "EXPLORE": { + "message": "MENGEKSPLORASI" + }, + "Lisk offers low-cost transactions, EVM compatibility, and support for all major developer frameworks, making it the top choice for developers. Join Lisk to access essential technical materials for your development journey.": { + "message": "Lisk menawarkan transaksi berbiaya rendah, kompatibilitas EVM, dan dukungan untuk semua kerangka kerja pengembang utama, menjadikannya pilihan utama bagi para pengembang. Bergabunglah dengan Lisk untuk mengakses materi teknis penting bagi perjalanan pengembangan Anda." + }, + "GET STARTED": { + "message": "MEMULAI" + }, + "to support the development of products and advocate for the principles of a decentralized world and inclusivity.": { + "message": "untuk mendukung pengembangan produk dan mengadvokasi prinsip-prinsip dunia yang terdesentralisasi dan inklusivitas." + }, + "LEARN MORE": { + "message": "PELAJARI LEBIH LANJUT" + }, + "Lisk embraces the superchain framework, offering decentralized governance and an interoperable ecosystem. We provide": { + "message": "Lisk menggunakan kerangka kerja superchain, menawarkan tata kelola yang terdesentralisasi dan ekosistem yang dapat dioperasikan bersama. Kami menyediakan" + }, + "grant programs": { + "message": "program hibah" + }, + "What is Lisk?": { + "message": "Apa itu Lisk?" + }, + "Build with Lisk": { + "message": "Membangun dengan Lisk" + }, + "Ecosystem for the future": { + "message": "Ekosistem untuk masa depan" + } +} diff --git a/i18n/ind/docusaurus-plugin-content-docs/current.json b/i18n/ind/docusaurus-plugin-content-docs/current.json new file mode 100644 index 000000000..dfa304a64 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current.json @@ -0,0 +1,54 @@ +{ + "version.label": { + "message": "Next", + "description": "The label for version current" + }, + "sidebar.documentationSidebar.category.About Lisk": { + "message": "Tentang Lisk", + "description": "The label for category About Lisk in sidebar documentationSidebar" + }, + "sidebar.documentationSidebar.category.Building on Lisk": { + "message": "Membangun di Lisk", + "description": "The label for category Building on Lisk in sidebar documentationSidebar" + }, + "sidebar.documentationSidebar.category.Building on Lisk.link.generated-index.title": { + "message": "Membangun di Lisk", + "description": "The generated-index page title for category Building on Lisk in sidebar documentationSidebar" + }, + "sidebar.documentationSidebar.category.Building on Lisk.link.generated-index.description": { + "message": "Guides for developers to start building dApps on Lisk L2.", + "description": "The generated-index page description for category Building on Lisk in sidebar documentationSidebar" + }, + "sidebar.documentationSidebar.category.Deploying a Smart Contract": { + "message": "Menerapkan Kontrak Cerdas", + "description": "The label for category Deploying a Smart Contract in sidebar documentationSidebar" + }, + "sidebar.documentationSidebar.category.Bridging an L1 token to Lisk": { + "message": "Menjembatani token L1 ke Lisk", + "description": "The label for category Bridging an L1 token to Lisk in sidebar documentationSidebar" + }, + "sidebar.documentationSidebar.category.Interacting with the blockchain": { + "message": "Berinteraksi dengan blockchain", + "description": "The label for category Interacting with the blockchain in sidebar documentationSidebar" + }, + "sidebar.documentationSidebar.category.Lisk Tools": { + "message": "Alat Lisk", + "description": "The label for category Lisk Tools in sidebar documentationSidebar" + }, + "sidebar.documentationSidebar.category.Lisk L1 legacy chain": { + "message": "Lisk L1 legacy chain", + "description": "The label for category Lisk L1 legacy chain in sidebar documentationSidebar" + }, + "sidebar.userSidebar.category.Using Lisk": { + "message": "Menggunakan Lisk", + "description": "The label for category Using Lisk in sidebar userSidebar" + }, + "sidebar.userSidebar.category.Governance": { + "message": "Governance", + "description": "The label for category Governance in sidebar userSidebar" + }, + "sidebar.userSidebar.category.Staking": { + "message": "Staking", + "description": "The label for category Staking in sidebar userSidebar" + } +} diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/about-lisk/_category_.json b/i18n/ind/docusaurus-plugin-content-docs/current/about-lisk/_category_.json new file mode 100644 index 000000000..6561410b6 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/about-lisk/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "About Lisk", + "position": 2, + "link": { + "type": "generated-index", + "description": "A short introduction to Lisk." + } +} \ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/about-lisk/fees.md b/i18n/ind/docusaurus-plugin-content-docs/current/about-lisk/fees.md new file mode 100644 index 000000000..eacd04cfe --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/about-lisk/fees.md @@ -0,0 +1,161 @@ +--- +title: Fees +sidebar_position: 1 +slug: /fees +description: Documentation about network fees on Lisk. This page covers details of the two-component cost system involving L2 execution fees and L1 data fees, and offers insights on fee variations and cost-saving strategies. +keywords: + [ + Lisk fees, + transaction fees, + network fees, + Lisk network fees, + L2 execution fee, + L1 security fee, + L1 data fee, + transaction costs, + gas fees, + fee calculation, + cost-saving, + transaction timing, + fee variations, + Lisk platform, + ] +--- + +# Fees + +Fees on Lisk Mainnet are, for the most part, significantly lower than on the L1 Ethereum network. +The low transaction fees can be provided because Lisk is a [Layer 2 optimistic rollup](https://ethereum.org/en/developers/docs/scaling/optimistic-rollups) network. + +## Gas tracker + +To track the current and past gas fees on Lisk, check the gas tracker for the respective network on Blockscout: + +- Lisk Mainnet: https://blockscout.lisk.com/gas-tracker +- Lisk Sepolia Testnet: https://sepolia-blockscout.lisk.com/gas-tracker + + +## How are fees on Lisk calculated? + +Every Lisk Mainnet transaction has two costs: An **L2 execution fee** and an **L1 data fee**. +At a high level, the L2 fee is the cost to execute your transaction on L2 and the L1 fee is the estimated cost to publish your transaction on L1 (in a rollup batch). + +```text +transaction_fee = l2_execution_fee + l1_data_fee +``` + +:::note +Lisk's fee calculation is based on the fee system of OP Mainnet, using the latest **Fjord** upgrade. +Check the [Fees page](https://docs.optimism.io/stack/transactions/fees#fjord) in the Optmism documentation, to learn more about how the fee system works in detail. +::: + +### L2 Execution Fee +The [L2 Execution Fee](https://docs.optimism.io/stack/transactions/fees#execution-gas-fee) is equal to the amount of gas used by the transaction multiplied by the gas price attached to the transaction. + +``` +l2_execution_fee = transaction_gas_price * l2_gas_used +``` + +Because Lisk Mainnet is EVM equivalent, the **gas used** by a transaction on Lisk Mainnet is **exactly the same** as the gas used by the same transaction on Ethereum. +If a transaction costs 100,000 gas units on Ethereum, it will cost 100,000 gas units on Lisk Mainnet. +**The only difference is that the gas price on Lisk Mainnet is much lower** than the gas price on Ethereum so you'll end up paying much less in ETH. +This also means that the total cost of the L2 Execution Fee of a transaction can be estimated using the same tools you would use to estimate the cost of a transaction on Ethereum. + + +#### L2 Execution Fee calculation +The transaction gas price is the sum of the [Base Fee](https://ethereum.org/en/developers/docs/gas/#base-fee) and the optional additional [Priority Fee](https://ethereum.org/en/developers/docs/gas/#priority-fee). + +``` +transaction_gas_price = l2_base_fee + l2_priority_fee +``` + +Like Ethereum, Lisk Mainnet uses the [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) mechanism to set the Base Fee for transactions (although with [different parameter values](#eip-1559-parameters) compared to Ethereum). + +You can read more about how Ethereum's gas fees work over on [Ethereum.org](https://ethereum.org/en/developers/docs/gas/). + +### L1 Data Fee +The [L1 Data Fee](https://docs.optimism.io/stack/transactions/fees#l1-data-fee) is the only part of the Lisk Mainnet transaction fee that differs from the Ethereum transaction fee. +This fee arises from the fact that the transaction data for all Lisk Mainnet transactions is published to Ethereum. +This guarantees that the transaction data is available for nodes to download and execute. + +The L1 Data Fee is automatically charged for any transaction that is included in a Lisk Mainnet block. +It is deducted directly from the address that sent the transaction. + +The L1 Data Fee is most heavily influenced by the Ethereum base fee that is continuously and trustlessly relayed from Ethereum to Lisk Mainnet. + +The actual amount of this fee depends on the following input values: + +1. The **signed transaction**, serialized according to the standard Ethereum transaction RLP encoding. +2. The **current Ethereum base fee** and/or blob base fee (trustlessly relayed from Ethereum). +3. Two **scalar parameters** that independently scale the base fee and blob base fee. + +#### L1 Data Fee calculation +The L1 data fee is calculated according to the following formula: + +``` +l1_data_fee = estimatedSize * weighted_gas_price +``` + +Here `estimatedSize` is an estimation of the size that the transaction will occupy when posted in Ethereum L1 blobs. +Itโ€™s calculated based on the size of the serialized transaction, using a linear regression model based on historical OP Mainnet data, assuming that itโ€™s compressed with Brotli compression. +For more details see the [OP documentation](https://docs.optimism.io/stack/transactions/fees#fjord) or the [smart contract code](https://github.com/ethereum-optimism/optimism/blob/e00f23ad0208f2e35aef5435d8a3d2e369144419/packages/contracts-bedrock/src/L2/GasPriceOracle.sol#L203). + +Next, the two scalars are applied to the base fee and blob base fee parameters to compute a weighted gas price multiplier. + +``` +weighted_gas_price = 16*base_fee_scalar*base_fee + blob_base_fee_scalar*blob_base_fee +``` + +The current values for the scalars are: + + - `base_fee_scalar` = 0.020698 + - `blob_base_fee_scalar` = 1.364961 + +They can be adjusted depending on network conditions, to mitigate spikes in the transaction fees. + +:::note + +It is currently **not** possible to limit the maximum L1 Data Fee that a transaction is willing to pay. + +For further information about transaction fees, please check the [Optimism Developer Docs > Transaction Fees](https://docs.optimism.io/stack/transactions/fees) + +::: + +## EIP-1559 Parameters + +The [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) parameters used by the Lisk Mainnet differ from those used by Ethereum as follows: + +| Parameter | Lisk Mainnet value | Ethereum value (for reference) | +| ------------------------------------- | ---------------: | -----------------------------: | +| Block gas limit | 30,000,000 gas | 30,000,000 gas | +| Block gas target | 1,500,000 gas | 15,000,000 gas | +| EIP-1559 elasticity multiplier | 20 | 2 | +| EIP-1559 denominator | 1,000 | 8 | +| Maximum base fee increase (per block) | 1.9% | 12.5% | +| Maximum base fee decrease (per block) | 0.1% | 12.5% | +| Block time in seconds | 2 | 12 | + + +## How do fluctuations in gas price on Ethereum (L1) affect transaction costs on Lisk (L2)? + +While the L1 Data Fee will be always cheaper compared to posting the transaction directly to the Ethereum mainnet (due to the efficient encoding in batching transactions), its value will vary depending on the amount of transactions on the L1. +If the timing of your transaction is flexible, you can save cost by submitting transactions during periods when gas prices on L1 are lower than usual for example, over the weekend. + +Changes after the transaction is processed on the sequencer do not affect the cost the user pays. + +For an L2 transaction, the normal process is: + +1. The wallet estimates the cost of the transaction and shows it to the user. +2. The user then submits the transaction. +3. The sequencer processes the transaction in two phases. + - First, it processes the transaction. + - Then, it deducts the gas cost, based on the L1 and L2 gas prices at that time. +4. After that, the transaction is written to L1. + +In principle, between steps 1 and 3 the gas price might change. +However, it can not increase by more than 12.5%, therefore the difference between the price shown to the user in step 1 and the actual one is bounded by 12.5%. +After step 3, the finality of the transaction is Lisk's responsibility. +If the L1 gas price spikes, Lisk pays the new cost. + +In conclusion, the user will pay at most 12.5% more than expected. +See the [Optimism Docs > Transaction Fees](https://docs.optimism.io/stack/transactions/fees#mechanism) for more information about transaction fees. diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/about-lisk/network-info.md b/i18n/ind/docusaurus-plugin-content-docs/current/about-lisk/network-info.md new file mode 100644 index 000000000..712af24c5 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/about-lisk/network-info.md @@ -0,0 +1,50 @@ +--- +id: network-info +title: Network information, official explorers & faucets +sidebar_position: 1 +slug: /network-info +description: 'Network information, official explorers, and faucets available for Lisk L2 network.' +keywords: + [ + 'network information', + 'Lisk Testnet', + 'Sepolia', + 'faucet', + 'block explorer', + ] +toc_max_heading_level: 4 +--- + +# Network information, official explorers & faucets +A reference page containing information about all the networks supported by Lisk L2, the explorers where one can see all the blockchain data, and the faucets to seed testnet accounts. + +## Network information +The Lisk L2 is available on the following network: + +### Lisk Mainnet + +| Name | Value | +| :-------------- | :-------------------------------------------------------------------------- | +| **Network Name** | Lisk | +| **HTTP RPC Endpoint** | [https://rpc.api.lisk.com](https://rpc.api.lisk.com) | +| **WS RPC Endpoint** | [wss://ws.api.lisk.com](wss://ws.api.lisk.com) | +| **Chain ID** | 1135 | +| **Currency Symbol** | ETH | +| **Block Explorer** | https://blockscout.lisk.com | +| **Block Explorer API** | https://blockscout.lisk.com/api | +| **Lisk Bridge** | https://bridge.lisk.com | + +### Lisk Sepolia Testnet + +| Name | Value | +| :-------------- | :-------------------------------------------------------------------------- | +| **Network Name** | Lisk Sepolia Testnet | +| **HTTP RPC Endpoint** | [https://rpc.sepolia-api.lisk.com](https://rpc.sepolia-api.lisk.com) | +| **WS RPC Endpoint** | [wss://ws.sepolia-api.lisk.com](wss://ws.sepolia-api.lisk.com) | +| **Chain ID** | 4202 | +| **Currency Symbol** | ETH | +| **Block Explorer** | https://sepolia-blockscout.lisk.com | +| **Block Explorer API** | https://sepolia-blockscout.lisk.com/api | +| **Lisk Testnet Bridge** | https://sepolia-bridge.lisk.com | +| **Lisk Testnet Faucet** (Grants LSK) | https://sepolia-faucet.lisk.com/ | +| **Superchain Testnet Faucet** (Grants ETH ) | https://app.optimism.io/faucet | \ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/_category_.json b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/_category_.json new file mode 100644 index 000000000..3b79e91a3 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Building on Lisk", + "position": 3, + "link": { + "type": "generated-index", + "description": "Guides for developers wanting to build on Lisk L2." + } +} \ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/add-token-to-lisk/custom-token.mdx b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/add-token-to-lisk/custom-token.mdx new file mode 100644 index 000000000..092afceeb --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/add-token-to-lisk/custom-token.mdx @@ -0,0 +1,241 @@ +--- +title: Deploying a custom token +slug: /building-on-lisk/add-token-to-lisk/custom-token +description: 'Learn how to bridge your custom ERC-20 token to Lisk using the standard bridge.' +keywords: + [ + 'ERC-20 contract', + 'Custom token', + 'Lisk Testnet', + 'Sepolia', + 'Ethereum', + 'Lisk Sepolia', + 'Lisk', + 'Lisk mainnet', + 'Optimism Superchain token list', + ] +--- + +# Deploying your Custom ERC-20 token to Lisk + +{/* :::info +**This tutorial is for developers who want to bridge a new Custom ERC-20 token to Lisk Mainnet.** +If you want to bridge existing tokens, you can follow the tutorial on [Bridging ERC-20 tokens with the Optimism SDK](https://docs.optimism.io/builders/app-developers/tutorials/cross-dom-bridge-erc20). +::: */} + +In this tutorial, you will learn how to bridge a custom ERC-20 token from Ethereum or Sepolia to the Lisk or Lisk Sepolia network, respectively. +By using the [Standard Bridge system](https://docs.optimism.io/builders/dapp-developers/bridging/standard-bridge), this tutorial is meant for developers who already have an existing ERC-20 token on Ethereum and want to create a bridged representation of that token on Lisk. + +Learn step-by-step how you can create a custom token that conforms to the [`IOptimismMintableERC20`](https://github.com/ethereum-optimism/optimism/blob/v1.1.4/packages/contracts-bedrock/src/universal/IOptimismMintableERC20.sol) interface so that it can be used with the Standard Bridge system. +A custom token allows you to do things like trigger extra logic whenever a token is deposited. +If you don't need extra functionality like this, consider following the tutorial on [Deploying your Standard ERC-20 token to Lisk](./standard-token) instead. + +## Prerequisites + +:::note +You can deploy your **Custom ERC-20** token on Lisk Mainnet by adopting the same process. +For deploying to mainnet, ensure that your wallet has enough ETH. + +The subsequent text contains commands for both Lisk and Lisk Sepolia for your ease. +For more information, see the [available Lisk networks](/network-info) and [how to connect a wallet with them](/user/connecting-to-a-wallet). +::: + +### Get ETH on Sepolia and Lisk Sepolia + +You will need to get some ETH on both, Sepolia and Lisk Sepolia networks. + +:::info +You can use [ETH Sepolia Faucet](https://sepoliafaucet.com/) to get ETH on Sepolia. +You can use the [Superchain Faucet](https://app.optimism.io/faucet?utm_source=docs) to get ETH on Lisk Sepolia. +::: + +### Add Lisk Sepolia to Your Wallet + +This tutorial uses [Remix](https://remix.ethereum.org) to deploy contracts. +You will need to add the Lisk or Lisk Sepolia network to your wallet in order to follow this tutorial. +Please follow the [How to connect Lisk to a wallet](/user/connecting-to-a-wallet) guide, to connect your wallet to Lisk or Lisk Sepolia network. + +### Get an L1 ERC-20 Token Address + +You will need an L1 ERC-20 token for this tutorial. +If you already have an L1 ERC-20 token deployed on Ethereum Mainnet or Sepolia, you can skip this step. +For Sepolia, you can use the testing token located at [`0x5589BB8228C07c4e15558875fAf2B859f678d129`](https://sepolia.etherscan.io/address/0x5589BB8228C07c4e15558875fAf2B859f678d129) that includes a `faucet()` function that can be used to mint tokens. + +## Create an L2 ERC-20 Token + +Once you have an L1 ERC-20 token, you can create a corresponding L2 ERC-20 token on Lisk or Lisk Sepolia network. +This tutorial uses [Remix](https://remix.ethereum.org), so you can easily deploy a token without a framework like [Hardhat](https://hardhat.org) or [Foundry](https://getfoundry.sh). +You can follow the same general process within your favorite framework if you prefer. + +In this section, you'll be creating an ERC-20 token that can be deposited but cannot be withdrawn. +This is just one example of the endless ways in which you could customize your L2 token. + +### 1. Open Remix + +Navigate to [Remix](https://remix.ethereum.org) in your browser. + +### 2. Create a new file + +Click the ๐Ÿ“„ ("Create new file") button to create a new empty Solidity file. +You can name this file whatever you'd like, e.g. `custom-token.sol`. + +### 3. Copy the example contract + +Copy the following example contract into your new file: + +
+custom-token.sol +```solidity +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; +import { IOptimismMintableERC20 } from "https://github.com/ethereum-optimism/optimism/blob/v1.1.4/packages/contracts-bedrock/src/universal/IOptimismMintableERC20.sol"; + +contract MyCustomL2Token is IOptimismMintableERC20, ERC20 { + /// @notice Address of the corresponding version of this token on the remote chain. + address public immutable REMOTE_TOKEN; + + /// @notice Address of the StandardBridge on this network. + address public immutable BRIDGE; + + /// @notice Emitted whenever tokens are minted for an account. + /// @param account Address of the account tokens are being minted for. + /// @param amount Amount of tokens minted. + event Mint(address indexed account, uint256 amount); + + /// @notice Emitted whenever tokens are burned from an account. + /// @param account Address of the account tokens are being burned from. + /// @param amount Amount of tokens burned. + event Burn(address indexed account, uint256 amount); + + /// @notice A modifier that only allows the bridge to call. + modifier onlyBridge() { + require(msg.sender == BRIDGE, "MyCustomL2Token: only bridge can mint and burn"); + _; + } + + /// @param _bridge Address of the L2 standard bridge. + /// @param _remoteToken Address of the corresponding L1 token. + /// @param _name ERC20 name. + /// @param _symbol ERC20 symbol. + constructor( + address _bridge, + address _remoteToken, + string memory _name, + string memory _symbol + ) + ERC20(_name, _symbol) + { + REMOTE_TOKEN = _remoteToken; + BRIDGE = _bridge; + } + + /// @custom:legacy + /// @notice Legacy getter for REMOTE_TOKEN. + function remoteToken() public view returns (address) { + return REMOTE_TOKEN; + } + + /// @custom:legacy + /// @notice Legacy getter for BRIDGE. + function bridge() public view returns (address) { + return BRIDGE; + } + + /// @notice ERC165 interface check function. + /// @param _interfaceId Interface ID to check. + /// @return Whether or not the interface is supported by this contract. + function supportsInterface(bytes4 _interfaceId) external pure virtual returns (bool) { + bytes4 iface1 = type(IERC165).interfaceId; + // Interface corresponding to the updated OptimismMintableERC20 (this contract). + bytes4 iface2 = type(IOptimismMintableERC20).interfaceId; + return _interfaceId == iface1 || _interfaceId == iface2; + } + + /// @notice Allows the StandardBridge on this network to mint tokens. + /// @param _to Address to mint tokens to. + /// @param _amount Amount of tokens to mint. + function mint( + address _to, + uint256 _amount + ) + external + virtual + override(IOptimismMintableERC20) + onlyBridge + { + _mint(_to, _amount); + emit Mint(_to, _amount); + } + + /// @notice Prevents tokens from being withdrawn to L1. + function burn( + address, + uint256 + ) + external + virtual + override(IOptimismMintableERC20) + onlyBridge + { + revert("MyCustomL2Token cannot be withdrawn"); + } +} +``` +
+ +### 4. Review the example contract + +Take a moment to review the example contract. +It's almost the same as the standard [`OptimismMintableERC20`](https://github.com/ethereum-optimism/optimism/blob/v1.1.4/packages/contracts-bedrock/src/universal/OptimismMintableERC20.sol) contract except that the `_burn` function has been made to always revert. + +The contract for the custom token inherits from the [`IOptimismMintableERC20`](https://github.com/ethereum-optimism/optimism/blob/v1.1.4/packages/contracts-bedrock/src/universal/IOptimismMintableERC20.sol) interface and the `ERC20` contract. +The constructor takes the address of the L2 standard bridge, the address of the corresponding L1 token, the name of the ERC20 token, and the symbol of the ERC20 token. +The `mint` function allows the bridge to mint tokens for users. +Since the bridge needs to burn tokens when users want to withdraw them to L1, this means that users will not be able to withdraw tokens from this contract, which is what we intend for this example. + +```solidity +/// @notice Prevents tokens from being withdrawn to L1. +function burn( + address, + uint256 +) + external + virtual + override(IOptimismMintableERC20) + onlyBridge +{ + revert("MyCustomL2Token cannot be withdrawn"); +} +``` + +### 5. Compile the contract + +Save the file to automatically compile the contract. +If you've disabled auto-compile, you'll need to manually compile the contract by clicking the "Solidity Compiler" tab (this looks like the letter "S") and pressing the blue "Compile" button. + +### 6. Deploy the contract + +Open the deployment tab (this looks like an Ethereum logo with an arrow pointing right). +Make sure that your environment is set to "Injected Provider", your wallet is connected to Lisk or Lisk Sepolia network, and Remix has access to your wallet. +Then, select the `MyCustomL2Token` contract from the deployment dropdown and deploy it with the following parameters: + +```text +_BRIDGE: "0x4200000000000000000000000000000000000007" +_REMOTETOKEN: "" +_NAME: "My Custom Lisk L2 Token" +_SYMBOL: "MCL2T" +``` + +:::tip +If you used the testing token described in step [Get an L1 ERC-20 Token Address](#get-an-l1-erc-20-token-address), use the address `0x5589BB8228C07c4e15558875fAf2B859f678d129` for the `_REMOTETOKEN` parameter. +::: + +{/* ## Bridge Some Tokens + +Now that you have an L2 ERC-20 token, you can bridge some tokens from L1 to L2. +Check out the tutorial on [Bridging ERC-20 tokens with the Optimism SDK](https://docs.optimism.io/builders/app-developers/tutorials/cross-dom-bridge-erc20) to learn how to bridge your L1 ERC-20 to Lisk using the Optimism SDK. +Remember that the withdrawal step will *not* work for the token you just created! +This is exactly what this tutorial was meant to demonstrate. */} \ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/add-token-to-lisk/index.md b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/add-token-to-lisk/index.md new file mode 100644 index 000000000..2b0a9a0fb --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/add-token-to-lisk/index.md @@ -0,0 +1,94 @@ +--- +title: Introduction +sidebar_position: 1 +slug: /building-on-lisk/add-token-to-lisk +description: 'Guide to adding external ERC-20 contracts deployed on Ethereum to Lisk network.' +keywords: + [ + 'ERC-20 contract', + 'Lisk Testnet', + 'Sepolia', + 'Ethereum', + 'Lisk Mainnet', + 'Lisk', + 'Optimism Superchain token list', + ] +--- + +# Bridging an L1 token to Lisk +This page is intended for token issuers who already have an ERC-20 contract deployed on Ethereum and would like to submit their token for bridging between Ethereum and Lisk. +Lisk uses the Superchain Token List as a reference for tokens that have been deployed on Lisk. + +## Superchain Token List +The [Superchain Token List](https://github.com/ethereum-optimism/ethereum-optimism.github.io) exists to help users discover the correct bridged token addresses for any given native token. + +Consider checking this list to make sure that you're not using the wrong bridged representation of a token when bridging a native token. + + +:::warning +Lisk does not endorse any of the tokens that are listed in the [**ethereum-optimism.github.io**](https://github.com/ethereum-optimism/ethereum-optimism.github.io) repository and relies on the preliminary checks put in place, listed on the repository. +::: + +Developers who are creating their own bridged tokens should consider [adding their token to the list](#adding-your-token-to-the-superchain-token-list). + +Tokens on the Superchain Token List will automatically appear on certain tools like the [Superchain Bridges UI](https://app.optimism.io/bridge). +However, tokens are not necessarily listed on the [Lisk Bridge UI](https://bridge.lisk.com/bridge/lisk); their listing is neither guaranteed nor automatic. +Lisk Bridge reviews are conducted manually by the Lisk team. + +## The Standard Bridge +Before a token native to one chain can be bridged to the other chain, a bridged representation of that token must be created on the receiving side. +The [Standard Bridge](https://docs.optimism.io/builders/app-developers/bridging/standard-bridge) allows users to convert tokens that are native to one chain (like Ethereum) into a representation of those tokens on the other chain (like Lisk). +Users can then convert these bridged representations back into their original native tokens at any time. + +:::tip +This bridging mechanism functions identically in both directions โ€” tokens native to Lisk can be bridged to Ethereum, just like tokens native to Ethereum can be bridged to Lisk. +::: + +A bridged representation of a token is an ERC-20 token that implements the `IOptimismMintableERC20`[^1] interface. +A native token may have more than one bridged representation at the same time. +Users must always specify which bridged token they wish to use when using the bridge; see [Superchain Token List](#superchain-token-list). +Different bridged representations of the same native token are considered entirely independent tokens. + +The Standard Bridge is a simple smart contract, with the functionality to move ERC-20 tokens between Lisk and Ethereum. + +The protocol consists of two pertinent contracts: + +- A bridge contract deployed to **Ethereum**, called [L1StandardBridge](https://etherscan.io/address/0x2658723Bf70c7667De6B25F99fcce13A16D25d08). +- A bridge contract deployed to **Lisk**, called [L2StandardBridge](https://blockscout.lisk.com/address/0x4200000000000000000000000000000000000010). + +These two contracts interact with one another via the `CrossDomainMessenger` system for sending messages between Ethereum and Lisk. + +[^1]: The `IOptimismMintableERC20` interface is a superset of the [standard ERC-20 interface](https://eips.ethereum.org/EIPS/eip-20) and includes functions that allow the bridge to properly verify deposits/withdrawals and mint/burn tokens as needed. +All bridged versions of tokens must implement this interface in order to be bridged with the [Standard Bridge](#the-standard-bridge) system. +Native tokens do not need to implement this interface. + + +## Adding your token to the Superchain Token List + +Lisk uses the [Superchain Token List](https://github.com/ethereum-optimism/ethereum-optimism.github.io/blob/master/optimism.tokenlist.json) as a reference for tokens that have been deployed on Lisk. + +To add your token to the list, perform the following steps. + +### Step 1: Deploy your token on Lisk +Select your preferred bridging framework and use it to deploy an ERC-20 for your token on Lisk. +We recommend you use the framework provided by Lisk's [standard bridge](#the-standard-bridge) contracts and, furthermore, deploy your token using the [OptimismMintableERC20Factory](https://docs.lisk.com/contracts#lisk-network-l2). +Deploying your token on Lisk in this manner provides us with guarantees that will smooth the approval process. +If you choose a different bridging framework, its interface must be compatible with that of the standard bridge. +Otherwise, it may be difficult for us to support them. + +For step-by-step instructions on how to deploy ERC-20 tokens on Lisk, check the following guides: + +- [Deploying a Standard ERC-20 token](./standard-token.md) +- [Deploying a Custom ERC-20 token](./custom-token.mdx) + +### Step 2: Submit details of your token +Follow the instructions in the [GitHub repository](https://github.com/ethereum-optimism/ethereum-optimism.github.io) and submit a PR containing the required details for your token. + +**Important:** You must specify in your token's `data.json` file a section for `lisk-sepolia` and/or `lisk`. + +[This PR](https://github.com/ethereum-optimism/ethereum-optimism.github.io/pull/899) shows the changes necessary to add the LSK token to the Superchain Token Registry. +The change you need to submit is particularly simple if your token has already been added to the Superchain Token Registry. +For example, [this PR](https://github.com/ethereum-optimism/ethereum-optimism.github.io/commit/27ab9b2d3388f7feba3a152e0a0748c73d732a68) shows the change required for cbETH, which was already on Superchain Token Registry and relies on the Base standard bridge. + +### Step 3: Await final approval +Reviews are regularly conducted by the Lisk team and you should receive a reply within 24-72 hours (depending on if the PR is opened on a weekday, weekend or holiday). diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/add-token-to-lisk/standard-token.md b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/add-token-to-lisk/standard-token.md new file mode 100644 index 000000000..826c29ba6 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/add-token-to-lisk/standard-token.md @@ -0,0 +1,144 @@ +--- +title: Deploying a standard token +slug: /building-on-lisk/add-token-to-lisk/standard-token +description: 'Learn how to add your standard ERC-20 token to Lisk using the standard bridge.' +keywords: + [ + 'ERC-20 contract', + 'Standard token', + 'Lisk Testnet', + 'Sepolia', + 'Ethereum', + 'Lisk Sepolia', + 'Optimism Superchain token list', + ] +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Deploying your Standard ERC-20 token to Lisk + + + +In this tutorial, you'll learn how to bridge a standard ERC-20 token from Ethereum to Lisk using the [Standard Bridge system](https://docs.optimism.io/builders/dapp-developers/bridging/standard-bridge). +This tutorial is meant for developers who already have an existing ERC-20 token on Ethereum and want to create a bridged representation of that token on Lisk. + +This tutorial explains how to use the [`OptimismMintableERC20Factory`](https://github.com/ethereum-optimism/optimism/blob/186e46a47647a51a658e699e9ff047d39444c2de/packages/contracts-bedrock/contracts/universal/OptimismMintableERC20Factory.sol) to deploy a standardized ERC-20 token on Lisk or Lisk Sepolia network. +Tokens created by this factory contract are compatible with the Standard Bridge system and include basic logic for deposits, transfers, and withdrawals. +If you want to include specialized logic within your L2 token, see the tutorial on [Bridging Your Custom ERC-20 Token to Lisk](./custom-token) instead. + +## Dependencies + +* [cast](https://book.getfoundry.sh/getting-started/installation) + +## Prerequisites + +:::note +You can deploy your **Standard ERC-20** token on Lisk Mainnet by adopting the same process. +For deploying to mainnet, ensure that your wallet has enough ETH. + +The subsequent text contains commands for both Lisk and Lisk Sepolia for your ease. +For more information, see the [available Lisk networks](/network-info) and [how to connect a wallet with them](/user/connecting-to-a-wallet). +::: + + +### Get ETH on Sepolia and Lisk Sepolia + +This tutorial explains how to create a bridged ERC-20 token on Lisk Sepolia. +You will need to get some ETH on both of these testnets. + +:::info +You can use [ETH Sepolia Faucet](https://sepoliafaucet.com/) to get ETH on Sepolia. +You can use the [Superchain Faucet](https://app.optimism.io/faucet?utm_source=docs) to get ETH on Lisk Sepolia. +::: + +### Get an L1 ERC-20 Token Address + +You will need an L1 ERC-20 token for this tutorial. +If you already have an L1 ERC-20 token deployed on Ethereum Mainnet or Sepolia, you can skip this step. +For Sepolia, you can use the testing token located at [`0x5589BB8228C07c4e15558875fAf2B859f678d129`](https://sepolia.etherscan.io/address/0x5589BB8228C07c4e15558875fAf2B859f678d129) that includes a `faucet()` function that can be used to mint tokens. + +## Create an L2 ERC-20 token + +Once you have an L1 ERC-20 token, you can use the [`OptimismMintableERC20Factory`](https://github.com/ethereum-optimism/optimism/blob/186e46a47647a51a658e699e9ff047d39444c2de/packages/contracts-bedrock/contracts/universal/OptimismMintableERC20Factory.sol) to create a corresponding L2 ERC-20 token on Lisk or Lisk Sepolia network. +All tokens created by the factory implement the `IOptimismMintableERC20` interface and are compatible with the Standard Bridge system. +To create an L2 ERC-20 token, do the following: + +### 1. Add a private key to your environment + +You'll need a private key in order to sign transactions. +Set your private key as an environment variable with the `export` command. +Make sure this private key corresponds to an address that has ETH on Lisk or Lisk Sepolia network. + +```bash +export TUTORIAL_PRIVATE_KEY=0x... +``` + +### 2. Add the Lisk RPC URL to your environment + +You'll need an RPC URL in order to connect to Lisk or Lisk Sepolia network. +Set your RPC URL as an environment variable with the `export` command. + + + + ```bash + export TUTORIAL_RPC_URL=https://rpc.api.lisk.com + ``` + + + ```bash + export TUTORIAL_RPC_URL=https://rpc.sepolia-api.lisk.com + ``` + + + + + +### 3. Add your L1 ERC-20 token address to your environment + +You'll need to know the address of your L1 ERC-20 token in order to create a bridged representation of it on Lisk or Lisk Sepolia network. +Set your L1 ERC-20 token address as an environment variable with the `export` command. + +```bash +# Replace this with your L1 ERC-20 token if not using the testing token! +export TUTORIAL_L1_ERC20_ADDRESS=0x5589BB8228C07c4e15558875fAf2B859f678d129 +``` + +### 4. Deploy your L2 ERC-20 token + +You can now deploy your L2 ERC-20 token using the [`OptimismMintableERC20Factory`](https://github.com/ethereum-optimism/optimism/blob/186e46a47647a51a658e699e9ff047d39444c2de/packages/contracts-bedrock/contracts/universal/OptimismMintableERC20Factory.sol). +Use the `cast` command to trigger the deployment function on the factory contract. +This example command creates a token with the name "My Standard Demo Token" and the symbol "L2TKN". +The resulting L2 ERC-20 token address is printed to the console. + +```bash +cast send 0x4200000000000000000000000000000000000012 "createOptimismMintableERC20(address,string,string)" $TUTORIAL_L1_ERC20_ADDRESS "My Standard Demo Token" "L2TKN" --private-key $TUTORIAL_PRIVATE_KEY --rpc-url $TUTORIAL_RPC_URL --json | jq -r '.logs[0].topics[2]' | cast parse-bytes32-address +``` + +If all goes well, it will respond with the address of the newly deployed contract: + +```text +0x891C582b83F69B7c2d3107cd73A3e491CB33962F +``` + +:::note[Using factories is **not** recommended for production] +Factories make it easy to deploy contracts out of the box. +The downside of this is, that you do not have control over the source code of the contract that is going to be deployed, as this is performed by the factory. + +Furthermore, it is not so straightforward to verify those contracts on Blockscout, as the source code of the contract is required for the verification. +::: + + + + \ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/bridged-tokens.md b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/bridged-tokens.md new file mode 100644 index 000000000..defafac86 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/bridged-tokens.md @@ -0,0 +1,32 @@ +--- +id: bridged-tokens +title: Bridged Token Addresses +sidebar_position: 2 +slug: /bridged-tokens +description: 'A reference page listing all tokens bridged to Lisk.' +keywords: + [ + 'Lisk', + 'Bridged tokens' + ] +--- + +# Bridged tokens + +This page summarizes officially reviewed tokens deployed on Lisk and their corresponding L1 addresses. + +The list is based on the [Superchain Token List](https://github.com/ethereum-optimism/ethereum-optimism.github.io). + +:::tip +If you want to add a token to the list, please check out the guide [Bridging an L1 token to Lisk](add-token-to-lisk/index.md). +::: + +## Lisk Mainnet + +| Bridged Tokens Mainnet | Symbol | L1 Token | L2 Token | +| :----------------- | :----- |:----------------- | :----------------- | + +## Lisk Sepolia + +| Bridged Tokens Sepolia | Symbol | L1 Token | L2 Token | +| :----------------- | :----- |:----------------- | :----------------- | diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/contracts.mdx b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/contracts.mdx new file mode 100644 index 000000000..037d32b1d --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/contracts.mdx @@ -0,0 +1,561 @@ +--- +id: contracts +title: Contracts +sidebar_position: 1 +slug: /contracts +description: 'A reference page listing all the contracts deployed concerning Lisk.' +keywords: + [ + 'Lisk', + 'Ethereum Sepolia Testnet', + 'Contracts', + 'L1', + 'L2', + 'Lisk Sepolia Testnet', + 'Predeployed', + ] +--- + +# Contracts +A reference page that includes information about all contracts deployed on various networks. + +## Ethereum network (L1) + +Details of smart contracts deployed on ๐ŸŸข **Ethereum Mainnet** and ๐ŸŸก **Sepolia Testnet** are as follows. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name of ContractDescriptionContract Address
ProxyAdminOwner of AddressManager, Admin of LiskPortal, SystemConfig, L2OutputOracle, L1StandardBridge.[0xeC432c4F1d0E12737f3a42a459B84848Af979b2d](https://etherscan.io/address/0xeC432c4F1d0E12737f3a42a459B84848Af979b2d)๐ŸŸข
[0x5Db9F05921d8d5a6a157F6f49c411cc0e46c6330](https://sepolia.etherscan.io/address/0x5Db9F05921d8d5a6a157F6f49c411cc0e46c6330)๐ŸŸก
SystemConfigIt contains configuration parameters such as the Sequencer address, the L2 gas limit, and the unsafe block signer address.[0x05f23282FFDCA8286E4738C1aF79079f3d843750](https://etherscan.io/address/0x05f23282ffdca8286e4738c1af79079f3d843750)๐ŸŸข
[0xF54791059df4a12BA461b881B4080Ae81a1d0AC0](https://sepolia.etherscan.io/address/0xF54791059df4a12BA461b881B4080Ae81a1d0AC0)๐ŸŸก
AddressManagerThe Address Manager is a built-in actor that manages Ethereum's address space.[0x2dF7057d3F25212E51aFEA8dA628668229Ea423f](https://etherscan.io/address/0x2dF7057d3F25212E51aFEA8dA628668229Ea423f)๐ŸŸข
[0x27Bb4A7cd8FB20cb816BF4Aac668BF841bb3D5d3](https://sepolia.etherscan.io/address/0x27Bb4A7cd8FB20cb816BF4Aac668BF841bb3D5d3)๐ŸŸก
L1ERC721BridgeHandles the sending and receiving of ERC 721 tokens between L1 and L2.[0x3A44A3b263FB631cdbf25f339e2D29497511A81f](https://etherscan.io/address/0x3A44A3b263FB631cdbf25f339e2D29497511A81f)๐ŸŸข
[0xb4E988CF1aD8C361D56118437502A8f11C7FaA01](https://sepolia.etherscan.io/address/0xb4E988CF1aD8C361D56118437502A8f11C7FaA01)๐ŸŸก
L2OutputOracleIt contains a list of proposed state roots that the Proposers assert to be a result of block execution. [0x113cB99283AF242Da0A0C54347667edF531Aa7d6](https://etherscan.io/address/0x113cB99283AF242Da0A0C54347667edF531Aa7d6)๐ŸŸข
[0xA0E35F56C318DE1bD5D9ca6A94Fe7e37C5663348](https://sepolia.etherscan.io/address/0xA0E35F56C318DE1bD5D9ca6A94Fe7e37C5663348)๐ŸŸก
OptimismPortalIt is the main entry point for depositing funds from L1 to L2. It also allows proving and finalizing withdrawals.[0x26dB93F8b8b4f7016240af62F7730979d353f9A7](https://etherscan.io/address/0x26dB93F8b8b4f7016240af62F7730979d353f9A7)๐ŸŸข
[0xe3d90F21490686Ec7eF37BE788E02dfC12787264](https://sepolia.etherscan.io/address/0xe3d90F21490686Ec7eF37BE788E02dfC12787264)๐ŸŸก
L1StandardBridgeIt is the main entry point for depositing ERC20 tokens from L1 to L2. This contract can store any token.[0x2658723Bf70c7667De6B25F99fcce13A16D25d08](https://etherscan.io/address/0x2658723Bf70c7667De6B25F99fcce13A16D25d08)๐ŸŸข
[0x1Fb30e446eA791cd1f011675E5F3f5311b70faF5](https://sepolia.etherscan.io/address/0x1Fb30e446eA791cd1f011675E5F3f5311b70faF5)๐ŸŸก
ProtocolVersionsIt is used to manage superchain protocol version information.[0xDd9C27910327d3f4A4007Ad8f7B53332DB6f1079](https://etherscan.io/address/0xDd9C27910327d3f4A4007Ad8f7B53332DB6f1079)๐ŸŸข
[0x1Bb17EB31bDdFd30F63D4FAe6c8Eb85D9e9b1f48](https://sepolia.etherscan.io/address/0x1Bb17EB31bDdFd30F63D4FAe6c8Eb85D9e9b1f48)๐ŸŸก
L1CrossDomainMessengerSends messages from L1 to L2 and relays messages from L2 onto L1.[0x31B72D76FB666844C41EdF08dF0254875Dbb7edB](https://etherscan.io/address/0x31B72D76FB666844C41EdF08dF0254875Dbb7edB)๐ŸŸข
[0x857824E6234f7733ecA4e9A76804fd1afa1A3A2C](https://sepolia.etherscan.io/address/0x857824E6234f7733ecA4e9A76804fd1afa1A3A2C)๐ŸŸก
OptimismMintableERC20FactoryIt is responsible for creating ERC20 contracts on L1 that can be used for depositing native L2 tokens into.[0xc1dA06CC5DD5cE23bABa924463de7F762039252d](https://etherscan.io/address/0xc1dA06CC5DD5cE23bABa924463de7F762039252d)๐ŸŸข
[0x269d632C1E518a922C30C749cFD3f82Eb5C779B0](https://sepolia.etherscan.io/address/0x269d632C1E518a922C30C749cFD3f82Eb5C779B0)๐ŸŸก
L1LiskTokenContains the implementation of LSK as an ERC20 token.[0x6033F7f88332B8db6ad452B7C6D5bB643990aE3f](https://etherscan.io/address/0x6033f7f88332b8db6ad452b7c6d5bb643990ae3f)๐ŸŸข
[0x16B840bA01e2b05fc2268eAf6d18892a11EC29D6](https://sepolia.etherscan.io/address/0x16b840ba01e2b05fc2268eaf6d18892a11ec29d6)๐ŸŸก
L1VestingWalletThis contract handles the Vesting functionality of the LSK token for the Ethereum network.[0xd590c2e71739c551eba7aebe00e7855df4cf5fb7](https://etherscan.io/address/0xd590c2e71739c551eba7aebe00e7855df4cf5fb7)๐ŸŸข
[0x76f1cD8436373fa9f3c17Da1e39740fE9dB9a04B](https://sepolia.etherscan.io/address/0x76f1cd8436373fa9f3c17da1e39740fe9db9a04b)๐ŸŸก
+ +## Lisk network (L2) + + +### Predeploys on Lisk + +A predeployed contract is included in the L2 genesis state, and it exists from the very beginning of the blockchain. +On Lisk Network, these contracts are located at specific addresses that are determined in advance and are part of the genesis state. +For more information on Predeploys, see [Predeploys' README](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/predeploys.md). + +Details of **predeployed** contracts deployed on ๐Ÿ”ต **Lisk Mainnet** and ๐ŸŸฃ **Lisk Sepolia Testnet** are as follows. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name of ContractContract Address
[**GasPriceOracle**](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/predeploys.md#gaspriceoracle)[0x420000000000000000000000000000000000000F](https://blockscout.lisk.com/address/0x420000000000000000000000000000000000000F)๐Ÿ”ต
[0x420000000000000000000000000000000000000F](https://sepolia-blockscout.lisk.com/address/0x420000000000000000000000000000000000000F)๐ŸŸฃ
[**WETH9**](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/predeploys.md#weth9)[0x4200000000000000000000000000000000000006](https://blockscout.lisk.com/address/0x4200000000000000000000000000000000000006)๐Ÿ”ต
[0x4200000000000000000000000000000000000006](https://sepolia-blockscout.lisk.com/address/0x4200000000000000000000000000000000000006)๐ŸŸฃ
[**L2CrossDomainMessenger**](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/predeploys.md#l2crossdomainmessenger)[0x4200000000000000000000000000000000000007](https://blockscout.lisk.com/address/0x4200000000000000000000000000000000000007)๐Ÿ”ต
[0x4200000000000000000000000000000000000007](https://sepolia-blockscout.lisk.com/address/0x4200000000000000000000000000000000000007)๐ŸŸฃ
[**L2StandardBridge**](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/predeploys.md#l2standardbridge)[0x4200000000000000000000000000000000000010](https://blockscout.lisk.com/address/0x4200000000000000000000000000000000000010)๐Ÿ”ต
[0x4200000000000000000000000000000000000010](https://sepolia-blockscout.lisk.com/address/0x4200000000000000000000000000000000000010)๐ŸŸฃ
[**SequencerFeeVault**](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/predeploys.md#sequencerfeevault)[0x4200000000000000000000000000000000000011](https://blockscout.lisk.com/address/0x4200000000000000000000000000000000000011)๐Ÿ”ต
[0x4200000000000000000000000000000000000011](https://sepolia-blockscout.lisk.com/address/0x4200000000000000000000000000000000000011)๐ŸŸฃ
[**OptimismMintableERC20Factory**](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/predeploys.md#optimismmintableerc20factory)[0x4200000000000000000000000000000000000012](https://blockscout.lisk.com/address/0x4200000000000000000000000000000000000012)๐Ÿ”ต
[0x4200000000000000000000000000000000000012](https://sepolia-blockscout.lisk.com/address/0x4200000000000000000000000000000000000012)๐ŸŸฃ
[**L1Block**](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/predeploys.md#l1block)[0x4200000000000000000000000000000000000015](https://blockscout.lisk.com/address/0x4200000000000000000000000000000000000015)๐Ÿ”ต
[0x4200000000000000000000000000000000000015](https://sepolia-blockscout.lisk.com/address/0x4200000000000000000000000000000000000015)๐ŸŸฃ
[**L2ToL1MessagePasser**](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/predeploys.md#l2tol1messagepasser)[0x4200000000000000000000000000000000000016](https://blockscout.lisk.com/address/0x4200000000000000000000000000000000000016)๐Ÿ”ต
[0x4200000000000000000000000000000000000016](https://sepolia-blockscout.lisk.com/address/0x4200000000000000000000000000000000000016)๐ŸŸฃ
[**OptimismMintableERC721Factory**](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/predeploys.md#optimismmintableerc721factory)[0x4200000000000000000000000000000000000017](https://blockscout.lisk.com/address/0x4200000000000000000000000000000000000017)๐Ÿ”ต
[0x4200000000000000000000000000000000000017](https://sepolia-blockscout.lisk.com/address/0x4200000000000000000000000000000000000017)๐ŸŸฃ
[**ProxyAdmin**](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/predeploys.md#proxyadmin)[0x4200000000000000000000000000000000000018](https://blockscout.lisk.com/address/0x4200000000000000000000000000000000000018)๐Ÿ”ต
[0x4200000000000000000000000000000000000018](https://sepolia-blockscout.lisk.com/address/0x4200000000000000000000000000000000000018)๐ŸŸฃ
[**BaseFeeVault**](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/predeploys.md#basefeevault)[0x4200000000000000000000000000000000000019](https://blockscout.lisk.com/address/0x4200000000000000000000000000000000000019)๐Ÿ”ต
[0x4200000000000000000000000000000000000019](https://sepolia-blockscout.lisk.com/address/0x4200000000000000000000000000000000000019)๐ŸŸฃ
[**L1FeeVault**](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/predeploys.md#l1feevault)[0x420000000000000000000000000000000000001a](https://blockscout.lisk.com/address/0x420000000000000000000000000000000000001a)๐Ÿ”ต
[0x420000000000000000000000000000000000001a](https://sepolia-blockscout.lisk.com/address/0x420000000000000000000000000000000000001a)๐ŸŸฃ
[**SchemaRegistry**](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/predeploys.md#schemaregistry)[0x4200000000000000000000000000000000000020](https://blockscout.lisk.com/address/0x4200000000000000000000000000000000000020)๐Ÿ”ต
[0x4200000000000000000000000000000000000020](https://sepolia-blockscout.lisk.com/address/0x4200000000000000000000000000000000000020)๐ŸŸฃ
[**EAS**](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/predeploys.md#eas)[0x4200000000000000000000000000000000000021](https://blockscout.lisk.com/address/0x4200000000000000000000000000000000000021)๐Ÿ”ต
[0x4200000000000000000000000000000000000021](https://sepolia-blockscout.lisk.com/address/0x4200000000000000000000000000000000000021)๐ŸŸฃ
**create2Deployer**[0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2](https://blockscout.lisk.com/address/0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2)๐Ÿ”ต
[0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2](https://sepolia-blockscout.lisk.com/address/0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2)๐ŸŸฃ
**L2ERC721Bridge**[0x4200000000000000000000000000000000000014](https://blockscout.lisk.com/address/0x4200000000000000000000000000000000000014)๐Ÿ”ต
[0x4200000000000000000000000000000000000014](https://sepolia-blockscout.lisk.com/address/0x4200000000000000000000000000000000000014)๐ŸŸฃ
**GovernanceToken**[0x4200000000000000000000000000000000000042](https://blockscout.lisk.com/address/0x4200000000000000000000000000000000000042)๐Ÿ”ต
[0x4200000000000000000000000000000000000042](https://sepolia-blockscout.lisk.com/address/0x4200000000000000000000000000000000000042)๐ŸŸฃ
+ +### Lisk features-specific contracts + +Details of **Lisk features-specific** contracts deployed on ๐Ÿ”ต **Lisk Mainnet** and ๐ŸŸฃ **Lisk Sepolia Testnet** are as follows. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name of ContractDescriptionContract Address
L2AirdropL2Airdrop is an implementation of the Lisk v4 migration airdrop on L2. It is responsible for the airdrop computation and distribution of LSK tokens to the recipient's accounts that have migrated to L2.[0xC7315f4FaaB2F700fc6b4704BB801c46ff6327AC](https://blockscout.lisk.com/address/0xC7315f4FaaB2F700fc6b4704BB801c46ff6327AC)๐Ÿ”ต
[0xDdE1998B8842b1C925Eef7eDFDAA2Df24A75048a](https://sepolia-blockscout.lisk.com/address/0xDdE1998B8842b1C925Eef7eDFDAA2Df24A75048a)๐ŸŸฃ
L2Claim
(Proxy)
Proxy contract for claiming LSK tokens from the legacy Lisk chain and recieve the appropriate amount on Lisk L2.[0xC7315f4FaaB2F700fc6b4704BB801c46ff6327AC](https://blockscout.lisk.com/address/0xC7315f4FaaB2F700fc6b4704BB801c46ff6327AC)๐Ÿ”ต
[0xDdE1998B8842b1C925Eef7eDFDAA2Df24A75048a](https://sepolia-blockscout.lisk.com/address/0xDdE1998B8842b1C925Eef7eDFDAA2Df24A75048a)๐ŸŸฃ
L2Claim (Implementation)Enables users to claim their LSK tokens from the legacy Lisk chain and recieve the appropriate amount on Lisk L2 using Merkle proofs, with support for both regular and multisig accounts.[0x60790Dc2d45BaA8B36282889569BbB301F4D0c41](https://blockscout.lisk.com/address/0x60790Dc2d45BaA8B36282889569BbB301F4D0c41)๐Ÿ”ต
[0xAE4A95E412d7d669AbE6bB23031Ae0250B832710](https://sepolia-blockscout.lisk.com/address/0xAE4A95E412d7d669AbE6bB23031Ae0250B832710)๐ŸŸฃ
L2Governor
(Proxy)
Proxy contract for the governance-related operations of Lisk L2.[0x58a61b1807a7bDA541855DaAEAEe89b1DDA48568](https://blockscout.lisk.com/address/0x58a61b1807a7bDA541855DaAEAEe89b1DDA48568)๐Ÿ”ต
[0xf9181aaD773d423A2cc0155Cb4263E563D51B467](https://sepolia-blockscout.lisk.com/address/0xf9181aaD773d423A2cc0155Cb4263E563D51B467)๐ŸŸฃ
L2Governor (Implementation)Handles the governance-related operations of Lisk L2.[0x18a0b8c653c291D69F21A6Ef9a1000335F71618e](https://blockscout.lisk.com/address/0x18a0b8c653c291D69F21A6Ef9a1000335F71618e)๐Ÿ”ต
[0xff5e32726fF30E9a15F6485C3Bd1e31e63B26625](https://sepolia-blockscout.lisk.com/address/0xff5e32726fF30E9a15F6485C3Bd1e31e63B26625)๐ŸŸฃ
L2LiskTokenInterface for the `OptimismMintableERC20` contract. Includes functionalities for minting, burning, querying tokens, and bridging addresses.[0xac485391EB2d7D88253a7F1eF18C37f4242D1A24](https://blockscout.lisk.com/address/0xac485391EB2d7D88253a7F1eF18C37f4242D1A24)๐Ÿ”ต
[0x8a21CF9Ba08Ae709D64Cb25AfAA951183EC9FF6D](https://sepolia-blockscout.lisk.com/address/0x8a21CF9Ba08Ae709D64Cb25AfAA951183EC9FF6D)๐ŸŸฃ
L2LockingPosition (Proxy)Proxy contract for locking positions.[0xC39F0C944FB3eeF9cd2556488e37d7895DC77aB8](https://blockscout.lisk.com/address/0xC39F0C944FB3eeF9cd2556488e37d7895DC77aB8)๐Ÿ”ต
[0x1220Cd967ED2EE4c593211EabCb2E3b1dC8E4930](https://sepolia-blockscout.lisk.com/address/0x1220Cd967ED2EE4c593211EabCb2E3b1dC8E4930)๐ŸŸฃ
L2LockingPosition (Implementation)Contract for locking positions. It allows creating, modifying, and removing locking positions.[0x6Ad85C3309C976B394ddecCD202D659719403671](https://blockscout.lisk.com/address/0x6Ad85C3309C976B394ddecCD202D659719403671)๐Ÿ”ต
[0xd5760D9d1a052FbCAad275637e8FC42B73063Fd4](https://sepolia-blockscout.lisk.com/address/0xd5760D9d1a052FbCAad275637e8FC42B73063Fd4)๐ŸŸฃ
L2Staking (Proxy)Proxy contract for staking LSK.[0xe9FA20Ca1157Fa686e60F1Afc763104F2C794b83](https://blockscout.lisk.com/address/0xe9FA20Ca1157Fa686e60F1Afc763104F2C794b83)๐Ÿ”ต
[0x77F4Ed75081c62aD9fA254b0E088A4660AacF68D](https://sepolia-blockscout.lisk.com/address/0x77F4Ed75081c62aD9fA254b0E088A4660AacF68D)๐ŸŸฃ
L2Staking (Implementation)This contract handles the staking functionality for the L2 network.[0x0ff2D89d01Ce79a0e971E264EdBA1608a8654CEd](https://blockscout.lisk.com/address/0x0ff2D89d01Ce79a0e971E264EdBA1608a8654CEd)๐Ÿ”ต
[0xD5D466b6FE4D00965991781845A1817975B40d91](https://sepolia-blockscout.lisk.com/address/0xD5D466b6FE4D00965991781845A1817975B40d91)๐ŸŸฃ
L2Reward
(Proxy)
Proxy contract for managing and handling L2 Staking Rewards.[0xD35ca9577a9DADa7624a35EC10C2F55031f0Ab1f](https://blockscout.lisk.com/address/0xD35ca9577a9DADa7624a35EC10C2F55031f0Ab1f)๐Ÿ”ต
[0xFd322B4724C497E59D48fff8f79c16b4D48837f5](https://sepolia-blockscout.lisk.com/address/0xFd322B4724C497E59D48fff8f79c16b4D48837f5)๐ŸŸฃ
L2Reward (Implementation)This contract manages and handles L2 Staking Rewards.[0xA82138726caF68901933838135Fb103E08fb858e](https://blockscout.lisk.com/address/0xA82138726caF68901933838135Fb103E08fb858e)๐Ÿ”ต
[0x973Bac46dd86A5cc5349E8d4A153AC5A20cdC296](https://sepolia-blockscout.lisk.com/address/0x973Bac46dd86A5cc5349E8d4A153AC5A20cdC296)๐ŸŸฃ
L2TimelockControllerThis contract module acts as a time-locked controller.[0x2294A7f24187B84995A2A28112f82f07BE1BceAD](https://blockscout.lisk.com/address/0x2294A7f24187B84995A2A28112f82f07BE1BceAD)๐Ÿ”ต
[0x76f1cD8436373fa9f3c17Da1e39740fE9dB9a04B](https://sepolia-blockscout.lisk.com/address/0x76f1cD8436373fa9f3c17Da1e39740fE9dB9a04B)๐ŸŸฃ
L2VestingWalletThis contract handles the Vesting functionality of the LSK token for the L2 network.[0xdF2363BE4644f160EEbFe5AE6F8728e64D8Db211](https://blockscout.lisk.com/address/0xdF2363BE4644f160EEbFe5AE6F8728e64D8Db211)๐Ÿ”ต
[0xc20e0E8590c32dbF11b38C8c0580395243Ebd533](https://sepolia-blockscout.lisk.com/address/0xc20e0E8590c32dbF11b38C8c0580395243Ebd533)๐ŸŸฃ
L2VotingPower
(Proxy)
Proxy contract for handling voting powers of stakers on Lisk L2 network.[0x2eE6Eca46d2406454708a1C80356a6E63b57D404](https://blockscout.lisk.com/address/0x2eE6Eca46d2406454708a1C80356a6E63b57D404)๐Ÿ”ต
[0xa52Ba291Ec45d8037510D5Da857f59abfA3DC0C5](https://sepolia-blockscout.lisk.com/address/0xa52Ba291Ec45d8037510D5Da857f59abfA3DC0C5)๐ŸŸฃ
L2VotingPower (Implementation)Contract for handling voting powers, locking positions, etc. of stakers on the Lisk L2 network.[0x99137F8880fB38e770EB7eF3d68038bC673D58EF](https://blockscout.lisk.com/address/0x99137F8880fB38e770EB7eF3d68038bC673D58EF)๐Ÿ”ต
[0x841e828A69B6efC1b02F7C317F59291A39583a64](https://sepolia-blockscout.lisk.com/address/0x841e828A69B6efC1b02F7C317F59291A39583a64)๐ŸŸฃ
diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/deploying-smart-contract/with-Foundry.md b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/deploying-smart-contract/with-Foundry.md new file mode 100644 index 000000000..7e25e2d2a --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/deploying-smart-contract/with-Foundry.md @@ -0,0 +1,515 @@ +--- +title: ... with Foundry +slug: /building-on-lisk/deploying-smart-contract/with-Foundry +description: "A guide on deploying a smart contract on the Lisk test network using Foundry. Includes instructions for setting up the environment, compiling, and deploying the smart contract." +keywords: [ + "Foundry", + "smart contract", + "ERC-20", + "Lisk", + "Lisk test network", + "Lisk testnet", + "Lisk Sepolia", + "testing smart contract", + "Solidity", + "smart contract deployment", + "deploy a smart contract", + "deploying smart contracts", + "build on lisk", + "write smart contract", + "smart contract development" + ] +toc_max_heading_level: 4 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Deploying a smart contract with Foundry + +In this guide, we discuss the basics of the [Foundry](https://book.getfoundry.sh/) development toolchain and will describe how to create and deploy a smart contract with Foundry to the **Lisk Sepolia** testnet. + +:::note +You can deploy a contract on **Lisk** mainnet by adopting the same process. +For deploying to mainnet, ensure that your wallet has enough ETH. + +The subsequent text contains commands for both Lisk and Lisk Sepolia for your ease. +For more information, see the [available Lisk networks](/network-info) and [how to connect a wallet with them](/user/connecting-to-a-wallet). +::: + +Foundry is a powerful suite of tools to develop, test, and debug your smart contracts. +It comprises several individual tools such as: + +- [`forge`](https://book.getfoundry.sh/forge/): is a command-line tool that is shipped with Foundry. +Forge tests, builds, and deploys your smart contracts. +- [`cast`](https://book.getfoundry.sh/cast/): is a command-line tool for performing RPC calls e.g., interacting with contracts, sending transactions, and getting onchain data. +- [`anvil`](https://book.getfoundry.sh/anvil/): is a local testnet node, designed for testing contract behavior from a frontend or over RPC in a local development environment. +- [`chisel`](https://book.getfoundry.sh/chisel/): is a Solidity [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop), for trying out Solidity snippets on a local or forked network. + + +## Prerequisites +To build with Foundry, you need: + +- A basic understanding of [Solidity](https://soliditylang.org/). +- Have Foundry installed on your system. +To do that, perform the following steps: + - From the command line, run: + ```bash + curl -L https://foundry.paradigm.xyz | bash + ``` + - After that, to install the latest (nightly) build of Foundry, run: + ```bash + foundryup + ``` +- For more information, see the Foundry Book's [Installation guide](https://book.getfoundry.sh/getting-started/installation). + +### Wallet funds + +**Deploying contracts** to the blockchain requires a **gas fee**. +Therefore, you will need to fund your wallet with ETH to cover such gas fees. + +For this guide, you will be deploying a contract to the Lisk Sepolia Testnet. + +You can deposit the required tokens by using the [Lisk Sepolia Bridge](https://sepolia-bridge.lisk.com/bridge/lisk-sepolia-testnet). + +In case your wallet doesn't hold enough `SepoliaETH`, use one of the available faucets for the **Ethereum Sepolia** Testnet like [https://sepoliafaucet.com](https://sepoliafaucet.com/) to receive free Testnet ETH. +Then, use the aforementioned Lisk Bridge to send tokens from the **Ethereum Sepolia Testnet** to the **Lisk Sepolia Testnet**. + +## Creating a project +The first step of deploying smart contracts to Lisk is to set up your development environment by creating a Foundry project. + +You can separately create a new directory and then initialize a Foundry project, or you can let Foundry create a directory and initiate a Foundry project by running the following command: + +```bash +forge init foundry_app && cd foundry_app +``` +This command will create a `foundry_app` and will change the terminal's working directory to the aforementioned folder as well. + +
+Execution logs of the `forge init` command +```text +Initializing /XYZ/L2/25/foundry_app/foundry_app... +Installing forge-std in /XYZ/L2/25/foundry_app/foundry_app/lib/forge-std (url: Some("https://github.com/foundry-rs/forge-std"), tag: None) +Cloning into '/XYZ/L2/25/foundry_app/foundry_app/lib/forge-std'... +remote: Enumerating objects: 2181, done. +remote: Counting objects: 100% (2177/2177), done. +remote: Compressing objects: 100% (737/737), done. +remote: Total 2181 (delta 1446), reused 2066 (delta 1373), pack-reused 4 +Receiving objects: 100% (2181/2181), 614.11 KiB | 766.00 KiB/s, done. +Resolving deltas: 100% (1446/1446), done. +Submodule 'lib/ds-test' (https://github.com/dapphub/ds-test) registered for path 'lib/ds-test' +Cloning into '/XYZ/L2/25/foundry_app/foundry_app/lib/forge-std/lib/ds-test'... +remote: Enumerating objects: 313, done. +remote: Counting objects: 100% (171/171), done. +remote: Compressing objects: 100% (79/79), done. +remote: Total 313 (delta 91), reused 132 (delta 83), pack-reused 142 +Receiving objects: 100% (313/313), 71.35 KiB | 521.00 KiB/s, done. +Resolving deltas: 100% (130/130), done. + Installed forge-std v1.7.6 + Initialized forge project +``` +
+ +By default, any application built with Foundry will have a similar directory structure to the following: + +```bash +. +โ”œโ”€โ”€ .github +โ”œโ”€โ”€ lib +โ”œโ”€โ”€ script +โ”‚ย ย  โ””โ”€โ”€ Counter.s.sol +โ”œโ”€โ”€ src +โ”‚ย ย  โ””โ”€โ”€ Counter.sol +โ”œโ”€โ”€ test +โ”‚ โ””โ”€โ”€ Counter.t.sol +โ”œโ”€โ”€ .gitignore +โ”œโ”€โ”€ .gitmodules +โ”œโ”€โ”€ foundry.toml +โ””โ”€โ”€ README.md +``` + +For now, delete the files present in the `script/Counter.s.sol`, `src/Counter.sol`, and `test/Counter.t.sol` as we will be creating a contract, and relevant test code ourselves in the following guide. + +### **Creating** the smart contract + +For ease and security, weโ€™ll use the `ERC721` contract provided by the [OpenZeppelin Contracts library](https://docs.openzeppelin.com/contracts/5.x/erc721) to create a simple ERC-721 smart contract. +With OpenZeppelin, we donโ€™t need to write the entire ERC-721 contract. +Instead, we can import the library contract and use its functions from the get-go. + +To install the OpenZeppelin Contracts library to your project, run: + +```bash +forge install openzeppelin/openzeppelin-contracts +``` + +Inside the `src` folder, create a smart contract called `NFT.sol` and add the code below to the newly created file. + +```sol title="src/NFT.sol" +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.23; + +import "openzeppelin-contracts/contracts/token/ERC721/ERC721.sol"; + +contract NFT is ERC721 { + uint256 public currentTokenId; + + // The following will create an ERC721 Token called Lisk. + constructor() ERC721("Lisk", "LSK") {} + + // For simplicity, we will only implement the mint function of the Lisk token. + function mint(address recipient) public payable returns (uint256) { + uint256 newItemId = ++currentTokenId; + _safeMint(recipient, newItemId); + return newItemId; + } +} +``` + +### **Compiling** the smart contract +Once the smart contract's code is ready, it must be compiled using Foundry, to do that, simply run: + +```bash +forge build +``` +If the smart contract doesn't have any errors, you will see the following output on the terminal: + +```text +[โ ข] Compiling... +[โ ฐ] Compiling 1 files with 0.8.24 +[โ ”] Solc 0.8.24 finished in 40.36ms +Compiler run successful! +``` + +### **Testing** the smart contract + +By testing the smart contract, you can verify that the smart contract behaves as expected and that it is free of bugs, before deploying it to Lisk. + +Foundry provides a rich testing framework to support you in writing tests for smart contracts. +See [Tests - Foundry Book](https://book.getfoundry.sh/forge/tests) for examples and references regarding the testing framework. + +To test the `NFT` smart contract, create a new file `NFT.t.sol` under the `test/` directory, and add the following content: + +```solidity title="foundry_app/test/NFT.t.sol" +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.20; + +import {Test, console} from "forge-std/Test.sol"; +import {NFT} from "../src/NFT.sol"; + +contract NFTTest is Test { + + NFT public lsk; + + // Create dummy addresses for alice and bob + address alice = makeAddr("alice"); + address bob = makeAddr("bob"); + + // Initialize the NFT contract's object + function setUp() public{ + lsk = new NFT(); + } + + // Pass the address of alice and bob to see whether the mint function successfully passes + function testMintPass() public { + lsk.mint(alice); + lsk.mint(bob); + } + + // To intentionally create a failing test, let's compare the addresses of alice and bob + function testMintFail() public { + assertEq(alice, bob); + } +} +``` + +To run the tests, execute the following command. The `-vv` flag will output detailed information about the tests run using the following command. + +```bash +forge test -vv +``` + +The output should look like this: + +```text +[โ ข] Compiling... +No files changed, compilation skipped + +Ran 2 tests for test/NFT.t.sol:NFTTest +[FAIL. Reason: assertion failed] testMintFail() (gas: 147160) +Logs: +// highlight-start + Error: a == b not satisfied [address] + Left: 0x328809Bc894f92807417D2dAD6b7C998c1aFdac6 + Right: 0x1D96F2f6BeF1202E4Ce1Ff6Dad0c2CB002861d3e +// highlight-end + +[PASS] testMintPass() (gas: 132327) +Test result: FAILED. 1 passed; 1 failed; 0 skipped; finished in 1.13ms + +Ran 1 test suite in 1.13ms: 1 tests passed, 1 failed, 0 skipped (2 total tests) + +Failing tests: +Encountered 1 failing test in test/NFT.t.sol:NFTTest +[FAIL. Reason: assertion failed] testMintFail() (gas: 147160) + +Encountered a total of 1 failing tests, 1 tests succeeded +``` + +The first test: `testMintPass` passed successfully as the criteria for the `mint()` function were met. +We passed the recipient address to the `mint()` function as required, hence the success. + +The second test: `testMintFail` failed since we asserted that the addresses of `alice` and `bob` were the same. +The highlighted log output elaborates on how the assertion was false. + +### **Deploying** the smart contract + +After successfully building the smart contract, you can now deploy it to the Lisk network. +For this example, we will use the Lisk Sepolia network to deploy the `NFT` contract. + +Add the `--verify`, `--verifier`, `--verifier-url`, and the sender account's `--private-key` flag to the `forge create` command to directly verify the smart contract on BlockScout. + + + + + ```bash + forge create --rpc-url https://rpc.api.lisk.com \ + --etherscan-api-key 123 \ + --verify \ + --verifier blockscout \ + --verifier-url https://blockscout.lisk.com/api \ + --private-key \ + src/NFT.sol:NFT + ``` + + + ```bash + forge create --rpc-url https://rpc.sepolia-api.lisk.com \ + --etherscan-api-key 123 \ + --verify \ + --verifier blockscout \ + --verifier-url https://sepolia-blockscout.lisk.com/api \ + --private-key \ + src/NFT.sol:NFT + ``` + + + + +If the deployment is successful, the output should look like the following: + +```text +# The aforementioned command will first deploy the contract and display the following output: + +// highlight-start +[โ ’] Compiling... +No files changed, compilation skipped +Deployer: 0x5e1A92F84cA1CE280B3Cb29d79C3368f45b41EBB +Deployed to: 0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5 +Transaction hash: 0xf465528f43e5cbc9b5206e46048feba0b920179813c3eb8c3bdbccbfd13d731e +// highlight-end + +# Once the contract is deployed successfully, the above-mentioned command will then verify the contract as well! + +// highlight-start +Starting contract verification... +Waiting for blockscout to detect contract deployment... +Start verifying contract `0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5` deployed on 4202 + +Submitting verification for [src/NFT.sol:NFT] 0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5. +Submitted contract for verification: + Response: `OK` + GUID: `108872f713a27bc22ca1db8ceefcac8cbeddf9e565e71790` + URL: https://sepolia-blockscout.lisk.com/address/0x108872f713a27bc22ca1db8ceefcac8cbeddf9e5 +Contract verification status: +Response: `OK` +Details: `Pending in queue` +Contract verification status: +Response: `OK` +Details: `Pass - Verified` +Contract successfully verified +// highlight-end +``` + +After the smart contract is deployed and verified, you can interact with it by calling its public functions. + +### **Verifying** the smart contract + +Each deployed contract should be verified so that users and other developers can inspect the source code, and be sure that it matches the deployed bytecode on the blockchain. + +Further, if you want to allow others to interact with your contract using the block explorer such as Blockscout's [Read contract](https://sepolia-blockscout.lisk.com/address/0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5?tab=read_contract) and [Write Contract](https://sepolia-blockscout.lisk.com/address/0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5?tab=write_contract) interfaces, it first needs to be verified. + + +The above contract has **already been verified**, so you should be able to view your version on a block explorer already, but we'll still walk through how to verify a contract on the Lisk Sepolia testnet. + +:::info +You can't re-verify a contract identical to one that has already been verified. If you attempt to do so, such as verifying the above contract, you'll get an error similar to: + +```text +Start verifying contract `0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5` deployed on 4202 + +Contract [src/NFT.sol:NFT] "0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5" is already verified. Skipping verification. +``` +::: + +In case your smart contract isn't verified, grab the deployed address and run: + + + + ```bash + forge verify-contract \ + ./src/.sol: \ + --chain 1135 \ + --watch \ + --verifier blockscout \ + --verifier-url https://blockscout.lisk.com/api + ``` + + + ```bash + forge verify-contract \ + ./src/.sol: \ + --chain 4202 \ + --watch \ + --verifier blockscout \ + --verifier-url https://sepolia-blockscout.lisk.com/api + ``` + + + +You should see an output similar to the following: + + ``` +Starting contract verification... +Waiting for blockscout to detect contract deployment... +Start verifying contract `0xcCaA1C3eb8FEb5b09a5Eac1359BC4c70E18e29d9` deployed on 4202 + +Submitting verification for [src/NFT.sol:NFT] 0xcCaA1C3eb8FEb5b09a5Eac1359BC4c70E18e29d9. +Submitted contract for verification: + Response: `OK` + GUID: `ccaa1c3eb8feb5b09a5eac1359bc4c70e18e29d965e5c95a` + URL: https://sepolia-blockscout.lisk.com/address/0xccaa1c3eb8feb5b09a5eac1359bc4c70e18e29d9 +Contract verification status: +Response: `OK` +Details: `Pending in queue` +Contract verification status: +Response: `OK` +Details: `Pass - Verified` +Contract successfully verified +``` + +Use the contract's address e.g., `0xcCaA1C3eb8FEb5b09a5Eac1359BC4c70E18e29d9` to search for your contract on [Blockscout](https://sepolia-blockscout.lisk.com/) to confirm that it is verified. + + +## Interacting with the Smart Contract + +As mentioned earlier, if you verified the smart contract on Blocksout, you can use the `Read contract` and `Write contract` sections under the `Contract` tab to interact with the deployed contract. + +The `Read contract` tab can be used without connecting a wallet, however, to use the `Write contract` tab, you'll need to connect your wallet first. +You can do that by clicking the `Connect wallet` button. + +### Using **cast** for interaction + +With Foundry's rich command-line tool: [`cast`](https://book.getfoundry.sh/cast/) it is possible to interact with any deployed contract whether it is reading or writing data on the blockchain. +Let's perform a call without publishing a transaction (a read), then sign and publish a transaction (a write) to the deployed contract. + +#### Performing a call + +A key component of the Foundry toolkit, `cast` enables us to interact with contracts, send transactions, and get onchain data using Ethereum RPC calls. +First, we will perform a call from an account, without publishing a transaction. + +Fill out the following `` and then, run the command: + + + + ```bash + cast call --rpc-url https://rpc.api.lisk.com "balanceOf(address)" + ``` + + + ```bash + cast call --rpc-url https://rpc.sepolia-api.lisk.com "balanceOf(address)" + ``` + + + +You should receive `0x0000000000000000000000000000000000000000000000000000000000000000` in response, which equals `0` in hexadecimal. +This makes sense as you've only deployed the NFT contract for now, however, no NFTs have been minted yet, and therefore your account's balance is zero. + +#### Signing and sending a transaction + +Now let's sign and send a transaction, calling the `mint(address)` function on the `NFT` contract we just deployed. + +Again, fill out the following `` and then, run the command: + + + + ```bash + cast send --rpc-url https://rpc.api.lisk.com "mint(address)" --private-key + ``` + + + ```bash + cast send --rpc-url https://rpc.sepolia-api.lisk.com "mint(address)" --private-key + ``` + + + + + +:::info + +As the `cast send` command writes data on the blockchain, it needs a sender account's private key to be passed to the `--private-key` flag. +The transaction will be sent successfully if the sender account has sufficient funds. + +The aforesaid is not required for `cast call` command, because that only retrieves already published data from the smart contract. + +::: + +If the transaction execution is successful, Foundry will respond with information about the transaction, including the `blockNumber`, `gasUsed`, `transactionHash`, and much more. + +```text +blockHash 0xfa9d32794b0fc9c1a10d39c5289613dfe80b55f8ead06475ca877a389e088e67 +// highlight-next-line +blockNumber 2165375 +contractAddress +cumulativeGasUsed 137472 +effectiveGasPrice 3000000253 +from 0x5e1A92F84cA1CE280B3Cb29d79C3368f45b41EBB +// highlight-next-line +gasUsed 93597 +logs [{"address":"0x108872f713a27bc22ca1db8ceefcac8cbeddf9e5","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000488ba3c013020bd1712ed6a1997c4212d9711954","0x0000000000000000000000000000000000000000000000000000000000000001"],"data":"0x","blockHash":"0xfa9d32794b0fc9c1a10d39c5289613dfe80b55f8ead06475ca877a389e088e67","blockNumber":"0x210a7f","transactionHash":"0x76750ee1aaeed89c8f165d6f547002eb3bb833a142f73d63c1c3c9980fce8796","transactionIndex":"0x1","logIndex":"0x0","removed":false}] +logsBloom 0x00000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000200000000008000000000000000000040000000000000000000000000000020000000000000000080800000000000000000000000010000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000001000000000000400000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000 +root +status 1 +// highlight-next-line +transactionHash 0x76750ee1aaeed89c8f165d6f547002eb3bb833a142f73d63c1c3c9980fce8796 +transactionIndex 1 +type 2 +to 0x1088โ€ฆf9e5 +l1Fee "0x30fb62bfb0c" +l1GasPrice "0x6d49929" +l1GasUsed "0x8a4" +``` + +Finally, you can confirm the minting by [performing the call](#performing-a-call) again. +We should see that our balance increased from `0` to `1`. + + + + ```bash + cast call --rpc-url https://rpc.api.lisk.com "balanceOf(address)" + ``` + + + ```bash + cast call --rpc-url https://rpc.sepolia-api.lisk.com "balanceOf(address)" + ``` + + + +And the response: `0x0000000000000000000000000000000000000000000000000000000000000001` (`1` in hex) โ€”ย congratulations, you deployed a contract and minted an NFT with Foundry! + +See the minted token for this guide on the [Blockscout explorer](https://sepolia-blockscout.lisk.com/token/0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5). + +That's it! Although this is just the tip of the iceberg, there is a lot more to learn about Foundry. +For all things Foundry, check out the [Foundry book](https://book.getfoundry.sh/), or head to the official Telegram [dev chat](https://t.me/foundry_rs) or [support chat](https://t.me/foundry_support). \ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/deploying-smart-contract/with-Hardhat.md b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/deploying-smart-contract/with-Hardhat.md new file mode 100644 index 000000000..45f556283 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/deploying-smart-contract/with-Hardhat.md @@ -0,0 +1,381 @@ +--- +title: ... with Hardhat +slug: /building-on-lisk/deploying-smart-contract/with-Hardhat +description: "A guide on deploying a smart contract on the Lisk test network using Hardhat. Includes instructions for setting up the environment, compiling, and deploying the smart contract." +keywords: [ + "Hardhat", + "smart contract", + "ERC-721", "Lisk", + "Lisk test network", + "Lisk testnet", + "Node.js", + "Solidity", + "smart contract deployment", + "deploy a smart contract", + "deploying smart contracts", + "build on lisk", + "write smart contract", + "smart contract development" + ] +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Deploying a smart contract with Hardhat +## Prerequisites + +### Node v18+ + +This guide requires you to have Node version 18+ installed. + +- Download [Node v18+](https://nodejs.org/en/download/) + +If you are using `nvm` to manage your node versions, you can just run `nvm install 18`. + +### Wallet funds + +**Deploying contracts** to the blockchain requires a **gas fee**. +Therefore, you will need to fund your wallet with ETH to cover those gas fees. + +For this guide, you will be deploying a contract to the Lisk Sepolia Testnet. + +You can deposit the required tokens by using the [Lisk Bridge](https://sepolia-bridge.lisk.com/bridge/lisk-sepolia-testnet). + +In case your wallet doesn't hold enough `SepoliaETH`, use one of the available faucets for the **Ethereum Sepolia** Testnet like [https://sepoliafaucet.com](https://sepoliafaucet.com/) to receive free Testnet ETH. +Then, use the aforementioned Lisk Bridge to send tokens from the **Ethereum Sepolia Testnet** to the **Lisk Sepolia Testnet**. + +:::note +You can deploy a contract on Lisk Mainnet by adopting the same process. +For deploying to mainnet, ensure that your wallet has enough ETH. + +The subsequent text contains commands for both Lisk and Lisk Sepolia for your ease. +For more information, see the [available Lisk networks](/network-info) and [how to connect a wallet with them](/user/connecting-to-a-wallet). + +::: + + +## Creating a project +Before you can begin deploying smart contracts to Lisk, you need to set up your development environment by creating a Node.js project. + +To create a new Node.js project, run: + +```bash +npm init --y +``` + +Next, you will need to install [Hardhat](https://hardhat.org/tutorial) and create a new Hardhat project. + +To install Hardhat, run: + +```bash +npm install --save-dev hardhat +``` + +To create a new Hardhat project, run: + +```bash +npx hardhat +``` + +Select `Create a TypeScript project` then press _Enter_ to confirm the project root. + +Select `y` for both adding a `.gitignore` and loading the sample project. +Optionally, you can decide to share crash reports and usage data with HardHat. + +``` +โœ” What do you want to do? ยท Create a TypeScript project +โœ” Hardhat project root: ยท /Users/lisk/git/hardhat-test +โœ” Do you want to add a .gitignore? (Y/n) ยท y +โœ” Help us improve Hardhat with anonymous crash reports & basic usage data? (Y/n) ยท y +โœ” Do you want to install this sample project's dependencies with npm (@nomicfoundation/hardhat-toolbox)? (Y/n) ยท y +``` + +It will take a moment for the project setup process to complete. + +## Configuring Hardhat with Lisk + +In order to deploy smart contracts to the Lisk network, you will need to configure your Hardhat project and add the Lisk network. + +This example uses [dotenv](https://www.npmjs.com/package/dotenv) to load the `WALLET_KEY` environment variable from a `.env` file to `process.env.WALLET_KEY`. +You should use a similar method to avoid hardcoding your private keys within your source code. + +```bash +npm install --save-dev dotenv +``` + +Once you have `dotenv` installed, create a `.env` file with the following content: + +``` +WALLET_KEY= +``` + +Substitute `` with the private key for your wallet. + +:::caution + +`WALLET_KEY` is the private key of the wallet to use when deploying a contract. +Follow the instructions of your wallet on how to get your private key. +E.g. for **MetaMask**, please follow [these instructions](https://support.metamask.io/hc/en-us/articles/360015289632-How-to-export-an-account-s-private-key). +**It is critical that you do NOT commit this to a public repo** + +::: + +To configure Hardhat to use Lisk, add Lisk as a network to your project's `hardhat.config.ts` file: + + + + ```ts title="hardhat.config.ts" + import { HardhatUserConfig } from "hardhat/config"; + import "@nomicfoundation/hardhat-toolbox"; + + require('dotenv').config(); + + const config: HardhatUserConfig = { + solidity: "0.8.23", + networks: { + // for mainnet + 'lisk': { + url: 'https://rpc.api.lisk.com', + accounts: [process.env.WALLET_KEY as string], + gasPrice: 1000000000, + }, + }, + }; + + export default config; + ``` + + + ```ts title="hardhat.config.ts" + import { HardhatUserConfig } from "hardhat/config"; + import "@nomicfoundation/hardhat-toolbox"; + + require('dotenv').config(); + + const config: HardhatUserConfig = { + solidity: "0.8.23", + networks: { + // for testnet + 'lisk-sepolia': { + url: 'https://rpc.sepolia-api.lisk.com', + accounts: [process.env.WALLET_KEY as string], + gasPrice: 1000000000, + }, + }, + }; + + export default config; + ``` + + + +## Creating the contract +For ease and security, weโ€™ll use the `ERC721` interface provided by the [OpenZeppelin Contracts library](https://docs.openzeppelin.com/contracts/5.x/) to create an NFT smart contract. +With OpenZeppelin, we donโ€™t need to write the whole ERC-721 interface. Instead, we can import the library contract and use its functions. + +To add the OpenZeppelin Contracts library to your project, run: + +```bash +npm install --save @openzeppelin/contracts +``` + +In your project, delete the `contracts/Lock.sol` contract that was generated with the project. +(You can also delete the `test/Lock.ts` test file, but you should add your own tests ASAP!). + +Add the code below to a new file called `contracts/NFT.sol`. + +```sol title="contracts/NFT.sol" +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.23; + +import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; + +contract NFT is ERC721 { + uint256 public currentTokenId; + + constructor() ERC721("NFT Name", "NFT") {} + + function mint(address recipient) public returns (uint256) { + uint256 newItemId = ++currentTokenId; + _safeMint(recipient, newItemId); + return newItemId; + } +} +``` + +## Compiling the smart contract +To compile the contract using Hardhat, simply run: + +```bash +npx hardhat compile +``` + +After successful compilation, you should see a new folder `artifacts/`, which contains the [compilation artifacts](https://hardhat.org/hardhat-runner/docs/advanced/artifacts). + +## Deploying the smart contract + +Once your contract has been successfully compiled, you can deploy the contract to the Lisk Sepolia test network. + +To deploy the contract to the Lisk Sepolia test network, you'll need to modify the `scripts/deploy.ts` in your project: + +```ts title="scripts/deploy.ts" +import { ethers } from 'hardhat'; + +async function main() { + const nft = await ethers.deployContract('NFT'); + + await nft.waitForDeployment(); + + console.log('NFT Contract Deployed at ' + nft.target); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main().catch((error) => { + console.error(error); + process.exitCode = 1; +}); +``` + +You'll also need Testnet ETH in your wallet. +See the [Prerequisites](#prerequisites) if you haven't done that yet. +Otherwise, the deployment attempt will fail. + +Finally, run: + + + + ```bash + npx hardhat run scripts/deploy.ts --network lisk + ``` + + + ```bash + npx hardhat run scripts/deploy.ts --network lisk-sepolia + ``` + + + + + + + +The contract will be deployed on the Lisk Sepolia Testnet. +You can view the deployment status and contract by using a block explorer and searching for the address returned by your deploy script. + +If you're deploying a new or modified contract, you'll need to verify it first. + +## Verifying the Smart Contract + +If you want to interact with your contract on the block explorer, you, or someone else needs to verify it first. +The above contract has already been verified, so you should be able to view your version on a block explorer already. +For the remainder of this guide, we'll walk through how to verify your contract on the Lisk Sepolia Testnet. + +In `hardhat.config.ts`, configure Lisk Sepolia as a custom network. +Add the following to your `HardhatUserConfig`: + + + + ```ts title="hardhat.config.ts" + // Add the following information after the "networks" configuration of the HardhatUserConfig + const config: HardhatUserConfig = { + // Hardhat expects etherscan here, even if you're using Blockscout. + etherscan: { + // Use "123" as a placeholder, because Blockscout doesn't need a real API key, and Hardhat will complain if this property isn't set. + apiKey: { + "lisk": "123" + }, + customChains: [ + { + network: "lisk", + chainId: 1135, + urls: { + apiURL: "https://blockscout.lisk.com/api", + browserURL: "https://blockscout.lisk.com" + } + } + ] + }, + sourcify: { + enabled: false + }, + }; + ``` + + + ```ts title="hardhat.config.ts" + // Add the following information after the "networks" configuration of the HardhatUserConfig + const config: HardhatUserConfig = { + // Hardhat expects etherscan here, even if you're using Blockscout. + etherscan: { + // Use "123" as a placeholder, because Blockscout doesn't need a real API key, and Hardhat will complain if this property isn't set. + apiKey: { + "lisk-sepolia": "123" + }, + customChains: [ + { + network: "lisk-sepolia", + chainId: 4202, + urls: { + apiURL: "https://sepolia-blockscout.lisk.com/api", + browserURL: "https://sepolia-blockscout.lisk.com" + } + } + ] + }, + sourcify: { + enabled: false + }, + }; + ``` + + + +Now, you can verify your contract. +Grab the deployed address and run: + + + + ```bash + npx hardhat verify --network lisk + ``` + + + ```bash + npx hardhat verify --network lisk-sepolia + ``` + + + +You should see an output similar to: + +```text +Successfully submitted source code for contract +contracts/NFT.sol:NFT at 0xC10710ac55C98f9AACdc9cD0A506411FBe0af71D +for verification on the block explorer. Waiting for verification result... + +Successfully verified contract NFT on the block explorer. +https://sepolia-blockscout.lisk.com/address/0xC10710ac55C98f9AACdc9cD0A506411FBe0af71D#code +``` + +:::info + +You can't re-verify a contract identical to one that has already been verified. +If you attempt to do so, such as verifying the above contract, you'll get a message similar to: + +```text +The contract 0xC10710ac55C98f9AACdc9cD0A506411FBe0af71D has already been verified on Etherscan. +https://sepolia-blockscout.lisk.com/address/0xC10710ac55C98f9AACdc9cD0A506411FBe0af71D#code +``` + +::: + +View your contract on BlockScout, by following the [link to the deployed contract](https://sepolia-blockscout.lisk.com/address/0xC10710ac55C98f9AACdc9cD0A506411FBe0af71D?tab=contract) displayed in the previous steps output message. +The block explorer will confirm that the contract is verified and allow you to [interact](#interacting-with-the-smart-contract) with it. + +## Interacting with the Smart Contract + +After [the contract is verified](#verifying-the-smart-contract), you can use the `Read Contract` and `Write Contract` tabs to interact with the deployed contract via [BlockScout](https://sepolia-blockscout.lisk.com/address/0xC10710ac55C98f9AACdc9cD0A506411FBe0af71D?tab=contract). +Don't forget to update the contract address in the Blockscout URL. +You'll also need to connect your wallet first, by clicking the `Connect Wallet` button. diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/deploying-smart-contract/with-thirdweb.mdx b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/deploying-smart-contract/with-thirdweb.mdx new file mode 100644 index 000000000..845ba748b --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/deploying-smart-contract/with-thirdweb.mdx @@ -0,0 +1,328 @@ +--- +title: ... with thirdweb +slug: /building-on-lisk/deploying-smart-contract/with-thirdweb +description: "A guide on deploying a smart contract on the Lisk test network using thirdweb. Includes instructions for setting up the environment, compiling, and deploying the smart contract." +keywords: [ + "thirdweb", + "smart contract", + "ERC-721", "Lisk", + "Lisk test network", + "Lisk testnet", + "Node.js", + "Solidity", + "smart contract deployment", + "deploy a smart contract", + "deploying smart contracts", + "build on lisk", + "write smart contract", + "smart contract development" + ] +toc_max_heading_level: 4 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Deploying a smart contract with thirdweb +[thirdweb](https://thirdweb.com/) is an end-to-end framework for smart contract development and deployment. + +It enables developers to deploy, standard contracts such as ERC-20, ERC-721, or ERC-1155, etc. without writing a line of code. +More of this is discussed in the [via thirdweb Explore](#deploying-pre-built-contracts-via-thirdweb-explore) section. + +Furthermore, developers looking to develop and deploy custom smart contracts can use the [Solidity SDK](https://portal.thirdweb.com/contracts/build/overview) provided by thirdweb, among others such as [TypeScript SDK](https://portal.thirdweb.com/typescript/v5) and [Unity SDK](https://portal.thirdweb.com/unity). +However, for this guide, we will mainly talk about the [thirdweb Explore](https://thirdweb.com/explore) and the [Solidity SDK](https://portal.thirdweb.com/contracts/build/overview). + +**Features:** + +- [Explore](https://portal.thirdweb.com/contracts/explore/overview): Ready to deploy pre-built contracts. +- [Build (Solidity SDK)](https://portal.thirdweb.com/contracts/build/overview): Write custom smart contracts. +- [Deploy](https://portal.thirdweb.com/contracts/deploy/overview): Support for contract deployment built for any use case. +- [Publish](https://portal.thirdweb.com/contracts/publish/overview): Publish your contracts onchain. +- [Interact](https://portal.thirdweb.com/contracts/interact/overview): Interact with smart contracts and integrate smart contracts directly into your app. + +## Deploying pre-built contracts via thirdweb Explore +In case you want to deploy a pre-built contract without any customization, thirdweb offers a convenient way to do so with **Explore**. +Check out the following video for a quick introduction to Explore: + +- [What is thirdweb **Explore**?](https://youtu.be/jYEqoIeAoBg?t=5300) + +:::note +Before you try out the following guides, please ensure that your [wallet is connected to Lisk's Network](/user/connecting-to-a-wallet) and it has sufficient funds in it. +For more information, see the [Wallet funds](/building-on-lisk/deploying-smart-contract/with-Foundry#wallet-funds) section. +::: + +The following videos describe step-by-step, how to deploy different tokens with pre-built contracts on Lisk. +- [How to deploy a pre-built **ERC-20** contract via Explore?](https://youtu.be/jYEqoIeAoBg?t=5776) +- [How to deploy a pre-built **ERC-721** contract via Explore?](https://youtu.be/jYEqoIeAoBg?t=6040) +- [How to deploy a pre-built **ERC-1155** contract via Explore?](https://youtu.be/jYEqoIeAoBg?t=6396) + +## via Solidity SDK + +### Prerequisites +#### Node.js v18+ + +Download and install [Node v18+](https://nodejs.org/en/download/). + +If you are using nvm to manage your node versions, you can just run `nvm install 18`. + +#### Installing and Configuring thirdweb + +To develop custom contracts, it is required to download and configure thirdweb. + +1. To install thirdweb run the following command: + + + ```bash + npm i -g thirdweb + ``` + + + ```bash + yarn global add thirdweb + ``` + + +2. [Set up your thirdweb API key](https://youtu.be/jYEqoIeAoBg?t=9467). + +#### Logging in with your API key + +1. The next step is to log in to thirdweb via CLI, so to do that type the following: + ```bash + thirdweb login + ``` +2. Once, you execute the aforementioned command, the terminal will open a browser window where it will ask you to authenticate the device: + ```text + ....... + + ๐Ÿ’Ž thirdweb v0.13.60 ๐Ÿ’Ž + + Automatically attempting to open a link to authenticate with our dashboard... + + If the browser doesn't open, please use this link to authenticate: + + https://thirdweb.com/cli/login?payload=%7B%22payload%22%3A%7B%22type%22%3A%22evm%22%2C%22domain%22%3A%22thirdweb.com%22%2C%22address%22%3A%220x4fA5f77Fadcc319c626b28Ea6260FB0c3Ba6e41C%22%2C%22statement%22%3A%22Please%20ensure%20that%20the%20domain%20above%20matches%20the%20URL%20of%20the%20cuhdksjahjkdhkshajkdhkshakjhsjhdsajkhhdhs + + โ ™ Waiting for a response from the dashboard + ``` +3. Once you authenticate via the browser, the terminal will log the following message: + ```text + Successfully linked your account to this device + ``` +4. You can verify your login status by re-running the `thirdweb login` command. + ```text + ๐Ÿ’Ž thirdweb v0.13.60 ๐Ÿ’Ž + +### Creating a project +The first step of deploying smart contracts to Lisk is to set up your development environment by creating a project. +The thirdweb supports two of the most popular smart contracts development frameworks such as [Foundry](https://book.getfoundry.sh/) and [Hardhat](https://hardhat.org). + +For this guide, we are using Foundry for smart contract development. +However, you can use Hardhat if you are more comfortable with that. +The project creation steps are similar for both Foundry and Hardhat. + +1. For Foundry, install its [prerequisites](/building-on-lisk/deploying-smart-contract/with-Foundry#prerequisites) on your system before proceeding with the creation of a thirdweb project. +2. Once, the aforementioned is installed, proceed with the following: + ```bash + npx thirdweb create + ``` +3. Choose `Contract` as the type of your project and give an appropriate name to your project. + ```text + ....... + + ๐Ÿ’Ž thirdweb v0.13.60 ๐Ÿ’Ž + + โœ” What type of project do you want to create? โ€บ Contract + โœ” What is your project named? โ€ฆ thirdweb-contracts + ``` +4. Next, choose `Forge` as the framework, `NFT` as the name of the contract, `ERC721` as the type of smart contract, and `None` for the extensions option. + :::info + In case you want to use the Hardhat framework, choose `Hardhat` instead of `Forge` in the following dialogue. + ::: + + ```text + โœ” What framework do you want to use? โ€บ Forge + โœ” What will be the name of your new smart contract? โ€ฆ NFT + โœ” What type of contract do you want to start from? โ€บ ERC721 + โœ” What extensions do you want to add to your contract? โ€บ None + ``` +5. thirdweb will install all the relevant dependencies and set up a contract project for you. +
+ Execution logs of the thirdweb `contract` project creation + ```text + Creating a new thirdweb contracts project in /Users/XYZ/Lightcurve-Code/L2/thirdweb-contracts. + + Downloading files. This might take a moment. + Installing packages. This might take a couple of minutes. + + yarn install v1.22.19 + warning ../../../package.json: No license field + info No lockfile found. + [1/4] ๐Ÿ” Resolving packages... + [2/4] ๐Ÿšš Fetching packages... + [3/4] ๐Ÿ”— Linking dependencies... + [4/4] ๐Ÿ”จ Building fresh packages... + success Saved lockfile. + โœจ Done in 9.73s. + + Initialized a git repository. + + Success! Created thirdweb-contracts at /Users/XYZ/Lightcurve-Code/L2/thirdweb-contracts + + Inside that directory, you can run several commands: + + yarn build + Compiles your contracts and detects thirdweb extensions implemented on them. + + yarn deploy + Deploys your contracts with the thirdweb deploy flow. + + yarn publish + Publishes your contracts with the thirdweb publish flow. + + We suggest that you begin by typing: + + cd thirdweb-contracts + ``` +
+ +6. Foundry applications created with thirdweb have a similar directory structure to the following: + + ```bash + . + โ”œโ”€โ”€ .github + โ”œโ”€โ”€ .cache + โ”œโ”€โ”€ lib + โ”œโ”€โ”€ node_modules + โ”œโ”€โ”€ out + โ”œโ”€โ”€ src + โ”‚ย ย  โ””โ”€โ”€ NFT.sol + โ”œโ”€โ”€ test + โ”‚ โ””โ”€โ”€ Contract.t.sol + โ”œโ”€โ”€ .gitignore + โ”œโ”€โ”€ .gitmodules + โ”œโ”€โ”€ foundry.toml + โ””โ”€โ”€ README.md + ``` + +#### **Creating** the smart contract + +For ease and security, thirdweb already provides base contracts, which can be easily customized via code. +Since we chose to create an `ERC721` token earlier, an `NFT.sol` file will be present in the `src/` folder. +The `NFT.sol` will already have the base code required for an NFT contract. + +```sol title="src/NFT.sol" +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "@thirdweb-dev/contracts/base/ERC721Base.sol"; + +contract NFT is ERC721Base { + constructor( + address _defaultAdmin, + string memory _name, + string memory _symbol, + address _royaltyRecipient, + uint128 _royaltyBps + ) + ERC721Base( + _defaultAdmin, + _name, + _symbol, + _royaltyRecipient, + _royaltyBps + ) + {} +} + +``` + +#### **Building** the smart contract +Once the smart contract's code is ready, it must be built using thirdweb. + +1. To do that, simply run: + ```bash + npx thirdweb build + ``` +2. If the smart contract doesn't have any errors, you will see the following output on the terminal: + ```text + ....... + + ๐Ÿ’Ž thirdweb v0.13.62 ๐Ÿ’Ž + + โœ” Detected project type: foundry + โœ” Compilation successful + โœ” Choose which contracts to run detection on ยท NFT + + + ๐Ÿ”Ž Detected extension on NFT + โœ”๏ธ ERC721 + โœ”๏ธ ERC721Burnable + โœ”๏ธ ERC721Supply + โœ”๏ธ ERC721AQueryable + โœ”๏ธ ERC721Mintable + โœ”๏ธ ERC721BatchMintable + โœ”๏ธ Royalty + โœ”๏ธ ContractMetadata + โœ”๏ธ Ownable + โœ”๏ธ Fallback + + โ„น Suggested extensions + - ERC721Enumerable - https://portal.thirdweb.com/interfaces/erc721enumerable + - ERC721LazyMintable - https://portal.thirdweb.com/interfaces/erc721lazymintable + - ERC721SignatureMintV1 - https://portal.thirdweb.com/interfaces/erc721signaturemintv1 + - ERC721SignatureMintV2 - https://portal.thirdweb.com/interfaces/erc721signaturemintv2 + - ERC721TieredDrop - https://portal.thirdweb.com/interfaces/erc721tiereddrop + - ERC721ClaimCustom - https://portal.thirdweb.com/interfaces/erc721claimcustom + - ERC721ClaimZora - https://portal.thirdweb.com/interfaces/erc721claimzora + - ERC721ClaimConditionsV1 - https://portal.thirdweb.com/interfaces/erc721claimconditionsv1 + - ERC721ClaimConditionsV2 - https://portal.thirdweb.com/interfaces/erc721claimconditionsv2 + - ERC721ClaimPhasesV1 - https://portal.thirdweb.com/interfaces/erc721claimphasesv1 + - ERC721ClaimPhasesV2 - https://portal.thirdweb.com/interfaces/erc721claimphasesv2 + - ERC721SharedMetadata - https://portal.thirdweb.com/interfaces/erc721sharedmetadata + - ERC721LoyaltyCard - https://portal.thirdweb.com/interfaces/erc721loyaltycard + - ERC721UpdatableMetadata - https://portal.thirdweb.com/interfaces/erc721updatablemetadata + - Permissions - https://portal.thirdweb.com/interfaces/permissions + + โ„น Once you're done writing your contracts, you can run the following command to deploy them: + + yarn deploy + ``` + +#### **Deploying** the smart contract +All checks passed, which means that the smart contract is ready to be deployed using thirdweb. + +1. To do that, simply run: + ```bash + npx thirdweb deploy + ``` +2. If the smart contract doesn't have any errors, you will see the following output on the terminal: + ```text + ....... + + ๐Ÿ’Ž thirdweb v0.13.60 ๐Ÿ’Ž + + โœ” Detected project type: foundry + โœ” Compilation successful + โœ” Choose which contract(s) to deploy ยท NFT + โœ” Upload successful + // highlight-next-line + โœ” Open this link to deploy your contracts: https://thirdweb.com/contracts/deploy/QmSJExQJfPYFuaRZuDu9XRR2jUu9yp3kaFX3Sdc1KRWxiP + ``` + +3. The terminal will also open a browser window, directing towards a unique URL, as highlighted above. +4. Fill out the form as suggested in the [Fill Parameter](https://portal.thirdweb.com/contracts/deploy/deploy-contract#Fill%20parameter) section. +5. Once you fill out the details of the ERC721 smart contract, click on the `Deploy Now` button and it will deploy the contract to the chosen network of your wallet. + +:::info +If you want to test your Foundry-based contract, follow the steps mentioned in the [Testing the Smart Contract](/building-on-lisk/deploying-smart-contract/with-Foundry#testing-the-smart-contract) guide. +::: + + +## Interacting with the Smart Contract + +Once the contract is deployed, you can interact with it via Explore. +The following videos describe step-by-step, how to interact with different token contracts on Lisk. + +- [How to interact with a deployed **ERC-20** contract via Explore?](https://youtu.be/jYEqoIeAoBg?t=6823) +- [How to interact with a deployed **ERC-721** contract via Explore?](https://youtu.be/jYEqoIeAoBg?t=7581) +- [How to interact with a deployed **ERC-1155** contract via Explore?](https://youtu.be/jYEqoIeAoBg?t=8355) \ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/img/docsVersionDropdown.png b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/img/docsVersionDropdown.png new file mode 100644 index 000000000..97e416461 Binary files /dev/null and b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/img/docsVersionDropdown.png differ diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/img/localeDropdown.png b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/img/localeDropdown.png new file mode 100644 index 000000000..e257edc1f Binary files /dev/null and b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/img/localeDropdown.png differ diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/interacting-with-the-blockchain/ethers.md b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/interacting-with-the-blockchain/ethers.md new file mode 100644 index 000000000..5dfb966a2 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/interacting-with-the-blockchain/ethers.md @@ -0,0 +1,428 @@ +--- +title: ...with ethers.js +slug: /building-on-lisk/interacting-with-the-blockchain/ethers +description: Documentation for using ethers.js, a JavaScript library for EVM-compatible blockchain interactions. This page covers installation, setup, connecting to the Lisk network, reading and writing blockchain data, and interacting with smart contracts. +keywords: + [ + ethers.js, + JavaScript library, + Lisk network, + Lisk mainnet, + Lisk testnet, + smart contracts, + EVM-compatible, + blockchain, + JsonRpcProvider, + Signer, + ABI, + interacting with smart contract, + ] +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Interacting with the blockchain with ethers.js + +[ethers.js](https://docs.ethers.org/) is a JavaScript library that allows developers to interact with EVM-compatible blockchain networks. + +You can use ethers.js to interact with smart contracts deployed on the Lisk network. + + +## Install + +To install ethers.js run the following command: + +```bash +npm install --save ethers +``` + +## Setup + +Before you can start using ethers.js, you need to import it into your project. + +Add the following line of code to the top of your file to import ethers.js: + +```javascript +const ethers = require('ethers'); +``` + +## Connecting to Lisk + +You can connect to Lisk by instantiating a new ethers.js `JsonRpcProvider` object with an RPC URL of the Lisk network: + + + + ```javascript + const ethers = require('ethers'); + + const url = 'https://rpc.api.lisk.com'; + const provider = new ethers.JsonRpcProvider(url); + ``` + + + ```javascript + const ethers = require('ethers'); + + const url = 'https://rpc.sepolia-api.lisk.com'; + const provider = new ethers.JsonRpcProvider(url); + ``` + + + +:::note +A **Provider** (in ethers.js) is a class that provides an abstraction for a connection to the Ethereum Network. It provides read-only access to the Blockchain and its status. +::: + +## Reading data from the blockchain + +Once you have created a provider, you can use it to read data from the Lisk network. + +For example, you can use the `getBlockNumber` method to get the latest block: + +```javascript +async function getLatestBlock() { + const latestBlock = await provider.getBlockNumber(); + console.log("The latest block's number is:", latestBlock); +} + +getLatestBlock(); +``` + +
+Complete code example +```javascript +const ethers = require('ethers'); + +// For Lisk Sepolia network +const url = 'https://rpc.sepolia-api.lisk.com'; + +// For Lisk network +// const url = 'https://rpc.api.lisk.com'; + +const provider = new ethers.JsonRpcProvider(url); + +async function getLatestBlock() { + const latestBlock = await provider.getBlockNumber(); + console.log("The latest block's number is:", latestBlock); +} + +getLatestBlock(); +``` +
+ +## Writing data to the blockchain + +In order to write data to the Lisk network, you need to create a `Signer`. + +:::note +A **Signer** is a class that (usually) in some way directly or indirectly has access to a private key, which can sign messages and transactions to authorize the network to charge your account ether to perform operations. +::: + +You can create a `Signer` by instantiating a new ethers.js `Wallet` object, providing it with a private key and `Provider`. + +```javascript +const privateKey = 'PRIVATE_KEY'; +const signer = new ethers.Wallet(privateKey, provider); +const receiver = '0x5e1A92F84cA1CE280B3Cb29d79C3368f45b41EBB'; +// Send 0.01 ether to a given address. +async function sendTx(to) { + const tx = await signer.sendTransaction({ + to: to, + value: ethers.parseEther("0.01") + }); + + console.log(tx); +} + +//sendTx(receiver); +``` + +:::info +`PRIVATE_KEY` is the private key of the account that is to be used when creating the `signer` object. +::: + +The receiving account's balance will increment by `0.01` ETH once the transaction execution is successful. + +
+Complete code example +```javascript +const ethers = require('ethers'); + +// For Lisk Sepolia network +const url = 'https://rpc.sepolia-api.lisk.com'; + +// For Lisk network +// const url = 'https://rpc.api.lisk.com'; + +const provider = new ethers.JsonRpcProvider(url); +// Replace PRIVATE_KEY with the private key of your account. +const privateKey = 'PRIVATE_KEY'; +const signer = new ethers.Wallet(privateKey, provider); +const receiver = '0x5e1A92F84cA1CE280B3Cb29d79C3368f45b41EBB'; +// Send 0.01 ether to a given address. +async function sendTx(to) { + const tx = await signer.sendTransaction({ + to: to, + value: ethers.parseEther("0.01") + }); + + console.log(tx); +} + +sendTx(receiver); +``` +
+ +## Interacting with smart contracts + +You can use ethers.js to interact with a smart contract on Lisk by instantiating a `Contract` object using the ABI and address of a deployed contract: + +:::tip +The ABI of a contract can be found on the respective contract page in [BlockScout](https://sepolia-blockscout.lisk.com/). + +For example, you can use the ABI for the [Hello contract](https://sepolia-blockscout.lisk.com/address/0xb18eb752813c2fbedfdf2be6e5e842a85a3b8539?tab=contact_code). Just scroll down to `Contract ABI` and copy the deployed contract's ABI. +::: + +```javascript title="Reading from contracts" +// Replace the contractAddress' value with the desired contract. +const contractAddress = "CONTRACT_ADDRESS" +// read-only +const contract = new ethers.Contract(contractAddress, abi, provider); +const abi = [ +โ€ฆ // ABI of deployed contract +]; + +async function getHello() { + const value = await contract.message("0x3C46A11471f285E36EE8d089473ce98269D1b081"); + console.log(value.toString()); +} + +getHello(); +``` + +:::info +`CONTRACT_ADDRESS` is the address of the deployed contract. +::: + +:::note +A **Contract** (in ethers.js) is an abstraction that represents a connection to a specific contract on the Lisk Network, so that applications can use it like a normal JavaScript object. +::: + +For reading and writing contracts, provide a `Signer` object instead of a `Provider` object: + +```javascript title="Writing to contracts" +// read & write +const contract = new ethers.Contract(contractAddress, abi, signer); +``` + +Once you have created a `Contract` object, you can use it to call desired methods on the smart contract: + +```javascript +async function createHello(message) { + const tx = await contract.createHello(message); + return tx.hash; +} + +//createHello("Hello Lisk!"); +``` + +:::tip +For an overview of existing public functions for the contract, please check the [Read Contract](https://sepolia-blockscout.lisk.com/address/0xb18eb752813c2fbedfdf2be6e5e842a85a3b8539?tab=read_contract) and [Write Contract](https://sepolia-blockscout.lisk.com/address/0xb18eb752813c2fbedfdf2be6e5e842a85a3b8539?tab=write_contract) tabs for the specific contract. +::: + +
+Complete code example +```javascript +const ethers = require('ethers'); + +// For Lisk Sepolia network +const url = 'https://rpc.sepolia-api.lisk.com'; + +// For Lisk network +// const url = 'https://rpc.api.lisk.com'; + +const provider = new ethers.JsonRpcProvider(url); +const privateKey = 'PRIVATE_KEY'; +const signer = new ethers.Wallet(privateKey, provider); +const contractAddress = "0xb18eb752813c2fbedfdf2be6e5e842a85a3b8539" +// Read & Write +const contract = new ethers.Contract(contractAddress, abi, signer); +// Read-only +//const contract = new ethers.Contract(contractAddress, abi, provider); +const abi = [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "message", + "type": "string" + } + ], + "name": "NewHello", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "blacklist", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "counter", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "createHello", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxLength", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "message", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minLength", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "_newBlackList", + "type": "string[]" + } + ], + "name": "setBlacklist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_newMin", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "_newMax", + "type": "uint32" + } + ], + "name": "setMinMaxMessageLength", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] + +async function createHello(message) { + const tx = await contract.createHello(message); + return tx.hash; +} + +//createHello("Hello Lisk!"); + +async function getHello() { + const value = await contract.message("0x3C46A11471f285E36EE8d089473ce98269D1b081"); + console.log(value.toString()); +} + +getHello(); +``` +
\ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/interacting-with-the-blockchain/viem.mdx b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/interacting-with-the-blockchain/viem.mdx new file mode 100644 index 000000000..145b7ce6c --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/interacting-with-the-blockchain/viem.mdx @@ -0,0 +1,536 @@ +--- +title: ...with viem +slug: /building-on-lisk/interacting-with-blockchain/viem +description: Documentation for using Viem, a TypeScript interface for EVM-compatible blockchains. This page covers installation, setup, and various functionalities such as reading and writing blockchain data and interacting with smart contracts on Lisk. +keywords: + [ + viem, + Lisk, + Lisk mainnet, + Lisk testnet, + Ethereum, + smart contracts, + blockchain, + RPC URL, + JavaScript, + TypeScript, + ] +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Interacting with the blockchain with viem + +[viem](https://viem.sh/) a TypeScript interface for Ethereum that provides low-level stateless primitives for interacting with Ethereum. + +You can use viem to interact with smart contracts deployed on Lisk. +Viem provides first-class support for chains implemented on the OP stack, see [viem.sh > OP stack](https://viem.sh/op-stack). + +## Install + +To install viem run the following command: + +```bash +npm install --save viem +``` + +## Setup + +Before you can start using viem, you need to setup a [Client](https://viem.sh/op-stack/client) with a desired [Transport](https://viem.sh/docs/clients/intro.html#transports) and [Chain](https://viem.sh/docs/chains/introduction). + +### Public Client + +In order to read data from Lisk, you need to create a **Public client**. + +By extending the public client with `publicActionsL2` or `publicActionsL1`, you have access to additional methods for Lisk and other chains built on top of the OP stack. +See [Layer 2 extensions](https://viem.sh/op-stack/client#layer-2-extensions) for more information. + + + + ```javascript title="public-client.js" + import { createPublicClient, http } from 'viem' + import { lisk, ethereum } from 'viem/chains' + import { publicActionsL2, publicActionsL1 } from 'viem/op-stack' + + export const publicClientL2 = createPublicClient({ + chain: lisk, + transport: http() + }).extend(publicActionsL2()) + + export const publicClientL1 = createPublicClient({ + chain: ethereum, + transport: http() + }).extend(publicActionsL1()) + ``` + + + ```javascript title="public-client.js" + import { createPublicClient, http } from 'viem' + import { liskSepolia, sepolia } from 'viem/chains' + import { publicActionsL2, publicActionsL1 } from 'viem/op-stack' + + export const publicClientL2 = createPublicClient({ + chain: liskSepolia, + transport: http() + }).extend(publicActionsL2()) + + export const publicClientL1 = createPublicClient({ + chain: sepolia, + transport: http() + }).extend(publicActionsL1()) + ``` + + + +### Wallet Client + +In order to write data to Lisk, you need to create a Wallet client (`createWalletClient`) and specify an [`Account`](https://ethereum.org/en/developers/docs/accounts/) to use. + +By extending the wallet client with `walletActionsL1` or `walletActionsL2`, you have access to additional methods for Lisk and other chains built on top of the OP stack. +See [Layer 2 extensions](https://viem.sh/op-stack/client#layer-2-extensions) for more information. + + + + + + + + ```js title="wallet-client.js" + import { createWalletClient, custom } from 'viem' + import { ethereum, lisk } from 'viem/chains' + import { walletActionsL1, walletActionsL2 } from 'viem/op-stack' + + // Retrieve Account from an EIP-1193 Provider. + const [account] = await window.ethereum.request({ + method: 'eth_requestAccounts' + }) + + export const walletClientL1 = createWalletClient({ + account, + chain: ethereum, + transport: custom(window.ethereum) + }).extend(walletActionsL1()); + + export const walletClientL2 = createWalletClient({ + account, + chain: lisk, + transport: custom(window.ethereum) + }).extend(walletActionsL2()); + ``` + + + ```js title="wallet-client.js" + import { createWalletClient, custom } from 'viem' + import { sepolia, liskSepolia } from 'viem/chains' + import { walletActionsL1, walletActionsL2 } from 'viem/op-stack' + + // Retrieve Account from an EIP-1193 Provider. + const [account] = await window.ethereum.request({ + method: 'eth_requestAccounts' + }) + + export const walletClientL1 = createWalletClient({ + account, + chain: sepolia, + transport: custom(window.ethereum) + }).extend(walletActionsL1()); + + export const walletClientL2 = createWalletClient({ + account, + chain: liskSepolia, + transport: custom(window.ethereum) + }).extend(walletActionsL2()); + ``` + + + + + + + + +Replace `` with the private key of the account you want to use. +The `0x` prefix indicates that the following string is a hexadecimal number. + + + + ```js title="wallet-client.js" + import { createWalletClient, http } from 'viem' + import { privateKeyToAccount } from 'viem/accounts' + import { ethereum, lisk } from 'viem/chains' + import { walletActionsL1, walletActionsL2 } from 'viem/op-stack' + + // Wallet client for Ethereum + export const walletClientL1 = createWalletClient({ + account: privateKeyToAccount('0x'), + chain: ethereum, + transport: http() + }).extend(walletActionsL1()); + + // Wallet client for Lisk + export const walletClientL2 = createWalletClient({ + account: privateKeyToAccount('0x'), + chain: lisk, + transport: http() + }).extend(walletActionsL2()); + ``` + + + ```js title="wallet-client.js" + import { createWalletClient, http } from 'viem' + import { privateKeyToAccount } from 'viem/accounts' + import { sepolia, liskSepolia } from 'viem/chains' + import { walletActionsL1, walletActionsL2 } from 'viem/op-stack' + + // Wallet client for Ethereum + export const walletClientL1 = createWalletClient({ + account: privateKeyToAccount('0x'), + chain: sepolia, + transport: http() + }).extend(walletActionsL1()); + + // Wallet client for Lisk + export const walletClientL2 = createWalletClient({ + account: privateKeyToAccount('0x'), + chain: liskSepolia, + transport: http() + }).extend(walletActionsL2()); + ``` + + + + + + + + +:::info +In addition to making a JSON-RPC request (`eth_requestAccounts`) to get an Account, viem provides various helper methods for creating an `Account`, including: [`privateKeyToAccount`](https://viem.sh/docs/accounts/privateKey.html), [`mnemonicToAccount`](https://viem.sh/docs/accounts/mnemonic.html), and [`hdKeyToAccount`](https://viem.sh/docs/accounts/hd.html). + +{ /* To use Lisk Sepolia (testnet), replace `lisk` with `liskSepolia`. + */} +::: + +## Reading data from the blockchain + +Create a [public client](#public-client) and use it to read and access data from Lisk using [Public Actions](https://viem.sh/docs/actions/public/introduction) and [OP stack public actions](https://viem.sh/op-stack/client#layer-2-extensions). + +Public Actions are client methods that map one-to-one with a "public" Ethereum RPC method (`eth_blockNumber`, `eth_getBalance`, etc.). + +For example, you can use the `getBlockNumber` action to get the latest block: + +```javascript title="read-example.js" +import { parseEther } from 'viem' +import { publicClientL2 } from './public-client.js' + +const blockNumber = await publicClientL2.getBlockNumber(); + +export const l1Gas = await publicClientL2.estimateL1Gas({ + account: '0x3C46A11471f285E36EE8d089473ce98269D1b081', + to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', + value: parseEther('0.1') +}) + +console.log(blockNumber); +console.log(l1Gas); +``` + + +## Writing data to the blockchain + +Create a [wallet client](#wallet-client) and use it to read and access data from Lisk using [Wallet Actions](https://viem.sh/docs/actions/wallet/introduction) and [OP stack wallet actions](https://viem.sh/op-stack/client#layer-2-extensions). + +Wallet Actions are actions that map one-to-one with a "wallet" or "signable" Ethereum RPC method (`eth_requestAccounts`, `eth_sendTransaction`, etc). + +For example, you can use the `sendTransaction` action to post a transaction: + +```javascript title="write-example.js" +import { walletClientL2 } from './wallet-client.js' + +const hash = await walletClientL2.sendTransaction({ + to: '0x...', + value: 1000000000000000000n +}) + +console.log(hash); +``` + +## Interacting with smart contracts + +You can use viem to interact with a smart contract on Lisk by creating a `Contract` instance using [`getContract`](https://viem.sh/docs/contract/getContract.html) and passing it the contract ABI, contract address, and and [Public](https://viem.sh/docs/clients/public.html) and/or [Wallet](https://viem.sh/docs/clients/wallet.html) Client: + + + + +```js title="contract-example.js" +import { getContract } from 'viem' +import { wagmiAbi } from './abi.js' +import { publicClient, walletClient } from './client.js' + +// 1. Create contract instance +const contract = getContract({ + address: 'CONTRACT_ADDRESS', + abi: wagmiAbi, + // 1a. Insert a single client + //client: publicClient, + // 1b. Or public and/or wallet clients + client: { public: publicClient, wallet: walletClient } +}) + +// 2. Call contract methods, fetch events, listen to events, etc. +const result = await contract.read.totalSupply() +const logs = await contract.getEvents.Transfer() +const unwatch = contract.watchEvent.Transfer( + { from: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e' }, + { onLogs(logs) { console.log(logs) } } +) +``` + + + + + + + ```js title="client.js" + import { createPublicClient, createWalletClient, http, custom } from 'viem' + import { lisk } from 'viem/chains' + import { EthereumProvider } from '@walletconnect/ethereum-provider' + import { publicActionsL2 } from 'viem/op-stack' + + export const publicClient = createPublicClient({ + chain: lisk, + transport: http(), + }).extend(publicActionsL2()); + + // eg: Metamask + export const walletClient = createWalletClient({ + chain: lisk, + transport: custom(window.ethereum), + }) + + // eg: WalletConnect + const provider = await EthereumProvider.init({ + projectId: "abcd1234", + showQrModal: true, + chains: [1], + }) + + export const walletClientWC = createWalletClient({ + chain: lisk, + transport: custom(provider), + }) + ``` + + + ```js title="client.js" + import { createPublicClient, createWalletClient, http, custom } from 'viem' + import { liskSepolia } from 'viem/chains' + import { EthereumProvider } from '@walletconnect/ethereum-provider' + import { publicActionsL2 } from 'viem/op-stack' + + export const publicClient = createPublicClient({ + chain: liskSepolia, + transport: http(), + }).extend(publicActionsL2()); + + // eg: Metamask + export const walletClient = createWalletClient({ + chain: liskSepolia, + transport: custom(window.ethereum), + }) + + // eg: WalletConnect + const provider = await EthereumProvider.init({ + projectId: "abcd1234", + showQrModal: true, + chains: [1], + }) + + export const walletClientWC = createWalletClient({ + chain: liskSepolia, + transport: custom(provider), + }) + ``` + + + + + + + + +:::tip +The ABI of a contract can be found on the respective contract page in [BlockScout](https://sepolia-blockscout.lisk.com/). +::: + +```js title="abi.js" +export const wagmiAbi = [ + [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "message", + "type": "string" + } + ], + "name": "NewHello", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "blacklist", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "counter", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "createHello", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxLength", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "message", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minLength", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "_newBlackList", + "type": "string[]" + } + ], + "name": "setBlacklist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_newMin", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "_newMax", + "type": "uint32" + } + ], + "name": "setMinMaxMessageLength", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] +]; +``` + + + +:::info +`CONTRACT_ADDRESS` is the address of the deployed contract. +::: \ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/interacting-with-the-blockchain/web3.mdx b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/interacting-with-the-blockchain/web3.mdx new file mode 100644 index 000000000..5ecf0393b --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/interacting-with-the-blockchain/web3.mdx @@ -0,0 +1,831 @@ +--- +title: ...with web3.js +slug: /building-on-lisk/interacting-with-the-blockchain/web3 +description: Documentation for using web3.js, a JavaScript library for EVM-compatible blockchain interactions. This page covers installation, setup, connecting to the Lisk network, reading and writing blockchain data, and interacting with smart contracts. +keywords: + [ + web3.js, + JavaScript library, + Lisk network, + Lisk mainnet, + Lisk testnet, + smart contracts, + EVM-compatible, + blockchain, + Web3, + Wallet, + ABI, + eth, + interacting with smart contract, + ] +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Interacting with the blockchain via web3.js + +[web3.js](https://web3js.org/) is a JavaScript library for building and interacting with EVM-compatible blockchain networks. + +You can also use web3.js to interact with smart contracts deployed on the Lisk network. + + +## Install + +To install web3.js run the following command: + + + ```bash + npm install --save web3 + ``` + + + ```bash + yarn add web3 + ``` + + + +## Import + +Before you can start using web3.js, you need to import it into your project. + +Web3.js supports both CommonJS and native ESM module imports. + +Add the following line of code to the top of your file to import web3.js: + + + ```js + const { Web3 } = require('web3'); + ``` + + + ```ts + import { Web3 } from 'web3'; + ``` + + + +## Connecting to Lisk + +You can connect to Lisk by instantiating a new `Web3` object with an RPC URL of the Lisk network: + + + + + ```javascript + import { Web3 } from 'web3'; + + // Instantiate a web3 object by passing the RPC URL of Lisk. + const web3 = new Web3('https://rpc.api.lisk.com'); + ``` + + + ```javascript + import { Web3 } from 'web3'; + + // Instantiate a web3 object by passing the RPC URL of Lisk Sepolia. + const web3 = new Web3('https://rpc.sepolia-api.lisk.com'); + ``` + + + + + +### Reading data from the blockchain + +Once you have created the `Web3` object, you can use it to read data from the Lisk network. + +For example, you can use the `getBlockNumber` method to get the latest block: + +```javascript +// Retrieve data from blockchain +async function getLatestBlock() { + const latestBlock = await web3.eth.getBlockNumber() + console.log("The latest block's number is:", latestBlock); +} + +getLatestBlock(); +``` +
+ Complete code example + ```javascript + import { Web3 } from 'web3'; + + // Instantiate a web3 object by passing the RPC URL of Lisk Sepolia. + const web3 = new Web3('https://rpc.sepolia-api.lisk.com'); + + // Instantiate a web3 object by passing the RPC URL of Lisk. + // const web3 = new Web3('https://rpc.api.lisk.com'); + + // Retrieve data from blockchain + async function getLatestBlock() { + const latestBlock = await web3.eth.getBlockNumber() + console.log("The latest block's number is:", latestBlock); + } + + getLatestBlock(); + ``` +
+ + + + + +:::tip +Web3 provides a wide range of [Web3Eth methods](https://docs.web3js.org/guides/web3_eth/methods/) that can be used to interact with the blockchain. +::: + +### Writing data to the blockchain + +To write data to the Lisk network, you need to create a [`Wallet`](https://docs.web3js.org/guides/wallet/). + +:::note +A web3.js `Wallet` is your main entry point if you want to use a private key to do any blockchain operations e.g., sending transactions, etc. +It is also called a `Signer` in other libraries. +::: + +You can create a `Wallet` by instantiating a new Web3 `Wallet` object and the add private key(s) into it. +Such private key(s) can later be used to send transactions on the blockchain. + +```javascript +// Add an account to a wallet +const privateKey = '0x'; +const account = web3.eth.accounts.wallet.add(privateKey); + +// Create transaction object to send '.0001' eth to '0x.....' address from the account[0] +const tx = +{ + from: account[0].address, + to: '', + value: web3.utils.toWei('.0001', 'ether') +}; +// The 'from' address must match the one previously added with 'wallet.add' + +// Send the transaction +const txReceipt = await web3.eth.sendTransaction(tx); + +console.log('Tx hash:', txReceipt.transactionHash) +``` + +:::info +`PRIVATE_KEY` is the private key of the account that is used to sign and send a transaction using web3.js. +::: + +The receiving account's balance will increment by `0.0001` ETH once the transaction execution is successful. + +
+ Complete code example + ```js + import { Web3 } from 'web3'; + + // Instantiate a web3 object by passing the RPC URL of Lisk Sepolia. + const web3 = new Web3('https://rpc.sepolia-api.lisk.com'); + + // Instantiate a web3 object by passing the RPC URL of Lisk. + // const web3 = new Web3('https://rpc.api.lisk.com'); + + // Add an account to a wallet + const privateKey = '0x'; + const account = web3.eth.accounts.wallet.add(privateKey); + + // Create transaction object to send '.0001' eth to '0x.....' address from the account[0] + const tx = + { + from: account[0].address, + to: '', + value: web3.utils.toWei('.0001', 'ether') + }; + // The 'from' address must match the one previously added with 'wallet.add' + + // Send the transaction + const txReceipt = await web3.eth.sendTransaction(tx); + + console.log('Tx hash:', txReceipt.transactionHash) + ``` +
+ + + + +## Interacting with smart contracts + +You can use web3.js to interact with a smart contract on Lisk by instantiating a `Contract` object and passing it the `ABI` and `address` of a deployed contract. + +In the following sections, we will: +- Read data from a deployed contract, specifically, we will fetch the **name of the contract**. +- Furthermore, we will **mint a token**, via an already deployed contract. + +:::tip +For an overview of existing public functions for the contract, please check the [Read Contract](https://sepolia-blockscout.lisk.com/token/0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5?tab=read_contract) and [Write Contract](https://sepolia-blockscout.lisk.com/token/0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5?tab=write_contract) tabs for the specific contract. +::: + + +### Reading from smart contracts +To read data from a smart contract, one needs to pass the `address` and `abi` of the deployed & verfied contract. +Once the aforementioned information is passed, any read-only function of the smart contract can be called, as described below: + + + + ```js title="Fetching the contract's name" + // Address of the contract you want to interact with. + const address = '0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5'; + + // Instantiate the contract object + const contract = new web3.eth.Contract(abi, address); + + // Call any of the 'Read contract' functions e.g. 'name()' + const contractName = await contract.methods.name().call(); + + console.log('Contract\'s Name is: ', contractName); + ``` +
+ Complete code example + ```javascript title="get-contract-name.js" + import { Web3 } from 'web3'; + import { abi } from './abi.js'; + + // Instantiate a web3 object by passing the RPC URL of Lisk Sepolia. + const web3 = new Web3('https://rpc.sepolia-api.lisk.com'); + + // Instantiate a web3 object by passing the RPC URL of Lisk. + // const web3 = new Web3('https://rpc.api.lisk.com'); + + // Address of the contract you want to interact with. + const address = '0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5'; + + // Instantiate the contract object + const contract = new web3.eth.Contract(abi, address); + + // Call any of the 'Read contract' functions e.g. 'name()' + const contractName = await contract.methods.name().call(); + + console.log('Contract\'s Name is: ', contractName); + ``` + + ```text title="Output" + Contract's Name is: Lisk + ``` +
+ + +
+ +:::tip +The ABI of a contract can be found on the respective contract page in [BlockScout](https://sepolia-blockscout.lisk.com/). + +For example, you can use the ABI for the [Lisk NFT Token contract](https://sepolia-blockscout.lisk.com/token/0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5?tab=contract). +Just scroll down to `Contract ABI` and copy the deployed contract's ABI. +::: + + +```js title="abi.js" +export const abi = [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "ERC721IncorrectOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ERC721InsufficientApproval", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "approver", + "type": "address" + } + ], + "name": "ERC721InvalidApprover", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "ERC721InvalidOperator", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "ERC721InvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "ERC721InvalidReceiver", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "ERC721InvalidSender", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ERC721NonexistentToken", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentTokenId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +]; +``` + +
+ +### Writing to smart contracts + +To write data through a contract's method, a few things are required such as: + +- contract's address +- recipient's address +- private key of the sender +- ... and the method's name + +Use the following snippet to interact with an already [deployed contract's](https://sepolia-blockscout.lisk.com/address/0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5?tab=write_contract) `mint()` function. + + +```javascript title="miniting-token.js" +// Address of the contract you want to interact with. +const contractAddress = '0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5'; + +// Address of the Recipient account receiving the NFT. +const recipientAddress = 'RECIPIENT_ADDRESS' +const amount = web3.utils.toWei('.0001', 'ether') + +// PRIVATE_KEY of the sender's account. +const privateKey = 'PRIVATE_KEY'; +const account = web3.eth.accounts.wallet.add(privateKey); + +// Instantiate the contract object +const contract = new web3.eth.Contract(abi, contractAddress); + +// Send a request to the 'mint()' function to mint a token. +const txReceipt = await contract.methods.mint(recipientAddress, amount).send({ from: account[0].address }); + +console.log('Tx hash:', txReceipt.transactionHash); +``` + +
+Complete code example +```javascript title="miniting-token.js" +import { Web3 } from 'web3'; +import { abi } from './abi.js'; + +// Instantiate a web3 object by passing the RPC URL of Lisk. +const web3 = new Web3('https://rpc.sepolia-api.lisk.com'); + +// For Lisk network +//const web3 = new Web3('https://rpc.api.lisk.com'); + +// Address of the contract you want to interact with. +const contractAddress = '0x108872F713A27bc22ca1db8CEefCAC8CbeDdF9E5'; + +// Address of the Recipient account receiving the NFT. +const recipientAddress = 'RECIPIENT_ADDRESS' +const amount = web3.utils.toWei('.0001', 'ether') + +// PRIVATE_KEY of the sender's account. +const privateKey = 'PRIVATE_KEY'; +const account = web3.eth.accounts.wallet.add(privateKey); + +// Instantiate the contract object +const contract = new web3.eth.Contract(abi, contractAddress); + +// Send a request to the 'mint()' function to mint a token. +const txReceipt = await contract.methods.mint(recipientAddress, amount).send({ from: account[0].address }); + +console.log('Tx hash:', txReceipt.transactionHash); +``` + +```text title="Output" +Transaction hash: 0xe654513f453623d9ce329b575985b7fcd09116325d10150d7cd30dcdedc124a9 +``` + +:::info +You can use the transaction hash received above to check the details of the `mint` transaction on Blockscout Explorer: [`0xe654513f453623d9ce329b575985b7fcd09116325d10150d7cd30dcdedc124a9`](https://sepolia-blockscout.lisk.com/tx/0xe654513f453623d9ce329b575985b7fcd09116325d10150d7cd30dcdedc124a9). +::: +
\ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/run-a-lisk-node.md b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/run-a-lisk-node.md new file mode 100644 index 000000000..81e4448b9 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/run-a-lisk-node.md @@ -0,0 +1,118 @@ +--- +title: Running a Lisk Node +slug: /building-on-lisk/run-a-lisk-node +description: A tutorial that teaches how to set up and run a Lisk Node. +keywords: + [ + Lisk Node setup, + running a node, + Lisk node, + run a Lisk node, + hardware requirements, + node synchronization, + node snapshots, + Lisk chain, + Lisk blockchain, + Lisk network, + node deployment, + Ethereum node, + ] +tags: ['nodes'] +difficulty: beginner +--- + +This tutorial will walk you through setting up your own [Lisk Node]. + +## Objectives + +By the end of this tutorial you should be able to: + +- Deploy and sync a Lisk node + +## Prerequisites + +:::caution + +Running a node is time consuming, resource expensive, and potentially costly. If you don't already know why you want to run your own node, you probably don't need to. + +If you're just getting started and need an RPC URL, you can use our free endpoints: + +- **Mainnet**: `https://rpc.api.lisk.com` +- **Testnet (Sepolia)**: `https://rpc.sepolia-api.lisk.com` + +**Note:** Our RPCs are rate-limited, they are not suitable for production apps. + +If you're looking to harden your app and avoid rate-limiting for your users, please check out one of our [partners]. + +::: + +## System requirements + +The following system requirements are recommended to run a Lisk L2 node. + +### Memory + +- Modern multi-core CPU with good single-core performance. +- Machines with a minimum of 16 GB RAM (32 GB recommended). + +### Storage + +- Machines with a high performance SSD drive with at least 750GB (full node) or 4.5TB (archive node) free. + +## Usage + +:::note +It is currently not possible to run the nodes with the `--op-network` flag until the configs for Lisk have been merged into the [superchain-registry](https://github.com/ethereum-optimism/superchain-registry). + +There is currently an [open PR](https://github.com/ethereum-optimism/superchain-registry/pull/234) to add the Lisk Mainnet config. +The Lisk Sepolia Testnet will be supported soon as well. +::: + +### Clone the Repository + +```sh +git clone https://github.com/LiskHQ/lisk-node.git +``` + +```sh +cd lisk-node +``` + +### Docker + +1. Ensure you have an Ethereum L1 full node RPC available (not Lisk), and set the `OP_NODE_L1_ETH_RPC` and the `OP_NODE_L1_BEACON` variables (within the `.env.*` files, if using docker-compose). + If running your own L1 node, it needs to be synced before the Lisk node will be able to fully sync. +2. Please ensure that the environment file relevant to your network (`.env.sepolia`, or `.env.mainnet`) is set for the `env_file` properties within `docker-compose.yml`. + By default, it is set to `.env.mainnet`. + :::info + We currently support running either the `op-geth` or the `op-reth` nodes alongside the `op-node`. By default, we run the `op-geth` node. If you would like to run the `op-reth` node instead, please set the `CLIENT` environment variable to `reth` before starting the node. + ::: +3. Run: + + ``` + docker compose up --build --detach + ``` + +4. You should now be able to `curl` your Lisk node: + ``` + curl -s -d '{"id":0,"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false]}' \ + -H "Content-Type: application/json" http://localhost:8545 + ``` + +### Syncing + +Sync speed depends on your L1 node, as the majority of the chain is derived from data submitted to the L1. +You can check your syncing status using the `optimism_syncStatus` RPC on the `op-node` container. +Example: + +``` +command -v jq &> /dev/null || { echo "jq is not installed" 1>&2 ; } +echo Latest synced block behind by: \ +$((($( date +%s )-\ +$( curl -s -d '{"id":0,"jsonrpc":"2.0","method":"optimism_syncStatus"}' -H "Content-Type: application/json" http://localhost:7545 | + jq -r .result.unsafe_l2.timestamp))/60)) minutes +``` + + +[partners]: /lisk-tools/api-providers +[lisk node]: https://github.com/LiskHQ/lisk-node \ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/token-development/deploy-erc-1155.md b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/token-development/deploy-erc-1155.md new file mode 100644 index 000000000..10f047892 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/token-development/deploy-erc-1155.md @@ -0,0 +1,120 @@ +--- +title: 'Deploying a new ERC-1155 token on Lisk' +description: 'A guide on how to deploy a new ERC-1155 token on Lisk.' +keywords: + [ + 'Lisk', + 'Token development', + 'Deploy token', + 'ERC', + 'EIP', + 'ERC-1155', + 'Hybrid token', + 'Multi token', + ] +--- + +# How to deploy a new ERC-1155 token on Lisk + +:::note +We will use Remix IDE for smart contract development in this guide, but feel free to choose a [smart contract development framework](/category/building-on-lisk/deploying-smart-contract) of your choice to implement your token contract. +::: + +## 1. Open Remix + +Navigate to [Remix](https://remix.ethereum.org) in your browser. + +## 2. Create a new file +Inside the `contracts` folder, click the ๐Ÿ“„ ("Create new file") button to create a new empty Solidity file. +You can name this file whatever you'd like, e.g., `MyItems.sol`. + +## 3. Copy the example contract + +Copy the following example contract into your new file: + +```solidity +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; + +contract MyItems is ERC1155 { + uint256 public constant GOLD = 0; + uint256 public constant SILVER = 1; + uint256 public constant THORS_HAMMER = 2; + uint256 public constant SWORD = 3; + uint256 public constant SHIELD = 4; + + constructor() ERC1155("https://game.example/api/item/{id}.json") { + _mint(msg.sender, GOLD, 10**18, ""); + _mint(msg.sender, SILVER, 10**27, ""); + _mint(msg.sender, THORS_HAMMER, 1, ""); + _mint(msg.sender, SWORD, 10**9, ""); + _mint(msg.sender, SHIELD, 10**9, ""); + } +} +``` + +:::note +Gold, Silver,Sword and shield are fungible tokens whilst Thorโ€™s Hammer is a non-fungible token as we minted only one. +::: + +An URI pointing to the JSON metadata of the different items/ tokens needs to be specified in the constructor, see [ERC-1155 contract API](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#ERC1155). + +The URI can include the string `{id}`, which clients must replace with the actual token ID, in lowercase hexadecimal (with no 0x prefix) and leading zero-padded to 64 hex characters. +The URI MUST point to a JSON file that conforms to the [ERC-1155 Metadata URI JSON Schema](https://eips.ethereum.org/EIPS/eip-1155). + + +For token ID 2 and uri `https://game.example/api/item/{id}.json` clients would replace `{id}` with `0000000000000000000000000000000000000000000000000000000000000002` to retrieve JSON at `https://game.example/api/item/0000000000000000000000000000000000000000000000000000000000000002.json`. + +The JSON document for token ID 2 might look something like: + +```json +{ + "name": "Thor's hammer", + "description": "Mjรถlnir, the legendary hammer of the Norse god of thunder.", + "image": "https://game.example/item-id-8u5h2m.png", + "strength": 20 +} +``` + +For more information about the metadata JSON Schema, check out the [ERC-1155 Metadata URI JSON Schema](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md#erc-1155-metadata-uri-json-schema). + +## 4. Compile the contract + +Please double-check that the compiler version of the Remix IDE is matching with the compiler version mentioned in the smart contract: `pragma solidity ^0.8.28;`. + +Press the green play button at the top to compile the contract. + +## 5. Deploy the contract + +Open the `Deploy & run transactions` tab (this looks like an Ethereum logo with an arrow pointing right). +Make sure that your environment is set to "Injected Provider", your wallet is connected to Lisk or Lisk Sepolia network, and Remix has access to your wallet. +Then, select the `MyItems` contract from the deployment dropdown and click the orange `Deploy` button to deploy the contract. +Finally, confirm the contract deployment in your connected wallet. + +Check the Remix log messages; they should include the contract address. +Paste this address in BlockScout, to see the contract in the Lisk blockchain explorer: https://sepolia-blockscout.lisk.com/address/0x8b2f45e810F539647e70fBCd6441B73d332Ef1A0 + +In case you chose to deploy on the Lisk Mainnet, you need to paste the address on https://blockscout.lisk.com instead. + +## 6. Verify the contract + +If you want to interact with your contract on the block explorer, you, or someone else needs to verify it first. +The above contract has already been verified, so you should be able to view your version on a block explorer already. +For the remainder of this guide, we'll walk you through how to verify your contract with Remix on the Lisk Sepolia Testnet. + +You can apply the same steps for verifying a contract on Lisk Mainnet, in case you deployed it there in the previous step, just use https://blockscout.lisk.com instead of https://sepolia-blockscout.lisk.com in step 2. + +1. In Remix, rightlick on the contract you wish to verify and select `Flatten`. +This will create a new file `MyItems_flattened.sol`. +2. Now, switch to your [newly deployed contract](https://sepolia-blockscout.lisk.com/address/0x8b2f45e810F539647e70fBCd6441B73d332Ef1A0) on https://sepolia-blockscout.lisk.com/ +3. Go to the `Contract` tab and click on the blue `Verify and Publish` button. + - (Optional) Set a license for your contract. + - Choose `Solidity (Single file)` as the verification method. + - Choose the fitting compiler version for your contract. + - Disable code optimization. + - Copy the flattened source code from Remix and paste it into the `Enter the Solidity Contract Code` field. +- Check that all info is correct and click the `Verify and Publish` button, to verify your contract. + + Once verified, the code tab will include the โœ… icon, and the source code will be viewable. diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/token-development/deploy-erc-20.md b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/token-development/deploy-erc-20.md new file mode 100644 index 000000000..80a81ad36 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/token-development/deploy-erc-20.md @@ -0,0 +1,95 @@ +--- +title: 'Deploying a new ERC-20 token on Lisk' +description: 'A guide on how to deploy a new ERC-20 token on Lisk.' +keywords: + [ + 'Lisk', + 'Token development', + 'Deploy token', + 'ERC', + 'EIP', + 'ERC-20', + 'Fungible token', + ] +--- + +# How to deploy a new ERC-20 token on Lisk + +This guide explains how to deploy a new ERC-20 token to Lisk. +In case you want to bridge an existing token from Ethereum, please refer to the guide [Bridging an L1 token to Lisk](../add-token-to-lisk). + +:::note +We will use Remix IDE for smart contract development in this guide, but feel free to choose a [smart contract development framework](/category/building-on-lisk/deploying-smart-contract) of your choice to implement your token contract. +::: + +## 1. Open Remix + +Navigate to [Remix](https://remix.ethereum.org) in your browser. + +## 2. Create a new file + +Inside the `contracts` folder, click the ๐Ÿ“„ ("Create new file") button to create a new empty Solidity file. +You can name this file whatever you'd like, e.g., `MyToken.sol`. + +## 3. Copy the example contract + +Copy the following example contract into your new file: + +```solidity +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +contract MyToken is ERC20 { + constructor(string memory _name, string memory _symbol, uint256 initialSupply) ERC20(_name, _symbol) { + _mint(msg.sender, initialSupply); + } + +} +``` + +## 4. Compile the contract + +Please double-check that the compiler version of the Remix IDE is matching with the compiler version mentioned in the smart contract: `pragma solidity ^0.8.28;`. + +Press the green play button at the top to compile the contract. + +## 5. Deploy the contract + +Open the `Deploy & run transactions` tab (this looks like an Ethereum logo with an arrow pointing right). +Make sure that your environment is set to "Injected Provider", your wallet is connected to the Lisk or Lisk Sepolia network, and Remix has access to your wallet. +Then, select the `MyToken` contract from the deployment dropdown and deploy it with the parameters of your choice, for example: + +- Name: MyToken +- Symbol: MYT +- InitalSupply: 1000000000000000000000 + +Click on the orange `transact` button to deploy the contract. +Finally, confirm the contract deployment in your connected wallet. + +Check the Remix log messages; they should include the contract address. +Paste this address in BlockScout, to see the contract in the Lisk blockchain explorer: https://sepolia-blockscout.lisk.com/address/0x6e8fF2E042c1637a2Da9563763c62362a3bbD712 + +In case you chose to deploy on the Lisk Mainnet, you need to paste the address on https://blockscout.lisk.com instead. + +## 6. Verify the contract + +If you want to interact with your contract on the block explorer, you, or someone else needs to verify it first. +The above contract has already been verified, so you should be able to view your version on a block explorer already. +For the remainder of this guide, we'll walk through how to verify your contract with Remix on the Lisk Sepolia Testnet. + +You can apply the same steps for verifying a contract on Lisk Mainnet in case you deployed it there in the previous step, just use https://blockscout.lisk.com instead of https://sepolia-blockscout.lisk.com in step 2. + +1. In Remix, rightlick on the contract you wish to verify and select `Flatten`. + This will create a new file `MyToken_flattened.sol`. +2. Now, switch to your [newly deployed contract](https://sepolia-blockscout.lisk.com/address/0x6e8fF2E042c1637a2Da9563763c62362a3bbD712) on https://sepolia-blockscout.lisk.com/ +3. Go to the contract tab and click on the blue `Verify and Publish` button. + - (Optional) Set a license for your contract. + - Choose `Solidity (Single file)` as the verification method. + - Choose the fitting compiler version for your contract. + - Disable code optimization. + - Copy the flattened source code from Remix and paste it into the `Enter the Solidity Contract Code` field. +4. Check that all info is correct and click the `Verify and Publish` button, to verify your contract. + + Once verified, the code tab will include the โœ… icon, and the source code will be viewable. diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/token-development/deploy-erc-721.md b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/token-development/deploy-erc-721.md new file mode 100644 index 000000000..dfe6fff23 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/token-development/deploy-erc-721.md @@ -0,0 +1,90 @@ +--- +title: 'Deploying a new ERC-721 token on Lisk' +description: 'A guide on how to deploy a new ERC-721 token on Lisk.' +keywords: + [ + 'Lisk', + 'Token development', + 'Deploy token', + 'ERC', + 'EIP', + 'ERC-721', + 'NFT', + ] +--- + +# How to deploy a new ERC-721 token on Lisk + +:::note +We will use Remix IDE for smart contract development in this guide, but feel free to choose a [smart contract development framework](/category/building-on-lisk/deploying-smart-contract) of your choice to implement your token contract. +::: + +## 1. Open Remix + +Navigate to [Remix](https://remix.ethereum.org) in your browser. + +## 2. Create a new file + +Inside the `contracts` folder, click the ๐Ÿ“„ ("Create new file") button to create a new empty Solidity file. +You can name this file whatever you'd like, e.g., `MyNFT.sol`. + +## 3. Copy the example contract + +Copy the following example contract into your new file: + +```solidity +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; + +contract MyNFT is ERC721 { + uint256 public currentTokenId; + + constructor() ERC721("My NFT", "MNFT") {} + + function mint(address recipient) public returns (uint256) { + uint256 newItemId = ++currentTokenId; + _safeMint(recipient, newItemId); + return newItemId; + } +} +``` + +## 4. Compile the contract + +Please double-check that the compiler version of the Remix IDE is matching with the compiler version mentioned in the smart contract: `pragma solidity ^0.8.28;`. + +Press the green play button at the top to compile the contract. + +## 5. Deploy the contract + +Open the `Deploy & run transactions` tab (this looks like an Ethereum logo with an arrow pointing right). +Make sure that your environment is set to "Injected Provider", your wallet is connected to Lisk or Lisk Sepolia network, and Remix has access to your wallet. +Then, select the `MyNFT` contract from the deployment dropdown and click the orange `Deploy` button to deploy the contract and confirm the contract deployment in your connected wallet. + +Check the Remix log messages; they should include the contract address. +Paste this address in BlockScout, to see the contract in the Lisk blockchain explorer: https://sepolia-blockscout.lisk.com/address/0x73e7a94dD5760d862F6FD9f8ea5D4245Bb143446 + +In case you chose to deploy on the Lisk Mainnet, you need to paste the address on https://blockscout.lisk.com instead. + +## 6. Verify the contract + +If you want to interact with your contract on the block explorer, you, or someone else needs to verify it first. +The above contract has already been verified, so you should be able to view your version on a block explorer already. +For the remainder of this guide, we'll walk through how to verify your contract with Remix on the Lisk Sepolia Testnet. + +You can apply the same steps for verifying a contract on Lisk Mainnet, in case you deployed it there in the previous step, just use https://blockscout.lisk.com instead of https://sepolia-blockscout.lisk.com in step 2. + + - In Remix, rightlick on the contract you wish to verify and select `Flatten`. + This will create a new file `MyNFT_flattened.sol`. + - Now, switch to your [newly deployed contract](https://sepolia-blockscout.lisk.com/address/0x73e7a94dD5760d862F6FD9f8ea5D4245Bb143446) on https://sepolia-blockscout.lisk.com/ + - Go to the contract tab and click on the blue `Verify and Publish` button. + - (Optional) Set a license for your contract. + - Choose `Solidity (Single file)` as the verification method. + - Choose the fitting compiler version for your contract. + - Disable code optimization. + - Copy the flattened source code from Remix and paste it into the `Enter the Solidity Contract Code` field. + - Check that all info is correct and click the `Verify and Publish` button, to verify your contract. + + Once verified, the code tab will include the โœ… icon, and the source code will be viewable. \ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/token-development/overview.md b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/token-development/overview.md new file mode 100644 index 000000000..3a9b7a381 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/token-development/overview.md @@ -0,0 +1,106 @@ +--- +title: Overview +slug: /token-development +description: 'An introduction into and ERC token standards and token development on Lisk.' +keywords: + [ + 'Lisk', + 'Token development', + 'Deploy token', + 'ERC', + 'EIP', + 'ERC-20', + 'ERC-721', + 'ERC-1155', + 'NFT', + 'Fungible token', + 'Hybrid token', + ] +--- + +# Token development +This page is intended for token issuers who wish to create a new ERC-20 contract on Lisk. +It includes an explanation of ERCs, a summary of the most important token standards, and examples of how to deploy these tokens on Lisk. +In case you already have a token deployed on the Ethereum network, and wish to bridge it to Lisk, please refer to the guide [Bridging an L1 token to Lisk](../add-token-to-lisk/index.md). + +## ERC token standards + +A standard interface allows any tokens on Ethereum to be re-used by other applications: from wallets to decentralized exchanges. +**ERCs**(Ethereum Request for Comments) are a set of application-level standards and conventions, including contract standards such as token standards (ERC-20), name registries (ERC-137), URI schemes, library/package formats, and wallet formats for the Ethereum blockchain. + +Following the most popular ERC token standards when creating a new token has several benefits: + +- **Increased security:** Let your contract inherit from heavily audited and reviewed implementations of the standard, mitigating the possibility of bugs greatly. +- **High application compatibility:** Most applications only support the most popular ERC token standards. By following these standards, you ensure your token will be compatible with most external applications like wallets or decentralized exchanges. +- **Great documentation:** Benefit from the vast number of tutorials and guides that are available to develop ERC-compliant tokens. + +ERCs are a subcategory of **EIPs**(Ethereum Improvement Proposals). +New EIPs are added following the process outlined in [EIP-1](https://eips.ethereum.org/EIPS/eip-1). + +Here's the full list of [ERC proposals](https://eips.ethereum.org/erc). + +A summary of some interesting ERC token standards can be found below. + +- [ERC-20](#erc-20): the most widespread token standard for fungible tokens, albeit somewhat limited by its simplicity. +- [ERC-721](#erc-721): the most popular token standard for non-fungible tokens, often used for collectibles and games. +- [ERC-1155](#erc-1155): a standard for multi-tokens, allowing for a single contract to represent multiple fungible and non-fungible tokens, along with batched operations for increased gas efficiency. + +## ERC-20 +The most widespread token standard for fungible tokens. +Any token is exactly equal to any other token; no tokens have special rights or behavior associated with them. +This makes [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens useful for things like a medium of exchange currency, voting rights, staking, and more. + +### Guides +[How to deploy a new ERC-20 token on Lisk](deploy-erc-20.md) + +### Further reading +- [Understand the ERC-20 token smart contract](https://ethereum.org/en/developers/tutorials/understand-the-erc-20-token-smart-contract/) +- [ERC-20 EIP](https://eips.ethereum.org/EIPS/eip-20) +- [OpenZeppelin: ERC-20 API](https://docs.openzeppelin.com/contracts/3.x/api/token/erc20) +- [OpenZeppelin: ERC-20 contract](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol) +- [Solidity by example: ERC-20](https://solidity-by-example.org/app/erc20/) +- [Ethereum Docs: ERC-20](https://ethereum.org/en/developers/docs/standards/tokens/erc-20/) +- [Alchemy: Complete guide to ERC-20](https://www.alchemy.com/overviews/erc20-solidity) + +## ERC-721 +[ERC-721](https://eips.ethereum.org/EIPS/eip-721) is a standard for representing ownership of non-fungible tokens. +Non-fungible tokens(NFTs) are used to represent unique objects like real estate or collectibles, where some items are valued more than others due to their usefulness, rarity, or other individual characteristics. + +To represent these unique features onchain, the ERC-721 includes metadata properties that offer information about the token's specific features, such as the title, the creator, and an image preview. + +### Guides +[How to deploy a new ERC-721 token on Lisk](deploy-erc-721.md) + +### Further reading +- [Ethereum Docs: ERC-721](https://ethereum.org/en/developers/docs/standards/tokens/erc-721/) +- [ERC-721 EIP](https://eips.ethereum.org/EIPS/eip-721) +- [OpenZeppelin: ERC-721 API](https://docs.openzeppelin.com/contracts/3.x/api/token/erc721) +- [OpenZeppelin: ERC-721 contract](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol) +- [Solidity by example: ERC721](https://solidity-by-example.org/app/erc721/) +- [How to implement an ERC-721 market](https://ethereum.org/en/developers/tutorials/how-to-implement-an-erc721-market/) + +## ERC-1155 +The [ERC-1155](https://eips.ethereum.org/EIPS/eip-1155) is a standard interface for contracts that manage multiple token types. +The distinctive feature of ERC-1155 is that it uses a single smart contract to represent multiple tokens at once. +A single deployed contract may include any combination of fungible tokens, non-fungible tokens or other configurations (e.g. semi-fungible tokens). + +This is why its `balanceOf` function differs from ERC-20โ€™s: +it has an additional `id` argument for the identifier of the token that you want to query the balance of. +ERC-1155 accounts have a distinct balance for each token id; non-fungible tokens are implemented by simply minting a single one of them. + +This approach leads to massive gas savings for projects that require multiple tokens. +Instead of deploying a new contract for each token type, a single ERC-1155 token contract can hold the entire system state, reducing deployment costs and complexity. + +### Guides +[How to deploy a new ERC-1155 token on Lisk](deploy-erc-1155.md) + +:::warning +Please note that there is currently less ecosystem support for ERC-1155 as compared with ERC-20 or ERC-721. +::: + +### Further reading +- [Ethereum Docs: ERC-1155](https://ethereum.org/en/developers/docs/standards/tokens/erc-1155/) +- [ERC-1155 EIP](https://eips.ethereum.org/EIPS/eip-1155) +- [OpenZeppelin: ERC-1155 API](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155) +- [OpenZeppelin: ERC-1155 contract](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol) +- [Solidity by example: ERC1155](https://solidity-by-example.org/app/erc1155/) \ No newline at end of file diff --git a/docs/building-on-lisk/use-oracle-data.md b/i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/use-oracle-data.md similarity index 100% rename from docs/building-on-lisk/use-oracle-data.md rename to i18n/ind/docusaurus-plugin-content-docs/current/building-on-lisk/use-oracle-data.md diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/docs-user/bridges.mdx b/i18n/ind/docusaurus-plugin-content-docs/current/docs-user/bridges.mdx new file mode 100644 index 000000000..d50e6ffde --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/docs-user/bridges.mdx @@ -0,0 +1,129 @@ +--- +title: Bridges +slug: /user/bridges +description: Documentation for bridging assets to Lisk. This page covers how to bridge ETH and ERC-20s between Ethereum Sepolia and Lisk Sepoklia, with essential cautions and contract information. +keywords: + [ + Lisk, + Lisk network, + bridging, + bridge to Lisk, + bridge ETH, + bridge ETH to Lisk, + Lisk Bridge, + Ethereum Testnet, + Lisk Testnet, + ETH, + Relay Bridge, + Superbridge, + ERC-20 tokens, + asset bridging, + ] +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Bridges +Various bridges are available to transfer LSK tokens between Ethereum (L1) and Lisk (L2) networks. +Below is a summary of the available bridges and the supported networks. + +## Across + +The [Across](https://app.across.to/bridge) bridge enables you to directly bridge ETH and other supported assets from the Ethereum mainnet (L1) to Lisk and vice versa. + +Supported networks: +- [Lisk Mainnet](https://app.across.to/bridge) + +## Lisk Bridge +The Lisk bridge allows you to bridge ETH from Ethereum to Lisk and vice versa. + +Supported networks: +- [Lisk Mainnet](https://bridge.lisk.com) +- [Lisk Sepolia](https://sepolia-bridge.lisk.com) + +## Owlto + +[Owlto Finance](https://owlto.finance/) is a decentralized Cross-Rollup bridge specifically designed for transferring local assets within the Ethereum network. + +Supported networks: +- Lisk Mainnet + +## Relay +Relay offers an alternative method for bridging ETH to the Lisk network and vice versa. +It is a cross-chain payments system that enables instant, low-cost bridging and cross-chain execution. + +Supported networks: +- [Lisk Mainnet](https://relay.link/bridge/lisk/) + +## Superbridge + +The [Superbridge](https://superbridge.app/support/lisk-mainnet) enables you to directly bridge ETH and other supported assets from the Ethereum mainnet (L1) to Lisk and vice versa. + +Supported networks: +- [Lisk Mainnet](https://superbridge.app/lisk-mainnet) +- [Lisk Sepolia](https://superbridge.app/lisk-sepolia) + +{/* ### Depositing funds + + + + How to deposit funds from Ethereum to Lisk: + + 1. Visit the [Lisk Bridge](https://bridge.lisk.com) and make sure you are on the `Deposit` tab. + 2. Connect your wallet by clicking `Connect Wallet`. + 3. Switch your network to Ethereum in your wallet. + 4. Choose the amount of ETH you'd like to deposit. + 5. Press `Bridge funds` and wait for the transaction to go through. + + + How to deposit funds from Sepolia to Lisk Sepolia: + + 1. Visit the [Lisk Bridge](https://sepolia-bridge.lisk.com) and make sure you are on the `Deposit` tab. + 2. Connect your wallet by clicking `Connect Wallet`. + 3. Switch your network to Sepolia in your wallet. + 4. Choose the amount of ETH you'd like to deposit. + 5. Press `Bridge funds` and wait for the transaction to go through. + + + + + +### Withdrawing funds + + +:::info +After initiating your withdrawal, a 7-day [challenge period](https://docs.optimism.io/builders/dapp-developers/bridging/messaging#for-l2-to-l1-transactions) needs to be observed as a security measure. Once the challenge period has passed, the withdrawal can be completed with a final transaction. +::: + + + + + How to withdraw funds from Lisk to Ethereum: + 1. Visit the [Lisk Bridge](https://bridge.lisk.com) and switch to the `Withdraw` tab. + 2. Connect your wallet by clicking `Connect Wallet`. + 3. Switch your network to Lisk in your wallet. + 4. Choose the amount of ETH you'd like to withdraw. + 5. Press `Bridge funds` and wait for the transaction to go through. + 6. Wait until the challenge period passes to claim the funds and complete the withdrawal. + :::tip + Check the status of your mainnet withdrawals in your [Withdrawals history](https://bridge.lisk.com/history?slug=lisk). + ::: + + + How to withdraw funds from Lisk Sepolia to Sepolia: + 1. Visit the [Lisk Bridge](https://sepolia-bridge.lisk.com) and switch to the `Withdraw` tab. + 2. Connect your wallet by clicking `Connect Wallet`. + 3. Switch your network to Lisk Sepolia in your wallet. + 4. Choose the amount of ETH you'd like to withdraw. + 5. Press `Bridge funds` and wait for the transaction to go through. + 6. Wait until the challenge period passes to claim the funds and complete the withdrawal. + :::tip + Check the status of your testnet withdrawals in your [Withdrawals history](https://sepolia-bridge.lisk.com/history?slug=lisk-sepolia-testnet). + ::: + + + + + + + */} \ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/docs-user/claiming.mdx b/i18n/ind/docusaurus-plugin-content-docs/current/docs-user/claiming.mdx new file mode 100644 index 000000000..16223eb08 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/docs-user/claiming.mdx @@ -0,0 +1,97 @@ +--- +title: How to claim LSK +sidebar_position: 1 +slug: /user/claiming +description: 'How to claim LSK tokens on Lisk L2.' +keywords: + [ + 'Lisk claiming', + 'Lisk migration', + 'Lisk L2', + 'LSK Lisk L2', + 'LSK claiming', + 'Claim Lisk', + 'Claim LSK', + ] +--- + +import claim from '../../../../../static/img/docs/claiming/1-claim-tokens.png'; +import walletConnect from '../../../../../static/img/docs/claiming/2-connect-wallet.png'; +import walletPrompt from '../../../../../static/img/docs/claiming/3-connect-prompt.png'; +import claimReview from '../../../../../static/img/docs/claiming/4-claim-review.png'; +import signMessage from '../../../../../static/img/docs/claiming/5-sign-message.png'; +import signPrompt from '../../../../../static/img/docs/claiming/6-sign-prompt.png'; +import claimSubmit from '../../../../../static/img/docs/claiming/8-submit-claim.png'; + +# Claiming LSK tokens + +Everyone who held tokens on the Lisk L1 chain is entitled to claim the exact same amount of LSK on Lisk L2. +This guide explains step-by-step, how to complete the claiming process. + +:::info +Lisk token holders have a **2-year window starting May 21st, 2024** to claim and migrate their tokens to Lisk L2. +::: + +## Requirements + +To claim your LSK tokens on Lisk L2, you need the following: + +1. An account on the Lisk L1 legacy chain, with some LSK tokens. + The account must hold some LSK tokens at the snapshot height `24,823,618`. + The amount of LSK tokens you can claim on Lisk L2 is the same as the amount you held on Lisk L1 at the snapshot height. +2. Latest version of the [Lisk Migration Wallet](https://lisk.com/wallet) installed (3.0.3) +3. An account on Lisk L2 with a small amount of ETH, to pay for the gas fees. + If you need to bridge ETH tokens from Ethereum to Lisk, please refer to one of the available [bridges](/user/bridges). +4. If you have a Ledger hardware wallet, you need the latest version of the Lisk app installed (Lisk legacy 4.0.0). + +## Claiming process step-by-step + +:::note +This guide is for regular accounts. +If you have a multisignature account, please refer to the [multisignature claiming guide](https://lisk.com/blog/posts/claiming-your-lsk-tokens-with-multisig-accounts-step-by-step-guide). +::: + +1. Open the [Claim Tokens page on the Lisk Portal](https://portal.lisk.com/claim/regular-account) in the browser.
+
+ If you haven't already, connect your wallet with the portal on the top right corner. +2. On the **Claim Tokens page**, click the `Connect Lisk account` button. + This will open a WalletConnect prompt. +3. Copy the connection URI by clicking the button next to `Connect your wallet`. +4. Open the [Lisk Migration Wallet](https://lisk.com/wallet) and sign in with the account you intend to migrate. + Make sure you have the latest version of the Lisk Migration Wallet installed (3.0.3). + You can verify the version by clicking on the `Lisk`>`About` button in the wallet menu. +5. Go to the `Applications` page and click on the `Wallet connections` tab. +6. Now, click the `Connect Wallet` button.
+ +7. Paste the connection URI you just copied in step 3 and press `Connect`. + This will open a prompt showing all your available accounts.
+
+8. Select the account you wish to migrate the LSK tokens from and click the `Connect` button. +9. Now go back to the [Lisk Portal](https://portal.lisk.com/claim/regular-account), you will see it shows the amount of LSK from your L1 account you selected in step 8, ready to be claimed.
+
+10. Click the `Sign message` button, which will take you back to **Lisk Migration Wallet**, where you need to sign the migration message on Lisk L1.
+
+ Click the `Continue` button twice and confirm by entering your password, to sign the migration message on Lisk L1.
+
+ When you see the transaction receipt in the window, close it to complete the process.
+:::warning + You will need a small amount of **ETH** on Lisk L2 to pay the **gas fees** for the claiming transaction in the next step. + To bridge ETH from Ethereum to Lisk, you can use one of the available [bridges](/user/bridges). +::: +11. Go back to the [Lisk Portal](https://portal.lisk.com/claim/regular-account). + You will see that the `Sign message` button has changed to `Submit Claim`. + Click the button to finalize the claiming process on Lisk L2.
+
+ This will open a wallet prompt, where you can verify the claim you intend to make. + Click `Confirm` to complete the claiming of your LSK tokens. + +That's it! ๐ŸŽ‰ You have now successfully claimed your Lisk L1 LSK tokens on Lisk L2. + +After you complete the claiming process, you can check the **transaction receipt** on the claiming page in the Lisk Portal, to verify that the claiming of the LSK tokens was executed successfully. + +To see your newly migrated LSK token balance on Lisk L2, you can check your account balance on [BlockScout](https://blockscout.lisk.com/) by entering your account address and clicking on the `Tokens` tab. + +:::tip +If you wish to see your LSK token balance in MetaMask directly, it is possible to [import the LSK token to MetaMask](using-lisk/import-lsk.mdx). +::: + diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/docs-user/connecting-to-a-wallet.mdx b/i18n/ind/docusaurus-plugin-content-docs/current/docs-user/connecting-to-a-wallet.mdx new file mode 100644 index 000000000..0df083ba6 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/docs-user/connecting-to-a-wallet.mdx @@ -0,0 +1,111 @@ +--- +title: Connecting to a wallet +sidebar_position: 1 +slug: /user/connecting-to-a-wallet +description: 'How to integrate Lisk with popular wallets like MetaMask.' +keywords: + [ + 'Lisk', + 'Lisk wallet', + 'MetaMask', + 'EVM-compatible wallets', + 'network configuration', + 'Lisk testnet', + 'Sepolia', + 'cryptocurrency wallet setup', + 'Lisk wallet setup', + 'add Lisk network', + ] +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# How to connect Lisk to a wallet + +## Lisk Mainnet + +**Lisk Mainnet** can be **added** as a custom network to **any EVM-compatible wallet** (i.e. [MetaMask](https://metamask.io/)). + +### Instructions for MetaMask + + + + #### Adding Lisk manually + + To add Lisk Mainnet as a custom network to MetaMask: + + 1. Open the MetaMask browser extension. + 2. Open the network selection dropdown menu by clicking the dropdown button at the top of the extension. + 3. Click the `Add network` button. + 4. Click `Add a network manually`. + 5. In the `Add a network manually` dialog that appears, enter the following information for Lisk: + + | Name | Value | + | :-------------- | :-------------------------------------------------------------------------- | + | Network Name | Lisk | + | RPC Endpoint | [ https://rpc.api.lisk.com](https://rpc.api.lisk.com) | + | Chain ID | 1135 | + | Currency Symbol | ETH | + | Block Explorer | [https://blockscout.lisk.com](https://blockscout.lisk.com) | + + 6. Tap the `Save` button to save Lisk as a network. + + + #### Adding Lisk with 1 click + 1. Go to the [Lisk Portal](https://portal.lisk.com/) + 2. Click the `Connect Wallet` button + 3. The MetaMask plugin should open and have all the information required to add the network prefilled, automatically. + Review and confirm the information by tapping the `Save` button. + 4. Ensure that the portal is connected to the `Lisk` network. + + + +You should now be able to connect to the Lisk by selecting it from the network selection dropdown menu. + + +## Lisk Sepolia Testnet + +**Lisk Sepolia** can be **added** as a custom network to **any EVM-compatible wallet** (i.e. [MetaMask](https://metamask.io/)). + +### Instructions for MetaMask + + + + #### Adding Lisk manually + + To add Lisk Sepolia as a custom network to MetaMask: + + 1. Open the MetaMask browser extension. + 2. Open the network selection dropdown menu by clicking the dropdown button at the top of the extension. + 3. Click the `Add network` button. + 4. Click `Add a network manually`. + 5. In the `Add a network manually` dialog that appears, enter the following information for Lisk Sepolia: + + | Name | Value | + | :-------------- | :-------------------------------------------------------------------------- | + | Network Name | Lisk Sepolia Testnet | + | RPC Endpoint | [https://rpc.sepolia-api.lisk.com](https://rpc.sepolia-api.lisk.com) | + | Chain ID | 4202 | + | Currency Symbol | ETH | + | Block Explorer | [https://sepolia-blockscout.lisk.com](https://sepolia-blockscout.lisk.com/) | + + 6. Tap the `Save` button to save Lisk as a network. + + + #### Adding Lisk with 1 click + 1. Go to the [Lisk Portal](https://portal.lisk.com/) + 2. Click the `Connect Wallet` button + 3. The MetaMask plugin should open and have all the information required to add the network prefilled, automatically. + Review and confirm the information by tapping the `Save` button. + 4. Ensure that the portal is connected to the `Lisk Sepolia Testnet` network. + + + +You should now be able to connect to the Lisk by selecting it from the network selection dropdown menu. + + + + + + diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/docs-user/exchanges.md b/i18n/ind/docusaurus-plugin-content-docs/current/docs-user/exchanges.md new file mode 100644 index 000000000..b35a514db --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/docs-user/exchanges.md @@ -0,0 +1,83 @@ +--- +title: Exchanges supporting Lisk +sidebar_position: 1 +slug: /user/exchanges +description: 'A summary of all exchanges where you can buy LSK' +keywords: + [ + 'Lisk', + 'LSK', + 'trade LSK', + 'buy LSK', + 'exchanges', + 'DEX', + 'get LSK', + 'LSK trading', + 'Binance', + 'LSK/USD', + 'LSK/USDT', + 'LSK/KRW', + 'LSK/EUR', + 'LSK/PLN', + ] +--- + +# Exchanges + +Lisk (LSK) is available for trading on various exchanges. + +## Centralized Exchanges + +| Name | Supported network[^1] | LSK Pairs | +| :----------------------- |:----------------- |:------------------------------------------------------------- | +| **Crypto.com** | ๐ŸŸข Lisk | [LSK/USD](https://crypto.com/exchange/trade/LSK_USD) | +| **OKX** | ๐ŸŸข Lisk | [LSK/USDT](https://www.okx.com/fr/trade-spot/lsk-usdt) | +| **Upbit** (Korea) | ๐ŸŸข Lisk | [LSK/KRW](https://upbit.com/exchange?code=CRIX.UPBIT.KRW-LSK) | +| **XT.com** | ๐ŸŸข Lisk | [LSK/USDT](https://www.xt.com/en/trade/lsk_usdt)
[LSK/BTC](https://www.xt.com/en/trade/lsk_btc) | +| **HTX** (formerly Houbi) | ๐ŸŸฃ Ethereum
(Lisk support coming soon) | [LSK/USDT](https://www.htx.com.jm/trade/lsk_usdt/) | +| **Binance** | ๐ŸŸก Ethereum | [LSK/USDT](https://www.binance.com/en/trade/LSK_USDT?type=spot)
[LSK/BTC](https://www.binance.com/en/trade/LSK_BTC?type=spot)
[LSK/ETH](https://www.binance.com/en/trade/LSK_ETH?type=spot) | +| **BinanceUS** | ๐ŸŸก Ethereum | [LSK/USDT](https://www.binance.us/spot-trade/lsk_usdt) | +| **Bitflyer** | ๐ŸŸก Ethereum | [LSK/EUR](https://bitflyer.com/fr-eu/lisk-chart) | +| **Bitget** | ๐ŸŸก Ethereum | [LSK/USDT](https://www.bitget.com/futures/usdt/LSKUSDT) | +| **Bithumb** (Korea) | ๐ŸŸก Ethereum | [LSK / KRW](https://www.bithumb.com/react/trade/order/LSK-KRW)| +| **Bitrue** | ๐ŸŸก Ethereum | [LSK/USDT](https://www.bitrue.com/trade/lsk_usdt) | +| **BitVavo** | ๐ŸŸก Ethereum | [LSK/EUR](https://account.bitvavo.com/markets/LSK-EUR) | +| **Bit2Me** | ๐ŸŸก Ethereum | [LSK/USDT](https://pro.bit2me.com/exchange/LSK-USDT?ref=285-6HY-TPA&mkt_kind=referral&prm=5DH100) | +| **CoinEx** | ๐ŸŸก Ethereum | [LSK/USDT](https://www.coinex.com/en/exchange/LSK-USDT)
[LSK/BTC](https://www.coinex.com/en/exchange/LSK-BTC) | +| **DigiFinex** | ๐ŸŸก Ethereum | [LSK/USDT](https://www.digifinex.com/en-ww/trade/USDT/LSK) | +| **Gate.io** | ๐ŸŸก Ethereum | [LSK/USDT](https://www.gate.io/fr/trade/LSK_USDT)
[LSK/BTC](https://www.gate.io/fr/trade/LSK_BTC) | +| **Kraken** | ๐ŸŸก Ethereum | [LSK/EUR](https://pro.kraken.com/app/trade/lsk-eur)
[LSK/USD](https://pro.kraken.com/app/trade/lsk-usd) | +| **Kucoin** | ๐ŸŸก Ethereum | [LSK/USDT](https://www.kucoin.com/trade/LSK-USDT) | +| **Poloniex** | ๐ŸŸก Ethereum | [LSK/USDT](https://poloniex.com/trade/LSK_USDT/?type=spot)
[LSK/BTC](https://poloniex.com/trade/LSK_BTC/?type=spot) | +| **TokoCrypto** (Indo) | ๐ŸŸก Ethereum | [LSK/USDT](https://www.tokocrypto.com/en/trade/LSK_USDT)
[LSK/BTC](https://www.tokocrypto.com/en/trade/LSK_BTC) | +| **Zonda** | ๐ŸŸก Ethereum | [LSK/USDT](https://zondacrypto.com/en/exchange-rate/lisk-price-usdt)
[LSK/EUR](https://zondacrypto.com/en/exchange-rate/lisk-price-eur)
[LSK/BTC](https://zondacrypto.com/en/exchange-rate/lisk-price-btc)
[LSK/PLN](https://zondacrypto.com/en/exchange-rate/lisk-price-pln) | + + +[^1]: The LSK token is supported on both the Ethereum L1 and the Lisk L2 blockchains. +The "supported network" field indicates the blockchain being used by the exchange for deposits & withdrawals of LSK. +Please note that using the wrong network/blockchain when depositing funds to an exchange could result in lost funds. + +### Coming soon + +| Name | Supported network | +| :----------------------- |:----------------- | +| **Binance.Japan** | Ethereum | +| **BitTrade** (HTX Japan) | Ethereum | +| **Coincheck** (Japan) | Ethereum | +| **OkCoin** (OKX Japan) | Lisk | +| **YellowCard** (Africa) | Lisk | + +## Decentralized Exchanges (DEX) + +| Name | Supported network[^1] | +| :---------------------------- | :------------------------------------------ | +| [Oku.Trade](https://oku.trade/app/lisk/trade/0xac485391eb2d7d88253a7f1ef18c37f4242d1a24) | ๐ŸŸข Lisk | +| [Uniswap](https://app.uniswap.org/explore/tokens/ethereum/0x6033f7f88332b8db6ad452b7c6d5bb643990ae3f) | ๐ŸŸก Ethereum | + +### Coming soon + +| Name | +| :---------------------------- | +| **Velodrome** | + + diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/docs-user/governance/delegation.mdx b/i18n/ind/docusaurus-plugin-content-docs/current/docs-user/governance/delegation.mdx new file mode 100644 index 000000000..ce3271141 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/docs-user/governance/delegation.mdx @@ -0,0 +1,137 @@ +--- +title: Delegation +sidebar_position: 2 +slug: /governance/delegation +description: Documentation about the delegation process of the Lisk DAO. +keywords: + [ + Lisk governance, + Lisk DAO, + Lisk Grants, + Funding, + Delegation, + Voting, + Proposals, + Lisk Delegates, + Delegates, + Voting Power + ] +--- + +import delegateConnect from '../../../../../../static/img/docs/governance/delegate-connect.png'; +import delegateSelect from '../../../../../../static/img/docs/governance/delegate-select.png'; +import delegateSubmit from '../../../../../../static/img/docs/governance/delegate-submit.png'; + + +# Delegation +Delegation is a key feature of the [Lisk DAO](overview), as it allows token holders to participate in the governance of the Lisk project passively by entrusting a representative with voting on [proposals](overview#proposals) in a way that aligns with their own beliefs and values. +By delegating their [voting power](overview#voting-power) to a delegate of their choice, token holders can influence that their interests are represented in the decision-making process. + +However, token holders give a lot of power to the delegate to make the right decisions on proposals. +This is why it is important to choose a delegate that you trust and that you believe will act in the best interest of the Lisk project and the community. +We recommend choosing a delegate who is active in the community, has a good reputation, and has a track record of making good decisions. + +The following sources might support you in your delegation decision: + +- [Lisk Chat](https://lisk.chat): Get in touch with your delegate in the Lisk chat, or ask other users about their experiences with the delegate. +- [Lisk Governance Forum](https://forum.lisk.com/c/delegates/): The Lisk Governance Forum provides a section for delegates to present themselves to the community. +- [Lisk DAO Tally instance](https://www.tally.xyz/gov/lisk): Check the delegate's profile, voting history, and activity on the Lisk DAO Tally instance. + +## Responsibility of delegates +Delegates play a crucial role in the governance of the Lisk project. +They are the ones who create [proposals](overview#proposals), vote on behalf of the token holders, and represent the interests of the community as a whole. + +Delegates are required to: + +- Follow the processes outlined in the Governance documentation of the Lisk DAO +- Act in the best interest of the token holders whom they represent +- Be active in the decision-making process of the DAO, this means specifically: + - Vote on proposals + +Excellent delegates will do even more than that, for example: + +- Create proposals +- Give feedback on draft proposals +- Engage actively with the Lisk community online and/or offline + +## Benefits of being a delegate + +- **Impact**: + - Have influence on the direction of the Lisk project. + - Ensure that the Lisk DAO acts in the best interest of the Lisk community. + - Decide directly about fund allocation of the Lisk DAO treasury. + {/* TODO: Confirm rewards */} +{/* + +| | Lisk Sepolia Testnet | Lisk | +| :------ | :------ | :----------------------- | +|**HTTP RPC** | https://rpc.sepolia-api.lisk.com | https://rpc.api.lisk.com | +|**WS RPC** | `wss://ws.sepolia-api.lisk.com` | `wss://ws.api.lisk.com` | + + +## dRPC + +[dRPC](https://drpc.org/) is a decentralized Web3 infrastructure provider with a focus on resilience and latency. +dRPC offers access to a distributed network of public nodes for Lisk. +They provide a free tier that allows for an unlimited amount of requests over public nodes, or a paid tier that provides access to all providers, as well as other additional features. + +| | Lisk Sepolia Testnet | Lisk | +| :------ | :------ | :----------------------- | +|**HTTP RPC** | https://lisk-sepolia.drpc.org | https://lisk.drpc.org | +|**WS RPC** | `wss://lisk-sepolia.drpc.org` | `wss://lisk.drpc.org` | + +You can also check the available endpoints for Lisk directly under [https://drpc.org/public-endpoints/lisk](https://drpc.org/public-endpoints/lisk). + +:::note[How to create API keys for dRPC] +In order to use the provided endpoints, you need to [get the corresponding API keys](https://docs.drpc.org/gettingstarted/createaccount). +::: \ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/lisk-tools/faucets.md b/i18n/ind/docusaurus-plugin-content-docs/current/lisk-tools/faucets.md new file mode 100644 index 000000000..800f54e1b --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/lisk-tools/faucets.md @@ -0,0 +1,56 @@ +--- +title: Faucets +slug: /lisk-tools/faucets +description: Summary of available ETH and LSK faucets on the Lisk Seolia Testnet. Get free testnet tokens on Lisk Sepolia. +keywords: + [ + Lisk Sepolia, + Lisk Sepolia Testnet, + Lisk faucet, + LSK faucet, + ETH faucet, + Testnet LSK, + Testnet Lisk, + Testnet ETH, + Testnet tokens, + Free testnet tokens + ] +--- + +# Faucets +Faucets enable you to get free testnet tokens on Lisk Sepolia. +Find a list of faucets for the Lisk Sepolia testnet below. + +## Lisk Sepolia Faucet +Grants test **LSK** on Lisk Sepolia. + +The Lisk Sepolia faucet is available here: https://sepolia-faucet.lisk.com/: + +Enter your account address or ENS name to receive 1 test LSK per request. + + +## Superchain Faucet +Grants test **ETH** on Lisk Sepolia. + +The Superchain faucet is available here: https://app.optimism.io/faucet + +There are two different options to acquire free Testnet ETH: + +1. **Verify your onchain identity:** + Get up to 1 test ETH/week on Lisk Sepolia by identifying onchain via Optimist NFT, Gitcoin Passport, Coinbase Verification, World ID, or attestations. +2. **Verify via GitHub:** + Get up to 0.05 test ETH/week on Lisk Sepolia by identifying via your GitHub account. + +## dRPC Faucet + +Grants up to 0.1 Testnet **ETH** per day on Lisk Sepolia. + +The dRPC faucet for Lisk Sepolia is available here: https://drpc.org/faucet/lisk + +There are two different options to acquire free Testnet ETH: + +1. **Proof-of-Work:** + Mine to get up to 0.1 test ETH/day on Lisk Sepolia. + The process of "mining" doesn't create new coins, it's just a time-limited method of spam protection. +2. **Verify via Gitcoin Passport:** + Get up to 0.1 test ETH/day on Lisk Sepolia by identifying via your Gitcoin Passport. diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/lisk-tools/indexers.md b/i18n/ind/docusaurus-plugin-content-docs/current/lisk-tools/indexers.md new file mode 100644 index 000000000..750f603e8 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/lisk-tools/indexers.md @@ -0,0 +1,35 @@ +--- +title: Data Indexers +slug: /lisk-tools/indexers +description: "Brief introduction to all the indexers linked with Lisk L2." +keywords: [ + "indexers", + "data indexers", + "Lisk", + "Lisk test network", + "Lisk testnet", + "Goldsky", + "Solidity", + "Mirror", + "Subgraph" + ] +--- + +# Data Indexers + +## Goldsky + +[Goldsky](https://goldsky.com/) is the go-to data indexer for web3 builders, offering high-performance subgraph hosting and real-time data replication pipelines. +It reads, edits, and syncs fresh blockchain data and allows you to hook this information into your code. +The Lisk blockchain is indexed by Goldsky. + +Goldsky is comprised of two main components: + +- [Subgraphs](https://docs.goldsky.com/introduction#subgraphs): It is a fully backward-compatible subgraph indexing approach offered by Goldsky. +To enhance reliability and performance, the core indexing process uses the exact WASM processing layer together with a rewritten RPC layer, autoscaling query layer, and storage optimizations. +Support for webhooks for notifications, messaging, and other related use cases is included. + + +- [Mirror](https://docs.goldsky.com/introduction#mirror): With just one `.yaml` definition file, you can use Mirror, a serverless data pipeline technology, to obtain real-time data into your database. +Data is pushed to your queue or datastore, where it may be queried without any external rate limitations, alongside your existing data. +Goldsky receives instructions from a mirror pipeline on where to obtain data: [sources](https://docs.goldsky.com/mirror/sources/supported-sources), how to process it (optionally), and where to store the results: [sinks](https://docs.goldsky.com/mirror/sinks/supported-sinks). \ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/lisk-tools/oracles.md b/i18n/ind/docusaurus-plugin-content-docs/current/lisk-tools/oracles.md new file mode 100644 index 000000000..8b90c0de7 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/lisk-tools/oracles.md @@ -0,0 +1,42 @@ +--- +title: Oracles +slug: /lisk-tools/oracles +description: Documentation for various blockchain oracles for Lisk. +keywords: + [ + Oracles, + Oracle, + Lisk, + Lisk Mainnet, + Lisk Testnet, + Lisk network, + Redstone, + price feeds, + data feeds, + ] +--- + +# Oracles + +[Oracles](https://ethereum.org/en/developers/docs/oracles/) provide offchain data onchain. +This allows code running on a blockchain to access a wide variety of information. + +The following Oracles support the Lisk network already: + +## RedStone + +[RedStone](https://redstone.finance/) offers flexible Data Feeds for Lending Markets, Perpetuals, Options, Stablecoins, Yield Aggregators, and other types of novel DeFi protocols. + +Builders can choose how they want to consume the data from the following three dedicated models: + +* [RedStone Pull](https://docs.redstone.finance/docs/get-started/models/redstone-pull) (pull oracle) - less than 10s update time, broad spectrum of feeds, best for most use cases. All [Price Feeds](https://app.redstone.finance/#/app/tokens) are available for Lisk. +* [RedStone Push](https://docs.redstone.finance/docs/get-started/models/redstone-push) (push oracle) - for protocols designed for the traditional oracle interface, customizable heartbeat, and deviation threshold. +* [RedStone X](https://docs.redstone.finance/docs/get-started/models/redstone-x) - specifically for Perps and Options, highest update frequency, and front-running protection. +* [ERC7412](https://docs.redstone.finance/docs/get-started/models/redstone-erc7412) - Classic and Core models combined + +Interested in integration? [Get in contact](https://discord.com/invite/PVxBZKFr46) with the RedStone team! + +#### Supported Networks + +- Lisk +- Lisk Sepolia \ No newline at end of file diff --git a/i18n/ind/docusaurus-plugin-content-docs/current/lisk-tools/utilities.md b/i18n/ind/docusaurus-plugin-content-docs/current/lisk-tools/utilities.md new file mode 100644 index 000000000..dac565d65 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-docs/current/lisk-tools/utilities.md @@ -0,0 +1,65 @@ +--- +title: Utilities +slug: /lisk-tools/utilities +description: Summary of various services available for building on Lisk. +keywords: + [ + Lisk, + Lisk network, + Web3 infrastructure, + Building on Lisk, + Dapp development, + Web3 tools, + Sepolia, + Utilities, + web3, + ] +--- + +# Utilities + +A summary of various services available for building on Lisk. + +## Account Abstraction + +### Safe +[Safe](https://docs.safe.global) is the account abstraction leader on Ethereum and the EVM with the most secure smart wallet infrastructure and platform. +Safe brings digital ownership of accounts to everyone by building universal and open contract standards for the custody of digital assets, data, and identity. +To create a Safe account with Lisk, connect your wallet to [Lisk](https://safe.optimism.io/welcome?chain=lisk) or [Lisk Sepolia](https://safe.optimism.io/welcome?chain=lisksep) network through the Superchain-Safe portal. + +Gelato deployed a small example [react app](https://gelato-raas-aa.web.app/) with a safe-web3auth integration. +The code for this integration can be found on the [gelato-raas-aa-ui](https://github.com/gelatodigital/gelato-raas-aa-ui) repository. + +### 1Balance + +[1Balance](https://docs.gelato.network/web3-services/1balance) is a unified multi-chain payments system. +1Balance makes it easy for you to pay all of your costs across all the networks that you are using from one single easy-to-manage balance. + +In the [gelato-raas-aa](https://github.com/gelatodigital/gelato-raas-aa) repository, you can find a demo implementation for sponsoring the fees with 1Balance or paying the fees with Safe balance. + +## Automation +### Web3 Functions + +Gelato's [Web3 Functions](https://www.gelato.network/web3-functions) is a powerful automation system designed to streamline and enhance Web3 operations. +Web3 Functions serve as a comprehensive tool, enabling developers to effortlessly set up, manage, and automate their smart contract tasks. + +## Interoperability + +### Hyperlane + +[Hyperlane](https://hyperlane.xyz/) is a blockchain interoperability protocol that allows different blockchains to communicate and share information with each other. +It acts like a "highway" between blockchains, enabling them to send messages, transfer assets, and interact with decentralized applications (dApps) across different networks. +This helps improve the connectivity between blockchains, making them more efficient and integrated. + +## Randomness + +### Gelato VRF +[Gelato VRF](https://www.gelato.network/vrf) (Verifiable Random Function) is a tool designed to provide robust randomness with inherent verifiability. +Create transparent & fair games, NFTs, lotteries, and other onchain applications with distributed randomness. + +## Relay Service + +### Gelato Relay + +Use [Gelato Relay](https://www.gelato.network/relay), to relay your user's transactions on-chain, enabling secure gasless transactions for an ultra-smooth UX for your app. +This allows for a variety of new web3 experiences, as the user can now pay by only signing a message, or their transaction costs can be sponsored by the developer. diff --git a/i18n/ind/docusaurus-plugin-content-pages/markdown-page.md b/i18n/ind/docusaurus-plugin-content-pages/markdown-page.md new file mode 100644 index 000000000..9756c5b66 --- /dev/null +++ b/i18n/ind/docusaurus-plugin-content-pages/markdown-page.md @@ -0,0 +1,7 @@ +--- +title: Markdown page example +--- + +# Markdown page example + +You don't need React to write simple standalone pages. diff --git a/i18n/ind/docusaurus-theme-classic/footer.json b/i18n/ind/docusaurus-theme-classic/footer.json new file mode 100644 index 000000000..f400f3ca1 --- /dev/null +++ b/i18n/ind/docusaurus-theme-classic/footer.json @@ -0,0 +1,14 @@ +{ + "link.item.label.X": { + "message": "X", + "description": "The label of footer link with label=X linking to https://twitter.com/LiskHQ" + }, + "link.item.label.Discord": { + "message": "Discord", + "description": "The label of footer link with label=Discord linking to https://lisk.chat" + }, + "link.item.label.GitHub": { + "message": "GitHub", + "description": "The label of footer link with label=GitHub linking to https://github.com/LiskHQ" + } +} diff --git a/i18n/ind/docusaurus-theme-classic/navbar.json b/i18n/ind/docusaurus-theme-classic/navbar.json new file mode 100644 index 000000000..52dc2b320 --- /dev/null +++ b/i18n/ind/docusaurus-theme-classic/navbar.json @@ -0,0 +1,14 @@ +{ + "logo.alt": { + "message": "Lisk Logo", + "description": "The alt text of navbar logo" + }, + "item.label.Building with Lisk": { + "message": "Membangun dengan Lisk", + "description": "Navbar item with label Building with Lisk" + }, + "item.label.Using Lisk": { + "message": "Menggunakan Lisk", + "description": "Navbar item with label Using Lisk" + } +} diff --git a/sidebars.js b/sidebars.js index d0c56742d..0a199518b 100644 --- a/sidebars.js +++ b/sidebars.js @@ -108,7 +108,16 @@ const sidebars = { keywords: ['guides','smart contracts','token development','token standards','erc-20','erc-721','erc-1155'], }, }, - 'building-on-lisk/use-oracle-data', + { + type: 'category', + label: 'Using oracle data', + collapsible: true, + collapsed: true, + items: [ + 'building-on-lisk/using-oracle-data/tellor', + 'building-on-lisk/using-oracle-data/redstone-pull', + ], + } ], link: { type: 'generated-index', diff --git a/src/components/HomepageFeatures/index.js b/src/components/HomepageFeatures/index.js index 76689eb31..2f6cd754d 100644 --- a/src/components/HomepageFeatures/index.js +++ b/src/components/HomepageFeatures/index.js @@ -2,6 +2,7 @@ import clsx from 'clsx'; import Heading from '@theme/Heading'; import styles from './styles.module.css'; import Link from '@docusaurus/Link'; +import Translate, {translate} from '@docusaurus/Translate'; const FeatureList = [ { @@ -10,17 +11,17 @@ const FeatureList = [ ), - title: 'What is Lisk?', + title: translate({message:'What is Lisk?'}), description: ( <> -

Lisk offers a highly efficient, lightning-fast, and easily scalable Layer 2 (L2) network built on Optimism (OP) and secured by Ethereum. +

Lisk offers a highly efficient, lightning-fast, and easily scalable Layer 2 (L2) network built on Optimism (OP) and secured by Ethereum.





- Explore + Explore ), @@ -31,15 +32,15 @@ const FeatureList = [ ), - title: 'Build with Lisk', + title: translate({message:"Build with Lisk"}), description: ( <> -

Lisk offers low-cost transactions, EVM compatibility, and support for all major developer frameworks, making it the top choice for developers. Join Lisk to access essential technical materials for your development journey.

+

Lisk offers low-cost transactions, EVM compatibility, and support for all major developer frameworks, making it the top choice for developers. Join Lisk to access essential technical materials for your development journey.

{/*

*/} - Get started + Get started ), @@ -50,10 +51,10 @@ const FeatureList = [ ), - title: 'Ecosystem for the future', + title: translate({message:'Ecosystem for the future'}), description: ( <> -

Lisk embraces the superchain framework, offering decentralized governance and an interoperable ecosystem. We provide grant programs to support the development of products and advocate for the principles of a decentralized world and inclusivity.

+

Lisk embraces the superchain framework, offering decentralized governance and an interoperable ecosystem. We provide grant programs to support the development of products and advocate for the principles of a decentralized world and inclusivity.

diff --git a/src/css/typography.css b/src/css/typography.css index 5bf4aee4f..ceac7f4a1 100644 --- a/src/css/typography.css +++ b/src/css/typography.css @@ -92,5 +92,4 @@ h6 { .mobile_only { display: none; } -} - +} \ No newline at end of file diff --git a/src/pages/index.js b/src/pages/index.js index ea04bcae3..8c2c7db0e 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -6,6 +6,7 @@ import HomepageFeatures from '@site/src/components/HomepageFeatures'; import Heading from '@theme/Heading'; import styles from './index.module.css'; +import Translate from '@docusaurus/Translate'; function HomepageHeader() { const { siteConfig } = useDocusaurusContext(); @@ -13,17 +14,17 @@ function HomepageHeader() {
- Welcome to the Lisk documentation ๐ŸŽ‰ + Welcome to the Lisk documentation ๐ŸŽ‰ - Welcome + Welcome

- to the Lisk + to the Lisk

- documentation ๐ŸŽ‰ + documentation ๐ŸŽ‰
-

Explore our comprehensive knowledge base tailored for both developers and users! Find in-depth technical information and helpful guides all about the Lisk blockchain.

+

Explore our comprehensive knowledge base tailored for both developers and users! Find in-depth technical information and helpful guides all about the Lisk blockchain.