目前,我开始学习gnosis安全合同,我对gnosis-代理契约有一个小小的疑问,那就是如何在createProxyWithNonce函数中编码初始化器。
参考事务id:https://rinkeby.etherscan.io/tx/0x1a06fa9fa2e420391ceb159ea41eeb595750ed0d88a14be2e154a7df959f46bc
发布于 2022-08-25 06:00:51
这就是我在打字稿中所做的。
import { Contract } from 'web3-eth-contract';
import { SafeAccountConfig } from '@gnosis.pm/safe-core-sdk';
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
const getInitilizer = (
safeProxyContract: Contract,
methodName: string,
{
owners,
threshold,
to = ZERO_ADDRESS,
data = '0x',
fallbackHandler = ZERO_ADDRESS,
paymentToken = ZERO_ADDRESS,
payment = 0,
paymentReceiver = ZERO_ADDRESS,
}: SafeAccountConfig
) => {
return safeProxyContract.methods[methodName](
owners,
threshold,
to,
data,
fallbackHandler,
paymentToken,
payment,
paymentReceiver
).encodeABI();
};用法:
getInitilizer(<SafeProxyContractInstance>, 'setup', <SafeAccountConfig>);https://stackoverflow.com/questions/71156152
复制相似问题