Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: ZkUseFactoryDep cheatcode documentation #45

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@
- [zkVm](./zksync-specifics/cheatcodes/zk-vm.md)
- [zkVmSkip](./zksync-specifics/cheatcodes/zk-vm-skip.md)
- [zkUsePaymaster](./zksync-specifics/cheatcodes/zk-use-paymaster.md)
- [zkUseFactoryDep](./zksync-specifics/cheatcodes/zk-use-factory-dep.md)
- [Gas Overview](./zksync-specifics/gas.md)
- [Paymaster Overview](./zksync-specifics/paymaster-overview.md)
- [Examples](./zksync-specifics/examples/README.md)
- [Paymaster Approval Based](./zksync-specifics/examples/paymaster-approval-based.md)
- [Ledger](./zksync-specifics/examples/ledger.md)

- [Multisig Smart Account](./zksync-specifics/examples/smart-account.md)
# Supported Commands
- [Command List](./supported-commands/README.md)

Expand Down
28 changes: 28 additions & 0 deletions src/zksync-specifics/cheatcodes/zk-use-factory-dep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## `zkUseFactoryDep`

### Signature

```solidity
function zkUseFactoryDep(string calldata name) external pure;
```

### Description

Enables marking a bytecode as a factory dependency for the next CREATE or CALL and cleared after.
Jrigada marked this conversation as resolved.
Show resolved Hide resolved

This cheatcode is useful when deploying contracts through factories, as it allows marking bytecode as a factory dependency and deploying contracts by passing their bytecode hash to the factory.
Jrigada marked this conversation as resolved.
Show resolved Hide resolved

### Examples

```solidity
contract Deployer {
// Deploy the factory
Factory factory = new Factory(multisigBytecodeHash);
Jrigada marked this conversation as resolved.
Show resolved Hide resolved

// Mark the bytecode as a factory dependency
vmExt.zkUseFactoryDep("TwoUserMultisig");

// Deploy the account using the factory
factory.deployAccount(multisigBytecodeHash);
}
```
Loading
Loading