WarrantFacet
Facet providing Warrant functionality
Diamond facet for warrant creation, management, and exercise calculations
Functions
initializeWarrant
Initialize the Warrant functionality
function initializeWarrant() external;
createWarrantToken
Create a new warrant token
function createWarrantToken(address owner, uint96 quantity, address paymentCurrency, uint96 strikePrice)
external
returns (bytes32 tokenId);
Parameters
owner
address
The owner of the warrant
quantity
uint96
The number of warrants
paymentCurrency
address
The currency in which the warrants are denominated
strikePrice
uint96
The strike price for exercising the warrant
Returns
tokenId
bytes32
The unique identifier of this warrant token
createWarrantTokensBatch
Create multiple warrant tokens in batch
function createWarrantTokensBatch(
address[] memory owners,
uint96[] memory quantities,
address[] memory paymentCurrencies,
uint96[] memory strikePrices
) external returns (bytes32[] memory tokenIds);
Parameters
owners
address[]
Array of owner addresses
quantities
uint96[]
Array of quantities
paymentCurrencies
address[]
Array of payment currencies
strikePrices
uint96[]
Array of strike prices
Returns
tokenIds
bytes32[]
Array of created token IDs
invalidateWarrantToken
Invalidate a warrant token
function invalidateWarrantToken(bytes32 tokenId) external;
Parameters
tokenId
bytes32
The token ID to invalidate
invalidateWarrantTokensBatch
Invalidate multiple warrant tokens in batch
function invalidateWarrantTokensBatch(bytes32[] memory tokenIds) external;
Parameters
tokenIds
bytes32[]
Array of token IDs to invalidate
transferWarrantToken
Transfer a warrant token to a new owner
function transferWarrantToken(bytes32 tokenId, address newOwner) external;
Parameters
tokenId
bytes32
The token ID to transfer
newOwner
address
The new owner address
getWarrantToken
Get warrant token information
function getWarrantToken(bytes32 tokenId)
external
view
returns (bool isValid, address owner, uint96 quantity, address paymentCurrency, uint96 strikePrice);
Parameters
tokenId
bytes32
The token ID
Returns
isValid
bool
Whether the token is valid
owner
address
The current owner
quantity
uint96
The number of warrants
paymentCurrency
address
The payment currency
strikePrice
uint96
The strike price
isWarrantTokenValid
Check if a warrant token is valid
function isWarrantTokenValid(bytes32 tokenId) external view returns (bool);
Parameters
tokenId
bytes32
The token ID
Returns
<none>
bool
True if valid
getOwnerWarrants
Get all warrant tokens for an owner
function getOwnerWarrants(address owner) external view returns (bytes32[] memory);
Parameters
owner
address
The owner address
Returns
<none>
bytes32[]
Array of token IDs
getOwnerWarrantCount
Get the number of warrant tokens for an owner
function getOwnerWarrantCount(address owner) external view returns (uint256);
Parameters
owner
address
The owner address
Returns
<none>
uint256
The count of warrant tokens
getOwnerTotalQuantity
Get total quantity of warrants for an owner
function getOwnerTotalQuantity(address owner) external view returns (uint256);
Parameters
owner
address
The owner address
Returns
<none>
uint256
The total quantity
calculateExerciseValue
Calculate exercise value for a warrant token
function calculateExerciseValue(bytes32 tokenId, uint96 currentPrice) external view returns (uint256);
Parameters
tokenId
bytes32
The token ID
currentPrice
uint96
The current stock price
Returns
<none>
uint256
The exercise value
calculateExerciseCost
Calculate exercise cost for a warrant token
function calculateExerciseCost(bytes32 tokenId) external view returns (uint256);
Parameters
tokenId
bytes32
The token ID
Returns
<none>
uint256
The total cost to exercise
calculateOwnerTotalExerciseValue
Calculate total exercise value for an owner
function calculateOwnerTotalExerciseValue(address owner, uint96 currentPrice) external view returns (uint256);
Parameters
owner
address
The owner address
currentPrice
uint96
The current stock price
Returns
<none>
uint256
The total exercise value
calculateOwnerTotalExerciseCost
Calculate total exercise cost for an owner
function calculateOwnerTotalExerciseCost(address owner) external view returns (uint256);
Parameters
owner
address
The owner address
Returns
<none>
uint256
The total exercise cost
isInTheMoney
Check if warrant is in the money
function isInTheMoney(bytes32 tokenId, uint96 currentPrice) external view returns (bool);
Parameters
tokenId
bytes32
The token ID
currentPrice
uint96
The current stock price
Returns
<none>
bool
True if current price > strike price
getOwnerWarrantDetails
Get detailed warrant information for an owner
function getOwnerWarrantDetails(address owner)
external
view
returns (
bytes32[] memory tokenIds,
uint96[] memory quantities,
address[] memory paymentCurrencies,
uint96[] memory strikePrices,
bool[] memory validFlags
);
Parameters
owner
address
The owner address
Returns
tokenIds
bytes32[]
Array of token IDs
quantities
uint96[]
Array of quantities
paymentCurrencies
address[]
Array of payment currencies
strikePrices
uint96[]
Array of strike prices
validFlags
bool[]
Array of validity flags
calculateExerciseValuesBatch
Calculate exercise values for multiple warrant tokens
function calculateExerciseValuesBatch(bytes32[] memory tokenIds, uint96 currentPrice)
external
view
returns (uint256[] memory exerciseValues);
Parameters
tokenIds
bytes32[]
Array of token IDs
currentPrice
uint96
The current stock price
Returns
exerciseValues
uint256[]
Array of exercise values
getOwnerWarrantSummary
Get summary statistics for all warrants of an owner
function getOwnerWarrantSummary(address owner, uint96 currentPrice)
external
view
returns (
uint256 totalQuantity,
uint256 totalExerciseValue,
uint256 totalExerciseCost,
uint256 inTheMoneyCount,
uint256 validTokenCount,
uint256 totalTokenCount
);
Parameters
owner
address
The owner address
currentPrice
uint96
The current stock price
Returns
totalQuantity
uint256
Total quantity of valid warrants
totalExerciseValue
uint256
Total exercise value at current price
totalExerciseCost
uint256
Total cost to exercise all warrants
inTheMoneyCount
uint256
Number of warrants that are in the money
validTokenCount
uint256
Number of valid warrant tokens
totalTokenCount
uint256
Total number of warrant tokens (including invalid)
isWarrantInitialized
Check if Warrant is initialized
function isWarrantInitialized() external view returns (bool);
Returns
<none>
bool
True if initialized
getWarrantTokenWithExercise
Get warrant token with exercise calculations
function getWarrantTokenWithExercise(bytes32 tokenId, uint96 currentPrice)
external
view
returns (
bool isValid,
address owner,
uint96 quantity,
address paymentCurrency,
uint96 strikePrice,
uint256 exerciseValue,
uint256 exerciseCost,
bool inTheMoney
);
Parameters
tokenId
bytes32
The token ID
currentPrice
uint96
The current stock price
Returns
isValid
bool
Whether the token is valid
owner
address
The current owner
quantity
uint96
The number of warrants
paymentCurrency
address
The payment currency
strikePrice
uint96
The strike price
exerciseValue
uint256
The current exercise value
exerciseCost
uint256
The cost to exercise
inTheMoney
bool
Whether the warrant is in the money
Events
WarrantTokenCreated
event WarrantTokenCreated(
bytes32 indexed tokenId, address indexed owner, uint96 quantity, address paymentCurrency, uint96 strikePrice
);
WarrantTokenInvalidated
event WarrantTokenInvalidated(bytes32 indexed tokenId);
WarrantTokenTransferred
event WarrantTokenTransferred(bytes32 indexed tokenId, address indexed from, address indexed to);
Last updated
Was this helpful?