Expand description
Generic deploy and upgrade primitives, usable over any alloy
Provider that has a wallet wired in. Signing is the consumer’s
concern; nothing here constructs or holds keys.
Structs§
- Libraries
- External libraries deployed once per distinct bytecode, and the address each linked contract substitutes for its placeholders.
Constants§
- LIBRARY_
SALT - The salt every shared library deploys under. Fixed and empty on purpose: a CREATE2 address is a function of the deployer, the salt and the hash of the init code, and the init code is the whole key — the salt has nothing to add.
Functions§
- deploy_
behind_ proxy - Deploy an implementation from
artifactsand put it behind a fresh ERC1967 proxy whose init data isinit_callABI-encoded. Returns the proxy address. The common shape of every UUPS deploy in the stack. - deploy_
contract - Deploy a contract and return its address.
- deploy_
contract_ from - Deploy a contract, optionally fetching the sender’s nonce explicitly.
- deploy_
proxy - Deploy an ERC1967 proxy pointing at
implementationwithinit_data(the ABI-encoded initializer call). - deploy_
with_ ctor - Deploy
bytecodewith ABI-encoded constructor args appended. - library_
address - Where a library with this creation code lands, on every chain: through
the canonical
CREATE2_DEPLOYERunderLIBRARY_SALT. A pure function of the bytes, computable before anything is deployed. - load_
linked_ bytecode - The creation bytecode of
<file>.sol:<contract>with every library it links deployed and substituted:Libraries::deployover the one contract, thenLibraries::link. Mirrors whatforgedoes automatically, except that a library already at its address is reused rather than deployed again. For artifacts with nolinkReferencesthis behaves likeArtifacts::bytecode_namedand sends nothing. - upgrade_
uups - Upgrade a UUPS proxy: deploy
contract’s current implementation fromartifacts, then callupgradeToAndCall(new_impl, data)on the proxy. Returns the new implementation address.datais usually empty (state is already initialized); pass a re-initializer call when the upgrade needs one.