0%

ZETA测试网批量上号

eddy swap 交易

我在想一个个的做任务,其中eddy的最好做,只需要完成一笔交易即可。

现在我想直观交易可以代码执行吗?

因为我之前没有用代码交互过合约,我刚才用小狐狸测试下,就是想合约转账,输入金额和数据。

那么本质上还是一笔交易,这个代码貌似可以完成的。

https://explorer.zetachain.com/evm/tx/0xc6cd8c5d9bbd31140c9d7a310e73077927f70697b4b108116baf1ace75acc015

这个就是交易的哈希。

其中eddy swap zeta合约的地址是:

1
0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe

如果我想要用ZETA交易BNB,那么数据就是(0.01ZETA):

1
0x7ff36ab500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000f40a98b91512040c9e640e94bb90ae6df0e663a800000000000000000000000000000000000000000000000000000000656c00e300000000000000000000000000000000000000000000000000000000000000020000000000000000000000005f0b1a82749cb4e2278ec87f8bf6b618dc71a8bf0000000000000000000000002cdd7ff997df5e5e769e06d2766cc7235b9fbcd1

当然,你可以随意输入要兑换的ZETA,这个是兑换为BNB,你也可以尝试兑换其他的。

这是还是带有发送到目的钱包的字符串。

这就需要用到分割字符串的方法,这并不难,只要处理好就可以了。

为了使用方便,我存放在资源目录zeta/eddy/bnb.txt里面了,并且分两行(把钱包去除掉后),最后子啊代码里面再进行拼接即可。

1
2
3
4
5
6
7
8
String filePath = "src/main/resources/zeta/eddy/bnb.txt";
BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
String data1 = bufferedReader.readLine();
String data3 = bufferedReader.readLine();
String address = credentials.getAddress();
String data2 = address.substring(2);
// System.out.println("钱包是:"+data2);
String data = data1 + data2 + data3;

那么,写循环就能解决问题。

根据下面的mint 完成ETH代币后,用ETH对比交易ZETA,这个操作貌似可以赚点手续费。

1
2
3
0x18cbafe500000000000000000000000000000000000000000000000006ccd46763f10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000
2f4e5935baf4ad6ebf3da8d596c95abe8b5934ec
00000000000000000000000000000000000000000000000000000000656c3c1500000000000000000000000000000000000000000000000000000000000000020000000000000000000000009cec89ce7686b1fe4ea7ca708a38d835563df6bf0000000000000000000000005f0b1a82749cb4e2278ec87f8bf6b618dc71a8bf
1
2
3
0x18cbafe500000000000000000000000000000000000000000000000006f05b59d3b20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000
338f9d7161366ba03887d9a5db57982e0144fd29
00000000000000000000000000000000000000000000000000000000656d7a5900000000000000000000000000000000000000000000000000000000000000020000000000000000000000009cec89ce7686b1fe4ea7ca708a38d835563df6bf0000000000000000000000005f0b1a82749cb4e2278ec87f8bf6b618dc71a8bf

合约地址还是上面那个。

艹,交易代币前要先授权,我忘记了。因为之前交易的都是GAS代币ZETA,所以可以不用授权。

授权交易数据:

1
0x095ea7b30000000000000000000000002ca7d64a7efe2d62a725e2b35cf7230d6677ffeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

授权ETH的合约地址:

1
0x9cEC89Ce7686b1FE4Ea7cA708a38D835563dF6BF

淦,经常把授权地址搞错了。

授权地址集合:

1
2
3
4
5
6
7
8
// ETH
0x9cEC89Ce7686b1FE4Ea7cA708a38D835563dF6BF
// BNB
0x2cdD7fF997dF5e5e769E06D2766cC7235B9fbCd1
// BTC
0x5086C84B1B4e7a89dEbcbdDbd6176c4eE4cA5e4d
// MATIC
0x78b3e25E43BBF6D87CF7f3445DebD1a35230CE67

eddy mint 代币

我发现了可以mint代币,只需要调用合约即可(下面ETH)。

1
2
3
0x40c10f19000000000000000000000000
2f4e5935baf4ad6ebf3da8d596c95abe8b5934ec
00000000000000000000000000000000000000000000000006f05b59d3b20000

一目了然,这个还是包含了钱包地址。

mint代币的合约地址:

1
0x9cEC89Ce7686b1FE4Ea7cA708a38D835563dF6BF

我尝试一下其他的mint,看看又什么区别。

这是BNB的调用。

1
0x40c10f190000000000000000000000002f4e5935baf4ad6ebf3da8d596c95abe8b5934ec00000000000000000000000000000000000000000000000006f05b59d3b20000

我们明白了,内容是不变的。

合约地址变了。

1
0x2cdD7fF997dF5e5e769E06D2766cC7235B9fbCd1

下面是整理的合集:

1
2
3
4
5
6
7
8
// ETH
0x9cEC89Ce7686b1FE4Ea7cA708a38D835563dF6BF
// BNB
0x2cdD7fF997dF5e5e769E06D2766cC7235B9fbCd1
// BTC
0x5086C84B1B4e7a89dEbcbdDbd6176c4eE4cA5e4d
// MATIC
0x78b3e25E43BBF6D87CF7f3445DebD1a35230CE67

所以,思路就是,先去mint代币,然后用mint的代币交易。

xdao 创建dao

合约地址:

1
0x72cc6E4DE47f673062c41C67505188144a0a3D84

数据:

1
2
3
0x55a569d700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000330000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000014100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000141000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000
2f4e5935baf4ad6ebf3da8d596c95abe8b5934ec
000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000021e19e0c9bab2400000

别人的:

1
2
3
0x55a569d700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000007616d696c657461000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007414d494c455441000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000
9189ba743b09b4d6ef9c06c2ef224f6f6658b418
00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a7640000

再看一个:

1
2
3
0x55a569d700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000330000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000056f7269766500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054f524956450000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000
63491fd96149ff6a13f645a66c62cedfb7e0acd7
00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a7640000

继续创建一个:

1
2
3
0x55a569d700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000330000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000034554480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000345544800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000
2f4e5935baf4ad6ebf3da8d596c95abe8b5934ec
000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000052b7d2dcc80cd2e4000000