Skip to content

xyyz12/web3_script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

web3_script

主要在于合约交互,参考别人写,直到自己会写,做个记录

代码参考:https://github.com/JetCyC/web3_script_tutorial

https://github.com/gm365/Web3_Tutorial

教程参考:https://mirror.xyz/gm365.eth/ad4vbp_qLFKaOrAMtE2YZ6pzMuC3ejam-y_62QogSds

1、连接到以太节点

image

image

image

image

之后,就可进行查询链上数据,还是进行转账、合约交互

2、转帐就相当于发送交易(sending transactions)

image

image

通过函数包装了一下交易

3、验证是否与节点连接

image

4、函数实例化来完成这个操作 image

donate:0x43C1CfB2F164251fc9b6c958b64485D2b94870C4

Zksync测试网桥 https://portal.txsync.io/bridge/

image

通过requestL2Transaction函数,实现主网geril代币转移到zk geril上,与原作者交易平台可能不同,做个记录

donate:0x43C1CfB2F164251fc9b6c958b64485D2b94870C4

1、确定合约地址

先在xxxx官方跨链桥测试网页面手工交互

接着从交互记录,找到 Etherscan上合约地址

2、获取合约ABI

image

image

image

image

3、研究函数名及参数具体含义

https://goerli.etherscan.io/address/0x0e9B63A28d26180DBf40E8c579af3aBf98aE05C5#writeProxyContract

image

定位到合约 "Write Contract" 中的 “ ”,例子"depositEth" 函数,获取函数名称及对应参数,,,但是合约里啥都没有,,,幸好留下了abi,通过其它方式找函数名称呗 注:本例中其实是定位到 “Write As Proxy”的页面,说明当前合约是一个可升级合约

看完abi发现,信息不全,在网站 chunk-vendor-xxx.js 文件中定位到了完整的 ABI 信息。 找的途径

1、去github上找代码,在各类js文件中搜”abi”

2、解析4字节函数选择器

3、搜索网页源码的abi信息

image

4、写交互代码,广播交易信息

1c7c447ce0e5a665bf0a0fa5515a56d

练习题:在inputdata 中看refuel转账模块的函数

1705375649291

通过depositnative这个函数实现了跨链,我从主网到arb手动试了一下。弄一个destiid变量,在mian里面设置就可实现自动化

1705376118455

1705376146848

什么是eip--1559 https://medium.com/@CryptoSimons/%E8%AE%A9%E7%9F%BF%E5%B7%A5%E4%B8%80%E8%84%B8%E6%87%B5%E9%80%BC%E7%9A%84eip-1559-%E5%8D%8F%E8%AE%AE-%E7%BB%99%E4%BB%A5%E5%A4%AA%E5%9D%8Agas%E8%B4%B9%E7%94%A8%E5%B8%A6%E6%9D%A5%E4%BA%86%E5%93%AA%E4%BA%9B%E4%BC%98%E5%8C%96-ac594672b2e3

重点是:出了比较火的项目之后,我们可以设置一个较低的基础费用,gas limit,较高的优先费用 max prority。 donate:0x43C1CfB2F164251fc9b6c958b64485D2b94870C4

About

主要在于合约交互,参考别人写,直到自己会写,做个记录

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages