Skip to main content

AddressSetFactory

Git Source

Title: AddressSetFactory

Author: Golem Foundation

Factory for deterministic AddressSet deployment via CREATE2

Final salt = keccak256(salt, owner). Ownership transfers to specified owner after deployment.

Note: security-contact: [email protected]

State Variables

addressSets

Tracks deployed AddressSets per deployer

mapping(address => AddressSetInfo[]) public addressSets

Functions

deploy

Deploy a new AddressSet with deterministic address

function deploy(bytes32 salt, address owner) external returns (address addressSet);

Parameters

NameTypeDescription
saltbytes32Salt for CREATE2 address derivation
owneraddressAddress that will own the AddressSet

Returns

NameTypeDescription
addressSetaddressDeployed AddressSet address

predictAddress

Predict deployment address before calling deploy

function predictAddress(bytes32 salt, address owner) external view returns (address predicted);

Parameters

NameTypeDescription
saltbytes32Salt for CREATE2 address derivation
owneraddressAddress that will own the AddressSet

Returns

NameTypeDescription
predictedaddressPredicted deployment address

getAddressSetsByDeployer

Returns all AddressSets deployed by a specific address

function getAddressSetsByDeployer(address deployer) external view returns (AddressSetInfo[] memory);

Parameters

NameTypeDescription
deployeraddressDeployer address

_recordAddressSet

function _recordAddressSet(address owner, address deployedAddressSet, bytes32 salt) internal;

Events

AddressSetDeployed

Emitted when a new AddressSet is deployed

event AddressSetDeployed(address indexed deployer, address indexed addressSet, address indexed owner, bytes32 salt);

Parameters

NameTypeDescription
deployeraddressAddress that called deploy
addressSetaddressDeployed AddressSet address
owneraddressAddress that owns the AddressSet
saltbytes32Salt used for CREATE2 derivation

Structs

AddressSetInfo

Information about a deployed AddressSet

struct AddressSetInfo {
address deployerAddress;
uint256 timestamp;
address owner;
address addressSet;
bytes32 salt;
}