如何在zksync 2.0测试网上部署合约并拿到gitpoap

首先介绍一下基础环境,默认各位看官都拥有一个github账号并且熟悉基础git操作,和一个有goerli水的钱包地址及对应私钥.基础问题自行谷歌解决

打开L2研讨会项目的github地址.

https://github.com/matter-labs/l2-intro-pre-ethdenver

下载代码

第一步,右上角点击fork,分叉该项目到自己的github仓库中

post image
post image

完成后会跳转到分叉后的项目中.在如下位置复制git仓库地址

post image

clone到本地 git clone +复制的地址复制到本地(本地需安装好git环境,可自行谷歌解决)

post image

部署合约

使用熟悉的代码编辑器打开项目文件夹,并做如下修改,私钥不需要0x开头

post image

安装hardhat(需要npm环境和yarn管理包,自行谷歌解决)

post image

编译项目

post image
post image

部署合约到测试网(会存在网络问题,多试几次),记住构造参数和合约地址

post image

验证合约

在2.0测试网中搜索自己的合约地址

https://goerli.explorer.zksync.io/

选择contract,会出现一个verify的按钮,点击它(忘截图了)

post image

然后填好如下信息

post image

源代码在Greeter.sol文件里

post image

版本信息在hardhat.config.ts文件里

post image

点击verify,验证成功后可以看到如下界面,可以连上自己钱包做几笔tx

post image

申请gitpoap

合约做好后,在Deployments.md文件中按照格式添加一行

\合约地址\

post image

保存之后git三连,上传到git仓库里

git add.
git commit -m “update“
git push
post image

然后打开原项目方的仓库地址

https://github.com/matter-labs/l2-intro-pre-ethdenver

创建一个pr

post image

点击Create pull request

post image

继续

post image

完成,等待审核

post image

领取gitpoap

在该网站连接自己想领取gitpoap的钱包地址,然后连接刚刚使用的github地址

https://www.gitpoap.io/

点击检查,需要等审核过后

post image
post image

结尾

点个关注,点个爱心,谢谢家人们了

https://twitter.com/newbee740

post image