我试图对元数据事务中的多个操作进行批处理,如下所示:
const transactions: MetaTransactionData[] = [{
to: MODULEPROXYFACTORY,
data: factoryInit,
value: "0",
operation: 1
}, {
to: PROXY,
data: enableModuleData, // Cannot exist yet because the contract is not deployed
value: "0",
operation: 1
}]我想先部署,然后启用相同的模块(在执行事务之前不存在)。这应该是可能的,通过模拟事务,然后编码必要的数据。
我该怎么做?
发布于 2022-07-28 09:27:00
你可以采取两种方法:
setup方法允许您进行一个可选的委托调用,该调用可以是对启用模块的库的调用: /// @dev Setup function sets initial storage of contract.
/// @param _owners List of Safe owners.
/// @param _threshold Number of required confirmations for a Safe transaction.
/// @param to Contract address for optional delegate call.
/// @param data Data payload for optional delegate call.
/// @param fallbackHandler Handler for fallback calls to this contract
/// @param paymentToken Token that should be used for the payment (0 is ETH)
/// @param payment Value that should be paid
/// @param paymentReceiver Address that should receive the payment (or 0 if tx.origin)
function setup(
address[] calldata _owners,
uint256 _threshold,
address to,
bytes calldata data,
address fallbackHandler,
address paymentToken,
uint256 payment,
address payable paymentReceiver
) external {}参见to和data参数。库的一个示例:https://github.com/rmeissner/relay-contracts/blob/main/contracts/EnableModulesLib.sol
CREATE和CREATE2操作码地址的文档:https://docs.openzeppelin.com/cli/2.8/deploying-with-create2#createhttps://ethereum.stackexchange.com/questions/132505
复制相似问题