From 8c9c85c6085b75f5ffd3e07ddb23831aecbe42f9 Mon Sep 17 00:00:00 2001 From: Antonio Date: Mon, 13 May 2024 12:33:58 +0100 Subject: [PATCH 01/12] feat: migrates tutorials --- content/tutorials/another-guide/10.index.md | 29 +- .../another-guide/20.lets-do-something.md | 45 - .../tutorials/another-guide/30.last-step.md | 45 - content/tutorials/another-guide/_info.yml | 28 - content/tutorials/best-tutorial/10.index.md | 53 - content/tutorials/best-tutorial/20.next.md | 45 - content/tutorials/best-tutorial/_info.yml | 27 - content/tutorials/cool-guide/10.index.md | 53 - content/tutorials/cool-guide/20.next.md | 45 - content/tutorials/cool-guide/_info.yml | 28 - .../cross-chain-governance/10.index.md | 213 +++ .../cross-chain-governance/20.L2-contract.md | 400 ++++++ .../30.cross-chain-transactions.md | 206 +++ .../cross-chain-governance/_info.yml | 24 + .../daily-spend-limit-account/10.index.md | 1069 +++++++++++++++ .../daily-spend-limit-account/_info.yml | 26 + .../tutorials/dapp-nft-paymaster/10.index.md | 71 + .../dapp-nft-paymaster/20.smart-contracts.md | 375 ++++++ .../dapp-nft-paymaster/30.frontend.md | 296 +++++ .../tutorials/dapp-nft-paymaster/_info.yml | 25 + content/tutorials/erc20-paymaster/10.index.md | 543 ++++++++ content/tutorials/erc20-paymaster/_info.yml | 27 + content/tutorials/example-guide/10.index.md | 53 - content/tutorials/example-guide/20.next.md | 45 - content/tutorials/example-guide/_info.yml | 28 - .../tutorials/frontend-paymaster/10.index.md | 499 +++++++ .../tutorials/frontend-paymaster/_info.yml | 25 + .../tutorials/native-aa-multisig/10.index.md | 1172 +++++++++++++++++ .../tutorials/native-aa-multisig/_info.yml | 26 + content/tutorials/simple-tutorial/10.index.md | 53 - content/tutorials/simple-tutorial/_info.yml | 28 - 31 files changed, 5020 insertions(+), 582 deletions(-) delete mode 100644 content/tutorials/another-guide/20.lets-do-something.md delete mode 100644 content/tutorials/another-guide/30.last-step.md delete mode 100644 content/tutorials/another-guide/_info.yml delete mode 100644 content/tutorials/best-tutorial/10.index.md delete mode 100644 content/tutorials/best-tutorial/20.next.md delete mode 100644 content/tutorials/best-tutorial/_info.yml delete mode 100644 content/tutorials/cool-guide/10.index.md delete mode 100644 content/tutorials/cool-guide/20.next.md delete mode 100644 content/tutorials/cool-guide/_info.yml create mode 100644 content/tutorials/cross-chain-governance/10.index.md create mode 100644 content/tutorials/cross-chain-governance/20.L2-contract.md create mode 100644 content/tutorials/cross-chain-governance/30.cross-chain-transactions.md create mode 100644 content/tutorials/cross-chain-governance/_info.yml create mode 100644 content/tutorials/daily-spend-limit-account/10.index.md create mode 100644 content/tutorials/daily-spend-limit-account/_info.yml create mode 100644 content/tutorials/dapp-nft-paymaster/10.index.md create mode 100644 content/tutorials/dapp-nft-paymaster/20.smart-contracts.md create mode 100644 content/tutorials/dapp-nft-paymaster/30.frontend.md create mode 100644 content/tutorials/dapp-nft-paymaster/_info.yml create mode 100644 content/tutorials/erc20-paymaster/10.index.md create mode 100644 content/tutorials/erc20-paymaster/_info.yml delete mode 100644 content/tutorials/example-guide/10.index.md delete mode 100644 content/tutorials/example-guide/20.next.md delete mode 100644 content/tutorials/example-guide/_info.yml create mode 100644 content/tutorials/frontend-paymaster/10.index.md create mode 100644 content/tutorials/frontend-paymaster/_info.yml create mode 100644 content/tutorials/native-aa-multisig/10.index.md create mode 100644 content/tutorials/native-aa-multisig/_info.yml delete mode 100644 content/tutorials/simple-tutorial/10.index.md delete mode 100644 content/tutorials/simple-tutorial/_info.yml diff --git a/content/tutorials/another-guide/10.index.md b/content/tutorials/another-guide/10.index.md index e42dc98e..e7bbed42 100644 --- a/content/tutorials/another-guide/10.index.md +++ b/content/tutorials/another-guide/10.index.md @@ -9,12 +9,29 @@ Lorem **markdownum quacumque**, ait pectore lacu. Unda exerceor, ille lacrimis ardent, non factus Laurentes equo aequora, mater aura? Ausorum fruge moturaque fama: intellecta subiere erat laborem. Est fallente, procorum, sospes? -1. Quicumque nisi petuntur -2. Tecta fuga tabuerit -3. Vigor exitium ad maior bracchia Seriphi dubites -4. Nympha per puerum quotiensque mihi -5. Quaerere sum socer -6. Ea vocant dextra lurida dicemur Phaethon cultros +::code-group +```bash [npm] +npm install +``` + +```bash [yarn] +yarn install +``` +:: + +Here are some banners: + +::callout{icon="i-heroicons-exclamation-circle"} +An info message +:: + +::callout{icon="i-heroicons-light-bulb"} +A tip message +:: + +::callout{icon="i-heroicons-exclamation-triangle"} +A warning message +:: ## Rogant et acervo hausta cognoscit diversa diff --git a/content/tutorials/another-guide/20.lets-do-something.md b/content/tutorials/another-guide/20.lets-do-something.md deleted file mode 100644 index f0991f34..00000000 --- a/content/tutorials/another-guide/20.lets-do-something.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: Step 2 -description: The next step in the guide ---- - -## Pede si diva cruentat et non patri - -Lorem markdownum illud **si**, boum gelidis ab limite, pallore poenam -navifragumque filo: vectus in. Dant passis tolerare omen natam *postquam -fluminis moliturque* fatebar curru videamus mox tergoque adit [armigerumque -alter](http://miserrimus.io/cedere.html) tandem, erat conata. Draconibus -transtra. - -- Ducit frigus consequitur alimentaque Eurydicenque virgineos Abantiades -- Saepe tollens contemptor corpora tuam -- Loricamque utque neu non loquerentur acui -- Extremis aequantur cognoscit qui orbis spumantia pariter -- Muta utque patitur verti vetustas forma - -Tenebat Pelops Rhenum vacantem hinc plumbo subito quae via annos populari inviso -equos, volucres Lampetie Delius. Coepere auras hoc modo nuper habenas arma, -**lacerto consurgere** septem cornua vespere. Crescendo his, est coniunx umeris! - -## Viscera optima matrona prehensis quaerit inmurmurat divino - -Perdere et iamque, habent in Thaumantias emicuit, ipse perque vultus iuvat, -dextera quae, flamma utraque. Coercuit inponi, avidaeque merui femina proxima -derectos crimen iuro membra alte tollens; bracchia albis concidit. - -> Pascas cuius parilique *undis* in hanc memori, hunc ipsis dubitas loquentis -> precatur essem: **sine**. Non [satis](http://www.sospite.net/nec-et), abstinet -> tumulus. Diffidunt sacrifica si aether umbras quasi, fatis saepe *favete*. -> Transitus redit coniunx ostentis in nati mea eurus tegumen, est haec, in ista -> ab iussa stetit Iunonia et! - -Tenuisse regni, [tepente caecoque Mopsopium](http://per.com/notissima.html), -corripiens vulgus; est [dies](http://precor.com/) est terrae collo ad mandabat -*conclamat movere vocem*. Concipiunt enim. Te fulvum **sortes** in neque, agendo -mihi Phoebus. Facies et simillima titubare: Erasinus *oras*. - -Circumstant bis et litore; hoc aquarum inulta, diurnis et et suos crabronis, est -sub tellure blandis? Novemque quem, potentes quamvis non ante moderante reice -inhibere consorte praedaeque Agenorides ad *dextrae* visa. In **corpore**: et -fatemur, resides contraxit Athamanta novum. Leve tellus moenibus arduus postmodo -Salamis pulvinaribus male et foedus potat Erytum toros est. diff --git a/content/tutorials/another-guide/30.last-step.md b/content/tutorials/another-guide/30.last-step.md deleted file mode 100644 index aa10fc80..00000000 --- a/content/tutorials/another-guide/30.last-step.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: Final Step -description: The last step to this guide. ---- - -## Pede si diva cruentat et non patri - -Lorem markdownum illud **si**, boum gelidis ab limite, pallore poenam -navifragumque filo: vectus in. Dant passis tolerare omen natam *postquam -fluminis moliturque* fatebar curru videamus mox tergoque adit [armigerumque -alter](http://miserrimus.io/cedere.html) tandem, erat conata. Draconibus -transtra. - -- Ducit frigus consequitur alimentaque Eurydicenque virgineos Abantiades -- Saepe tollens contemptor corpora tuam -- Loricamque utque neu non loquerentur acui -- Extremis aequantur cognoscit qui orbis spumantia pariter -- Muta utque patitur verti vetustas forma - -Tenebat Pelops Rhenum vacantem hinc plumbo subito quae via annos populari inviso -equos, volucres Lampetie Delius. Coepere auras hoc modo nuper habenas arma, -**lacerto consurgere** septem cornua vespere. Crescendo his, est coniunx umeris! - -## Viscera optima matrona prehensis quaerit inmurmurat divino - -Perdere et iamque, habent in Thaumantias emicuit, ipse perque vultus iuvat, -dextera quae, flamma utraque. Coercuit inponi, avidaeque merui femina proxima -derectos crimen iuro membra alte tollens; bracchia albis concidit. - -> Pascas cuius parilique *undis* in hanc memori, hunc ipsis dubitas loquentis -> precatur essem: **sine**. Non [satis](http://www.sospite.net/nec-et), abstinet -> tumulus. Diffidunt sacrifica si aether umbras quasi, fatis saepe *favete*. -> Transitus redit coniunx ostentis in nati mea eurus tegumen, est haec, in ista -> ab iussa stetit Iunonia et! - -Tenuisse regni, [tepente caecoque Mopsopium](http://per.com/notissima.html), -corripiens vulgus; est [dies](http://precor.com/) est terrae collo ad mandabat -*conclamat movere vocem*. Concipiunt enim. Te fulvum **sortes** in neque, agendo -mihi Phoebus. Facies et simillima titubare: Erasinus *oras*. - -Circumstant bis et litore; hoc aquarum inulta, diurnis et et suos crabronis, est -sub tellure blandis? Novemque quem, potentes quamvis non ante moderante reice -inhibere consorte praedaeque Agenorides ad *dextrae* visa. In **corpore**: et -fatemur, resides contraxit Athamanta novum. Leve tellus moenibus arduus postmodo -Salamis pulvinaribus male et foedus potat Erytum toros est. diff --git a/content/tutorials/another-guide/_info.yml b/content/tutorials/another-guide/_info.yml deleted file mode 100644 index 6f1b5a03..00000000 --- a/content/tutorials/another-guide/_info.yml +++ /dev/null @@ -1,28 +0,0 @@ -title: Another Guide -author: - name: Jane Doe - url: https://example.com - avatar: https://avatars.githubusercontent.com/u/812331?v=4 -github_repo: https://github.com/zkSync-Community-Hub -tags: - - web3 - - vyper -summary: This is a short description of the guide that will show up on tweets or previews. -description: - This is an extra long description that goes into more detail about the guide. It can be as long as you want, but it - should be a few sentences long. This is an extra long description that goes into more detail about the guide. It can - be as long as you want, but it should be a few sentences long. This is an extra long description that goes into more - detail about the guide. It can be as long as you want, but it should be a few sentences long. -what_you_will_learn: - - You'll learn how to make an example app - - You'll learn new tools - - ??? - - Profit! -updated: 2024-04-25 -tools: - - Git - - Docker - - zksync-cli - - Hardhat -related_tutorials: - - /tutorials/another-tutorial diff --git a/content/tutorials/best-tutorial/10.index.md b/content/tutorials/best-tutorial/10.index.md deleted file mode 100644 index d4086c5c..00000000 --- a/content/tutorials/best-tutorial/10.index.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: Best Tutorial -description: The best tutorial to learn from. ---- - -## Avidi deceptam precesque struxisse - -Lorem **markdownum quacumque**, ait pectore lacu. Unda exerceor, ille lacrimis -ardent, non factus Laurentes equo aequora, mater aura? Ausorum fruge moturaque -fama: intellecta subiere erat laborem. Est fallente, procorum, sospes? - -1. Quicumque nisi petuntur -2. Tecta fuga tabuerit -3. Vigor exitium ad maior bracchia Seriphi dubites -4. Nympha per puerum quotiensque mihi -5. Quaerere sum socer -6. Ea vocant dextra lurida dicemur Phaethon cultros - -## Rogant et acervo hausta cognoscit diversa - -Procul ruitis quaecumque natus; corpore rettulit Telephus totius et Actaeon -utraque, deciperetur. Nobis congerie lentaque, [ut paene -loquendo](http://www.opertosnon.org/matrescorpora) lapidoso te utque erat -densetur tonitruque et. Fila hinc quibus increscere osse pariter! - -> Cepisse deceant fati: posset induitur auras leves Anaxarete sustinet, veteres. -> Mortis abest Cephea *Maeonios ut* caelo prima tergo usque sustinet Gorgonis. -> Fefellerat *fecit*, Ennomon figura. - -## Iuveni opus - -Sagittis capillos, super ante omnia undas: frater ecce tyranni novis. Ad sed -corripit territa fidem fontes contraria spargere, tam obstipuit caput. Fert -datis positaque Cybeleia [fida se refugerat](http://talia.com/) mutabit erit -tellure amnis potenti parentum ad quidem retro, gesserit relinquunt. Nutrita ubi -latebris humilis saxo; in carebat manet deum [vacuas officium -cervice](http://www.suus-visa.com/corpusqueprofanus.html) sideribus terrebant -manente. - - barSkyscraperOsd += 88; - opticalVideoPublishing += rwComputer(architecture, midiMemoryMultithreading) - + cServerFramework.rss(ocr_property_emulation) * nuiSoftware; - var dma_motion_pitch = server; - -Trabibus tenebant edita! Fixa sibi supremaque nostra, antiquis fugit, redeuntem -error, viscera caelesti sanguine. Certamine neve sunt victa eodem Achilles ne -celer frondibus paulatim: grave. Pars mox Argos, humo [ille quoque -referam](http://arva.com/plumbo-ferendo.php) deprendit nullum. Reliquit ut ter -et videbar liceret pinum. - -Ut quoque, relictus *inplevi* prius [Parnasia plura -ingemuit](http://www.divinae.io/spiritus.html) mane. Libidine muneris et lucem, -habitusque est populi sed mea petens frugum nescius. diff --git a/content/tutorials/best-tutorial/20.next.md b/content/tutorials/best-tutorial/20.next.md deleted file mode 100644 index c91dbdde..00000000 --- a/content/tutorials/best-tutorial/20.next.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: Finish -description: We finish up the guide here. ---- - -## Pede si diva cruentat et non patri - -Lorem markdownum illud **si**, boum gelidis ab limite, pallore poenam -navifragumque filo: vectus in. Dant passis tolerare omen natam *postquam -fluminis moliturque* fatebar curru videamus mox tergoque adit [armigerumque -alter](http://miserrimus.io/cedere.html) tandem, erat conata. Draconibus -transtra. - -- Ducit frigus consequitur alimentaque Eurydicenque virgineos Abantiades -- Saepe tollens contemptor corpora tuam -- Loricamque utque neu non loquerentur acui -- Extremis aequantur cognoscit qui orbis spumantia pariter -- Muta utque patitur verti vetustas forma - -Tenebat Pelops Rhenum vacantem hinc plumbo subito quae via annos populari inviso -equos, volucres Lampetie Delius. Coepere auras hoc modo nuper habenas arma, -**lacerto consurgere** septem cornua vespere. Crescendo his, est coniunx umeris! - -## Viscera optima matrona prehensis quaerit inmurmurat divino - -Perdere et iamque, habent in Thaumantias emicuit, ipse perque vultus iuvat, -dextera quae, flamma utraque. Coercuit inponi, avidaeque merui femina proxima -derectos crimen iuro membra alte tollens; bracchia albis concidit. - -> Pascas cuius parilique *undis* in hanc memori, hunc ipsis dubitas loquentis -> precatur essem: **sine**. Non [satis](http://www.sospite.net/nec-et), abstinet -> tumulus. Diffidunt sacrifica si aether umbras quasi, fatis saepe *favete*. -> Transitus redit coniunx ostentis in nati mea eurus tegumen, est haec, in ista -> ab iussa stetit Iunonia et! - -Tenuisse regni, [tepente caecoque Mopsopium](http://per.com/notissima.html), -corripiens vulgus; est [dies](http://precor.com/) est terrae collo ad mandabat -*conclamat movere vocem*. Concipiunt enim. Te fulvum **sortes** in neque, agendo -mihi Phoebus. Facies et simillima titubare: Erasinus *oras*. - -Circumstant bis et litore; hoc aquarum inulta, diurnis et et suos crabronis, est -sub tellure blandis? Novemque quem, potentes quamvis non ante moderante reice -inhibere consorte praedaeque Agenorides ad *dextrae* visa. In **corpore**: et -fatemur, resides contraxit Athamanta novum. Leve tellus moenibus arduus postmodo -Salamis pulvinaribus male et foedus potat Erytum toros est. diff --git a/content/tutorials/best-tutorial/_info.yml b/content/tutorials/best-tutorial/_info.yml deleted file mode 100644 index 702ff497..00000000 --- a/content/tutorials/best-tutorial/_info.yml +++ /dev/null @@ -1,27 +0,0 @@ -title: Best Tutorial -author: - name: Jane Doe - url: https://example.com - avatar: https://avatars.githubusercontent.com/u/812331?v=4 -github_repo: https://github.com/zkSync-Community-Hub -tags: - - hardhat - - viem - - solidity -summary: This is a short description of the guide that will show up on tweets or previews. -description: - This is an extra long description that goes into more detail about the guide. It can be as long as you want, but it - should be a few sentences long. -what_you_will_learn: - - You'll learn how to make an example app - - You'll learn new tools - - ??? - - Profit! -updated: 2024-04-25 -tools: - - Git - - Docker - - zksync-cli - - Hardhat -related_tutorials: - - /tutorials/another-tutorial diff --git a/content/tutorials/cool-guide/10.index.md b/content/tutorials/cool-guide/10.index.md deleted file mode 100644 index b452adbd..00000000 --- a/content/tutorials/cool-guide/10.index.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: Cool Guide -description: Learn from the coolest guide. ---- - -## Avidi deceptam precesque struxisse - -Lorem **markdownum quacumque**, ait pectore lacu. Unda exerceor, ille lacrimis -ardent, non factus Laurentes equo aequora, mater aura? Ausorum fruge moturaque -fama: intellecta subiere erat laborem. Est fallente, procorum, sospes? - -1. Quicumque nisi petuntur -2. Tecta fuga tabuerit -3. Vigor exitium ad maior bracchia Seriphi dubites -4. Nympha per puerum quotiensque mihi -5. Quaerere sum socer -6. Ea vocant dextra lurida dicemur Phaethon cultros - -## Rogant et acervo hausta cognoscit diversa - -Procul ruitis quaecumque natus; corpore rettulit Telephus totius et Actaeon -utraque, deciperetur. Nobis congerie lentaque, [ut paene -loquendo](http://www.opertosnon.org/matrescorpora) lapidoso te utque erat -densetur tonitruque et. Fila hinc quibus increscere osse pariter! - -> Cepisse deceant fati: posset induitur auras leves Anaxarete sustinet, veteres. -> Mortis abest Cephea *Maeonios ut* caelo prima tergo usque sustinet Gorgonis. -> Fefellerat *fecit*, Ennomon figura. - -## Iuveni opus - -Sagittis capillos, super ante omnia undas: frater ecce tyranni novis. Ad sed -corripit territa fidem fontes contraria spargere, tam obstipuit caput. Fert -datis positaque Cybeleia [fida se refugerat](http://talia.com/) mutabit erit -tellure amnis potenti parentum ad quidem retro, gesserit relinquunt. Nutrita ubi -latebris humilis saxo; in carebat manet deum [vacuas officium -cervice](http://www.suus-visa.com/corpusqueprofanus.html) sideribus terrebant -manente. - - barSkyscraperOsd += 88; - opticalVideoPublishing += rwComputer(architecture, midiMemoryMultithreading) - + cServerFramework.rss(ocr_property_emulation) * nuiSoftware; - var dma_motion_pitch = server; - -Trabibus tenebant edita! Fixa sibi supremaque nostra, antiquis fugit, redeuntem -error, viscera caelesti sanguine. Certamine neve sunt victa eodem Achilles ne -celer frondibus paulatim: grave. Pars mox Argos, humo [ille quoque -referam](http://arva.com/plumbo-ferendo.php) deprendit nullum. Reliquit ut ter -et videbar liceret pinum. - -Ut quoque, relictus *inplevi* prius [Parnasia plura -ingemuit](http://www.divinae.io/spiritus.html) mane. Libidine muneris et lucem, -habitusque est populi sed mea petens frugum nescius. diff --git a/content/tutorials/cool-guide/20.next.md b/content/tutorials/cool-guide/20.next.md deleted file mode 100644 index e58f0ad1..00000000 --- a/content/tutorials/cool-guide/20.next.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: Second Cool Step -description: The next step in the guide ---- - -## Pede si diva cruentat et non patri - -Lorem markdownum illud **si**, boum gelidis ab limite, pallore poenam -navifragumque filo: vectus in. Dant passis tolerare omen natam *postquam -fluminis moliturque* fatebar curru videamus mox tergoque adit [armigerumque -alter](http://miserrimus.io/cedere.html) tandem, erat conata. Draconibus -transtra. - -- Ducit frigus consequitur alimentaque Eurydicenque virgineos Abantiades -- Saepe tollens contemptor corpora tuam -- Loricamque utque neu non loquerentur acui -- Extremis aequantur cognoscit qui orbis spumantia pariter -- Muta utque patitur verti vetustas forma - -Tenebat Pelops Rhenum vacantem hinc plumbo subito quae via annos populari inviso -equos, volucres Lampetie Delius. Coepere auras hoc modo nuper habenas arma, -**lacerto consurgere** septem cornua vespere. Crescendo his, est coniunx umeris! - -## Viscera optima matrona prehensis quaerit inmurmurat divino - -Perdere et iamque, habent in Thaumantias emicuit, ipse perque vultus iuvat, -dextera quae, flamma utraque. Coercuit inponi, avidaeque merui femina proxima -derectos crimen iuro membra alte tollens; bracchia albis concidit. - -> Pascas cuius parilique *undis* in hanc memori, hunc ipsis dubitas loquentis -> precatur essem: **sine**. Non [satis](http://www.sospite.net/nec-et), abstinet -> tumulus. Diffidunt sacrifica si aether umbras quasi, fatis saepe *favete*. -> Transitus redit coniunx ostentis in nati mea eurus tegumen, est haec, in ista -> ab iussa stetit Iunonia et! - -Tenuisse regni, [tepente caecoque Mopsopium](http://per.com/notissima.html), -corripiens vulgus; est [dies](http://precor.com/) est terrae collo ad mandabat -*conclamat movere vocem*. Concipiunt enim. Te fulvum **sortes** in neque, agendo -mihi Phoebus. Facies et simillima titubare: Erasinus *oras*. - -Circumstant bis et litore; hoc aquarum inulta, diurnis et et suos crabronis, est -sub tellure blandis? Novemque quem, potentes quamvis non ante moderante reice -inhibere consorte praedaeque Agenorides ad *dextrae* visa. In **corpore**: et -fatemur, resides contraxit Athamanta novum. Leve tellus moenibus arduus postmodo -Salamis pulvinaribus male et foedus potat Erytum toros est. diff --git a/content/tutorials/cool-guide/_info.yml b/content/tutorials/cool-guide/_info.yml deleted file mode 100644 index 644b9512..00000000 --- a/content/tutorials/cool-guide/_info.yml +++ /dev/null @@ -1,28 +0,0 @@ -title: Cool Guide -author: - name: Jane Doe - url: https://example.com - avatar: https://avatars.githubusercontent.com/u/812331?v=4 -github_repo: https://github.com/zkSync-Community-Hub -tags: - - foundry - - solidity -summary: This is a short description of the guide that will show up on tweets or previews. -description: - This is an extra long description that goes into more detail about the guide. It can be as long as you want, but it - should be a few sentences long. This is an extra long description that goes into more detail about the guide. It can - be as long as you want, but it should be a few sentences long. This is an extra long description that goes into more - detail about the guide. It can be as long as you want, but it should be a few sentences long. -what_you_will_learn: - - You'll learn how to make an example app - - You'll learn new tools - - ??? - - Profit! -updated: 2024-04-25 -tools: - - Git - - Docker - - zksync-cli - - Hardhat -related_tutorials: - - /tutorials/another-tutorial diff --git a/content/tutorials/cross-chain-governance/10.index.md b/content/tutorials/cross-chain-governance/10.index.md new file mode 100644 index 00000000..64fab623 --- /dev/null +++ b/content/tutorials/cross-chain-governance/10.index.md @@ -0,0 +1,213 @@ +--- +title: L1 governance contract +description: Build and deploy a smart contract in L1 and send transactions that update the state of a contract in ZKsync. +--- + +This tutorial shows you how to implement communication between L1 and L2 with the following example: + +- A **Governance** Solidity smart contract is deployed on layer 1. This contract has a function that sends a transaction to zkSync layer 2. +- A **Counter** Solidity smart contract is deployed on zkSync layer 2. This contract stores a number that is incremented by calling the `increment` method. The `Governance` contract on layer 1 calls this function. + +## Prerequisites + +- Make sure your machine satisfies the [system requirements](https://github.com/matter-labs/era-compiler-solidity/tree/main#system-requirements). +- You are already familiar with deploying smart contracts on zkSync Era. If not, please refer to the first section of the [quickstart tutorial](../../quick-start/hello-world.md). +- You already have some experience working with Ethereum. +- A wallet with sufficient Sepolia or Göerli `ETH` on Ethereum and zkSync Era Testnet to pay for deploying smart contracts. You can get Sepolia ETH from the [network faucets](../../tooling/network-faucets.md). + - Get testnet `ETH` for zkSync Era using [bridges](https://zksync.io/explore#bridges) to bridge funds to zkSync. +- You know how to get your [private key from your MetaMask wallet](https://support.metamask.io/hc/en-us/articles/360015289632-How-to-export-an-account-s-private-key). + +::callout{icon="i-heroicons-light-bulb"} +Skip the hassle for test ETH by using `zksync-cli` for local testing. Simply execute `npx zksync-cli dev start` to initialize a local zkSync development environment, which includes local Ethereum and zkSync nodes. This method allows you to test contracts without requesting external testnet funds. Explore more in the [zksync-cli documentation](../../tooling/zksync-cli/getting-started.md). +:: + +### Complete Project + +Download the complete project [here](https://github.com/matter-labs/tutorials/tree/main/cross-chain). + +## Project Setup + +Open a terminal window, create a new folder for the project tutorial, e.g. `mkdir cross-chain-tutorial`, and `cd` into the folder. + +Now create separate folders to store contracts and scripts on L1 and L2. For now we will start with L1-governance folder. + +```sh +mkdir L1-governance +``` + +::callout{icon="i-heroicons-exclamation-circle"} +The `L1-governance` code is a default Hardhat project used to deploy a contract on L1. +The `L2-counter` code includes all zkSync dependencies and configurations for L2. +:: + +## L1 Governance + +1. `cd` into `L1-governance`. + +2. Run the following to initialise and set up the L1 project: + +```sh +npx hardhat +``` + +Select the option **Create a Typescript project** and accept the defaults for everything else. + +::callout{icon="i-heroicons-exclamation-circle"} +To interact with the zkSync bridge contract using Solidity, you need the zkSync contract interface. There are two ways to get it: + +- Import it from the `@matterlabs/zksync-contracts` npm package (preferred). +- Download it from the [contracts repo](https://github.com/matter-labs/era-contracts). +:: + +1. Install the following dependencies: + +Make sure you use actual node (lts version) and actual npm version +::code-group +```bash [npm] +npm i -D typescript ts-node @openzeppelin/contracts @matterlabs/zksync-contracts @nomicfoundation/hardhat-ethers @typechain/ethers-v6 @typechain/hardhat typechain ethers +``` + +```bash [yarn] +yarn add -D typescript ts-node @openzeppelin/contracts @matterlabs/zksync-contracts @nomicfoundation/hardhat-ethers @typechain/ethers-v6 @typechain/hardhat typechain ethers +``` + +:: + +### Create L1 Governance Contract + +::callout{icon="i-heroicons-light-bulb"} +Make sure you're still in the `L1-governance` folder. +:: + +The following Solidity code defines the Governance smart contract. + +The constructor sets the contract creator as the single governor. The `callZkSync` function calls a transaction on L2 which can only be called by the governor. + +1. Remove existing `/test` directory and any contracts that exist in `/contracts`. + +2. `cd` into the `contracts\` folder. + +3. Create a file called `Governance.sol` and copy/paste the code below into it. + +```solidity +// SPDX-License-Identifier: Unlicense +pragma solidity ^0.8.13; + +import "@matterlabs/zksync-contracts/l1/contracts/zksync/interfaces/IZkSync.sol"; + +contract Governance { + address public governor; + + constructor() { + governor = msg.sender; + } + + function callZkSync( + address zkSyncAddress, + address contractAddr, + bytes memory data, + uint256 gasLimit, + uint256 gasPerPubdataByteLimit + ) external payable { + require(msg.sender == governor, "Only governor is allowed"); + + IZkSync zksync = IZkSync(zkSyncAddress); + zksync.requestL2Transaction{value: msg.value}(contractAddr, 0, + data, gasLimit, gasPerPubdataByteLimit, new bytes[](0), msg.sender); + } +} +``` + +### Deploy L1 Governance Contract + +1. Create the file `L1-Governance/sepolia.json` and copy/paste the code below, filling in the relevant values. Find node provider urls [here](https://chainlist.org/chain/11155111). You have to connect your wallet to the network and add the network to the wallet in advance. + +`L1-Governance/sepolia.json` file + +```json +{ + "nodeUrl": "", + "deployerPrivateKey": "" +} +``` + +2. Replace the code in `hardhat.config.ts` with the following: + +```ts +import "@nomicfoundation/hardhat-ethers"; +import { HardhatUserConfig } from "hardhat/config"; + +// import file with Sepolia params +const sepolia = require("./sepolia.json"); + +const config: HardhatUserConfig = { + solidity: { + version: "0.8.20", + }, + networks: { + // Sepolia network + sepolia: { + url: sepolia.nodeUrl, + accounts: [sepolia.deployerPrivateKey], + }, + }, +}; + +export default config; +``` + +3. Navigate to the `scripts` folder and copy/paste the following code into the `deploy.ts` file (removing any previous code): + +```ts +// We require the Hardhat Runtime Environment explicitly here. This is optional +// but useful for running the script in a standalone fashion through `node