argent钱包源码-(二)创建钱包流程

一、创建钱包的流程:

1、调用walletFactory的createCounterfactualWallet方法创建钱包;

2、通过输入盐进行加工,生成唯一的盐,创建钱包,得到create2钱包地址;

3、进行管理员验签,调用者必须是walletFactory的管理员;

4、然后初始化创建的钱包,设置钱包主人和模块合约;

5、如果设置了回退token(refundToken)和回退地址(refundAddress),那么调用钱包合约的invoke方法将钱包的钱回退(前提是该钱包地址必须提前转入资产)

详细流程图和合约方法梳理如下:

create wallet
create wallet

二、提前转入资产

1、由于钱包地址是通过盐+create2创建的,因此钱包地址可以通过相应的规则提前知晓;

2、walletFactory合约已经提供了提前获取合约地址的方法getAddressForCounterfactualWallet ,因此我们通过调用该方法可以提前获取地址,并且创建钱包之前注入相应的资产。

Subscribe to daxiong
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.