AssetDeploymentFacet
Facet for deploying assets using unified FacetRegistry approach
Uses FacetRegistry for template management instead of local asset types
Functions
deployDiamond
Deploy a diamond using FactoryBase pattern
function deployDiamond(IDiamond.FacetCut[] memory cuts, bytes memory initData, bytes32 salt)
external
returns (address diamondAddress);
Parameters
cuts
IDiamond.FacetCut[]
Array of facet cuts to install
initData
bytes
Initialization data for the diamond
salt
bytes32
Salt for deterministic deployment
Returns
diamondAddress
address
The address of the deployed diamond
createAsset
Create a new asset diamond using FacetRegistry template
function createAsset(
string memory assetTypeName,
address entity,
string memory name,
string memory symbol,
string memory baseURI,
bytes memory customInitData
) external returns (address assetAddress);
Parameters
assetTypeName
string
The name of the asset type template in FacetRegistry
entity
address
The entity of the asset
name
string
The name of the asset
symbol
string
The symbol of the asset
baseURI
string
The base URI for metadata
customInitData
bytes
Custom initialization data for this specific asset
Returns
assetAddress
address
The address of the created asset diamond
createAssetWithEASAndSanctions
Create a new asset and immediately configure EAS registry and default compliance conditions
Convenience wrapper: deploys the diamond, initializes core, then wires AttestationFacet and ComplianceFacet
function createAssetWithEASAndSanctions(
string memory assetTypeName,
address entity,
string memory name,
string memory symbol,
string memory baseURI,
address attestationRegistry,
bool enableSanctions
) external returns (address assetAddress);
Parameters
assetTypeName
string
The name of the asset type template in FacetRegistry
entity
address
The entity/owner of the asset
name
string
The asset name
symbol
string
The asset symbol
baseURI
string
The base URI for metadata
attestationRegistry
address
Address of the AttestationRegistry diamond to use (EAS-backed)
enableSanctions
bool
Whether to enable the Sanctions condition immediately
Returns
assetAddress
address
The address of the created and configured asset diamond
_initializeAsset
Initialize the asset after deployment
function _initializeAsset(
address assetAddress,
address entity,
string memory name,
string memory symbol,
string memory baseURI,
bytes memory customInitData
) internal;
Parameters
assetAddress
address
The asset diamond address
entity
address
The entity address
name
string
The asset name
symbol
string
The asset symbol
baseURI
string
The base URI
customInitData
bytes
Custom initialization data
isAssetTypeDeployable
Check if an asset type is deployable via FacetRegistry
function isAssetTypeDeployable(string memory assetTypeName) external view returns (bool);
Parameters
assetTypeName
string
Name of the asset type template
Returns
<none>
bool
True if the template exists in FacetRegistry
_requireAuthorized
Check if the caller is authorized to create assets
function _requireAuthorized() internal view;
Events
AssetCreated
event AssetCreated(
address indexed assetAddress, address indexed creator, string indexed assetType, string name, string symbol
);
Errors
AssetDeployment_TemplateNotFound
error AssetDeployment_TemplateNotFound();
AssetDeployment_InvalidEntity
error AssetDeployment_InvalidEntity();
AssetDeployment_NameRequired
error AssetDeployment_NameRequired();
AssetDeployment_SymbolRequired
error AssetDeployment_SymbolRequired();
AssetDeployment_InitializationFailed
error AssetDeployment_InitializationFailed();
AssetDeployment_Unauthorized
error AssetDeployment_Unauthorized();
Last updated
Was this helpful?