IAsset
Interface for the Asset contract, defining the essential functions and events.
See https://eips.ethereum.org/EIPS/eip-7752
Functions
name
Returns the name of the asset.
function name() external view returns (string memory);
Returns
<none>
string
The name of the asset.
prefix
Returns the prefix of the asset.
function prefix() external view returns (string memory);
Returns
<none>
string
The prefix of the asset.
setName
Sets the name of the asset.
function setName(string memory _name) external;
Parameters
_name
string
The name of the asset.
setPrefix
Sets the prefix of the asset.
function setPrefix(string memory _prefix) external;
Parameters
_prefix
string
The prefix of the asset.
createLot
Creates a brand-new lot (e.g., an initial issuance) for a user.
function createLot(
address owner,
uint96 quantity,
address paymentCurrency,
uint96 costBasis,
uint64 acquisitionDate,
string memory uri,
bytes memory data
) external returns (bytes32 lotId);
Parameters
owner
address
The owner of the lot.
quantity
uint96
The total quantity for this lot.
paymentCurrency
address
The payment currency for this lot.
costBasis
uint96
The cost basis per unit.
acquisitionDate
uint64
The original acquisition date.
uri
string
The URI of the lot.
data
bytes
Additional data associated with the lot.
Returns
lotId
bytes32
The unique ID of the new lot.
transfer
Transfers a lot or partial lot from 'from' to 'to', physically/fully (raw).
function transfer(bytes32 lotId, address to, uint96 quantity, string memory uri, bytes memory data) external;
Parameters
lotId
bytes32
The ID of the lot to transfer from.
to
address
The new owner.
quantity
uint96
The quantity to transfer.
uri
string
The URI of the lot.
data
bytes
Additional data associated with the transfer.
transferFrom
Transfers a lot or partial lot from 'from' to 'to', physically/fully (raw).
function transferFrom(bytes32 lotId, address from, address to, uint96 quantity, string memory uri, bytes memory data)
external;
Parameters
lotId
bytes32
The ID of the lot to transfer from.
from
address
The current owner of the lot.
to
address
The new owner.
quantity
uint96
The quantity to transfer.
uri
string
The URI of the lot.
data
bytes
Additional data associated with the transfer.
adjustLot
Creates a new lot as a child of an old lot, typically used for spin-offs, cost basis corrections, partial reclassifications, etc.
function adjustLot(
bytes32 oldLotId,
uint96 newQuantity,
uint96 newCostBasis,
string memory newUri,
bytes memory newData,
string calldata reason
) external returns (bytes32 newLotId);
Parameters
oldLotId
bytes32
The old lot to be adjusted.
newQuantity
uint96
The quantity for the new lot.
newCostBasis
uint96
The cost basis for the new lot.
newUri
string
The URI for the new lot.
newData
bytes
Additional data associated with the new lot.
reason
string
A short string explaining the adjustment type.
Returns
newLotId
bytes32
The ID of the newly created lot.
getLot
Returns the stored data for a specific lot.
function getLot(bytes32 lotId)
external
view
returns (
bytes32 parentLotId,
bool isValid,
uint96 quantity,
address paymentCurrency,
uint96 costBasis,
uint64 acquisitionDate,
uint64 lastUpdate,
string memory uri,
bytes memory data
);
Parameters
lotId
bytes32
The lot ID to query.
Returns
parentLotId
bytes32
Hash of the parent lot, or 0x0 if none.
isValid
bool
Whether the lot is active.
quantity
uint96
The quantity.
paymentCurrency
address
The payment currency for this lot.
costBasis
uint96
The cost basis.
acquisitionDate
uint64
The original acquisition timestamp (unmodified).
lastUpdate
uint64
The last time this lot was updated.
uri
string
The URI of the lot.
data
bytes
Additional data associated with the lot.
Events
LotCreated
Emitted when a new lot is created (initial issuance or partial sale).
event LotCreated(
address indexed owner,
bytes32 indexed lotId,
bytes32 indexed parentLotId,
uint96 quantity,
address paymentCurrency,
uint96 costBasis,
uint64 acquisitionDate,
uint64 lastUpdate,
string uri,
bytes data
);
Parameters
owner
address
The user who owns this lot.
lotId
bytes32
The unique hash-based identifier of the lot.
parentLotId
bytes32
The lotId from which this lot originated (0x0 if none).
quantity
uint96
The quantity in this new lot.
paymentCurrency
address
The payment currency used for this lot.
costBasis
uint96
The cost basis per unit.
acquisitionDate
uint64
The original acquisition date of the lot.
lastUpdate
uint64
The timestamp when this lot was created/updated.
uri
string
The URI of the lot.
data
bytes
Additional data associated with the lot.
LotTransferred
Emitted when a lot is transferred from one owner to another.
event LotTransferred(
bytes32 indexed lotId, address indexed from, address indexed to, uint96 quantity, string uri, bytes data
);
Parameters
lotId
bytes32
The ID of the lot being transferred.
from
address
The address transferring the lot.
to
address
The address receiving the lot.
quantity
uint96
The quantity being transferred.
uri
string
The URI of the lot.
data
bytes
Additional data associated with the transfer.
LotAdjusted
Emitted when a lot is adjusted, creating a new lot from an old one.
event LotAdjusted(
bytes32 indexed oldLotId,
bytes32 indexed newLotId,
address operator,
uint96 newQuantity,
uint96 newCostBasis,
string newUri,
bytes newData,
string reason
);
Parameters
oldLotId
bytes32
The ID of the original lot.
newLotId
bytes32
The ID of the new adjusted lot.
operator
address
The address performing the adjustment.
newQuantity
uint96
The new quantity of the adjusted lot.
newCostBasis
uint96
The new cost basis of the adjusted lot.
newUri
string
The URI of the new lot.
newData
bytes
Additional data associated with the new lot.
reason
string
The reason for the adjustment.
LotInvalidated
Emitted when a lot is invalidated.
event LotInvalidated(bytes32 indexed lotId);
Parameters
lotId
bytes32
The ID of the lot being invalidated.
ApprovalForAll
Emitted when an operator is approved for all owned lots.
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
Parameters
owner
address
The owner of the lot.
operator
address
The operator being approved.
approved
bool
Whether the operator is approved.
LotApproval
Emitted when a lot is approved for a specific operation.
event LotApproval(bytes32 indexed lotId, address indexed owner, address indexed spender, uint96 amount);
Parameters
lotId
bytes32
The ID of the lot being approved.
owner
address
The owner of the lot.
spender
address
The spender being approved.
amount
uint96
The amount being approved.
Structs
Lot
struct Lot {
bytes32 parentLotId;
uint96 quantity;
address paymentCurrency;
uint96 costBasis;
uint64 acquisitionDate;
uint64 lastUpdate;
bool isValid;
address owner;
string uri;
bytes data;
}
Last updated
Was this helpful?