OffChainAssetFacet
Facet providing off-chain asset representation for various asset types
Creates tokenized representation of assets held in custody (stocks, crypto, private equity, etc.)
Functions
onlyAuthorizedCustodian
modifier onlyAuthorizedCustodian();
initializeOffChainAsset
Initialize the off-chain asset functionality
function initializeOffChainAsset(OffChainAssetStorage.AssetInfo memory assetInfo) external;
Parameters
assetInfo
OffChainAssetStorage.AssetInfo
Asset information including type and identifiers
addCustodyAttestation
Add custody attestation from authorized custodian
function addCustodyAttestation(uint256 quantity, string memory custodyProof, bytes memory signature)
external
onlyAuthorizedCustodian;
Parameters
quantity
uint256
Number of units held in custody
custodyProof
string
IPFS hash of custody documentation
signature
bytes
Cryptographic signature from custodian
updateValuation
Update valuation information
function updateValuation(uint256 newPrice, uint256 valuationDate, string memory source) external;
Parameters
newPrice
uint256
New price per unit
valuationDate
uint256
Date of valuation
source
string
Source of valuation (e.g., "Bloomberg", "CoinGecko", "Internal")
updateAssetInfo
Update asset information
function updateAssetInfo(string memory field, string memory newValue) external;
Parameters
field
string
The field to update
newValue
string
The new value
authorizeCustodian
Authorize a custodian to provide attestations
function authorizeCustodian(address custodian) external;
Parameters
custodian
address
Address of the custodian
revokeCustodian
Revoke custodian authorization
function revokeCustodian(address custodian) external;
Parameters
custodian
address
Address of the custodian
getMarketValue
Get current market value of tokenized assets for an address
function getMarketValue(address holder) external view returns (uint256 totalValue);
Parameters
holder
address
Address of the token holder
Returns
totalValue
uint256
Total market value in USD (scaled by last valuation price)
getCustodyStatus
Get detailed custody information
function getCustodyStatus()
external
view
returns (uint256 assetsInCustody, string memory custodyProof, uint256 lastUpdate, uint256 attestationCount);
Returns
assetsInCustody
uint256
Current custody status and latest attestation
custodyProof
string
IPFS hash of latest custody proof
lastUpdate
uint256
Timestamp of last custody update
attestationCount
uint256
Number of attestations recorded
getCustodyAttestation
Get custody attestation by index
function getCustodyAttestation(uint256 index) external view returns (OffChainAssetStorage.CustodyAttestation memory);
Parameters
index
uint256
Index in custody history
Returns
<none>
OffChainAssetStorage.CustodyAttestation
Custody attestation details
getAssetLots
Get all lots owned by an address with asset details
function getAssetLots(address owner)
external
view
returns (
bytes32[] memory lotIds,
uint256[] memory quantities,
uint256[] memory costBases,
uint256[] memory purchaseDates
);
Parameters
owner
address
Address to query
Returns
lotIds
bytes32[]
Array of lot IDs
quantities
uint256[]
Array of quantities for each lot
costBases
uint256[]
Array of cost bases for each lot
purchaseDates
uint256[]
Array of purchase dates for each lot
isAuthorizedCustodian
Check if an address is an authorized custodian
function isAuthorizedCustodian(address custodian) external view returns (bool);
Parameters
custodian
address
Address to check
Returns
<none>
bool
True if authorized
getAssetInfo
Get asset information for this off-chain asset token
function getAssetInfo() external view returns (OffChainAssetStorage.AssetInfo memory);
Returns
<none>
OffChainAssetStorage.AssetInfo
Asset details including type, identifiers, and metadata
getAssetTypeString
Get asset type as string for display
function getAssetTypeString(OffChainAssetStorage.AssetType assetType) external pure returns (string memory);
Parameters
assetType
OffChainAssetStorage.AssetType
The asset type enum
Returns
<none>
string
String representation of asset type
generateSymbol
Generate token symbol from asset name and type
function generateSymbol(string memory assetName, OffChainAssetStorage.AssetType assetType)
external
pure
returns (string memory);
Parameters
assetName
string
Name of the asset
assetType
OffChainAssetStorage.AssetType
Type of the asset
Returns
<none>
string
Generated symbol
isOffChainAssetInitialized
Check if the off-chain asset is initialized
function isOffChainAssetInitialized() external view returns (bool);
Returns
<none>
bool
True if initialized
Events
CustodyAttestationAdded
event CustodyAttestationAdded(uint256 quantity, string custodyProof, address attestor);
CustodianAuthorized
event CustodianAuthorized(address indexed custodian);
CustodianRevoked
event CustodianRevoked(address indexed custodian);
ValuationUpdated
event ValuationUpdated(uint256 newPrice, uint256 date, string source);
AssetsTokenized
event AssetsTokenized(address indexed recipient, uint256 quantity, bytes32 lotId);
OffChainAssetInitialized
event OffChainAssetInitialized(string assetName, OffChainAssetStorage.AssetType assetType, string identifier);
AssetInfoUpdated
event AssetInfoUpdated(string field, string oldValue, string newValue);
Errors
OffChainAsset_NotAuthorizedCustodian
error OffChainAsset_NotAuthorizedCustodian();
OffChainAsset_InvalidInput
error OffChainAsset_InvalidInput();
OffChainAsset_ExceedsAvailableAssets
error OffChainAsset_ExceedsAvailableAssets();
OffChainAsset_ExceedsCustodyBalance
error OffChainAsset_ExceedsCustodyBalance();
OffChainAsset_FutureDateNotAllowed
error OffChainAsset_FutureDateNotAllowed();
OffChainAsset_IndexOutOfBounds
error OffChainAsset_IndexOutOfBounds();
OffChainAsset_InvalidAssetType
error OffChainAsset_InvalidAssetType();
Last updated
Was this helpful?