SeriesActivation
Handles the activation of ERC1155 tokens through signature verification
Implements ERC1155Holder to receive and hold tokens until activation
maxTimestampAge
Section titled “maxTimestampAge”uint256 maxTimestampAgeMaximum age of activation timestamp in seconds
tokenContract
Section titled “tokenContract”contract IERC1155 tokenContractToken contract this activation contract works with
tokenHolders
Section titled “tokenHolders”mapping(uint256 => address) tokenHoldersMapping of token IDs to their holders (ephemeral addresses)
A zero address means the token has been activated or was never registered
holderTokenIds
Section titled “holderTokenIds”mapping(address => uint256) holderTokenIdsMapping of holder addresses to their token IDs
Used for reverse lookup during activation
activatedTokens
Section titled “activatedTokens”mapping(uint256 => bool) activatedTokensMapping to track activated tokens
TokenHolderRegistered
Section titled “TokenHolderRegistered”event TokenHolderRegistered(uint256 tokenId, address holder)Emitted when a holder is registered for a token
TokenActivated
Section titled “TokenActivated”event TokenActivated(uint256 tokenId, address holder, address activator)Emitted when a token is activated
InvalidSignature
Section titled “InvalidSignature”error InvalidSignature()TokenAlreadyActivated
Section titled “TokenAlreadyActivated”error TokenAlreadyActivated()TimestampTooOld
Section titled “TimestampTooOld”error TimestampTooOld()FutureTimestampNotAllowed
Section titled “FutureTimestampNotAllowed”error FutureTimestampNotAllowed()TokenNotFound
Section titled “TokenNotFound”error TokenNotFound()UnregisteredTokenTransfer
Section titled “UnregisteredTokenTransfer”error UnregisteredTokenTransfer()InvalidTokenContract
Section titled “InvalidTokenContract”error InvalidTokenContract()ZeroAddressNotAllowed
Section titled “ZeroAddressNotAllowed”error ZeroAddressNotAllowed()TokenAlreadyRegistered
Section titled “TokenAlreadyRegistered”error TokenAlreadyRegistered()HolderNotRegistered
Section titled “HolderNotRegistered”error HolderNotRegistered()EmptyArrays
Section titled “EmptyArrays”error EmptyArrays()ArrayLengthMismatch
Section titled “ArrayLengthMismatch”error ArrayLengthMismatch()constructor
Section titled “constructor”constructor(address _tokenContract, uint256 _maxTimestampAge) publicConstructor sets the token contract and initial timestamp age
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| _tokenContract | address | Address of the ERC1155 token contract |
| _maxTimestampAge | uint256 | Maximum age of activation timestamp in seconds |
onERC1155Received
Section titled “onERC1155Received”function onERC1155Received(address, address, uint256 id, uint256, bytes) public virtual returns (bytes4)Override of ERC1155Holder callback to validate token registration
Ensures tokens can only be received if they have a registered holder
onERC1155BatchReceived
Section titled “onERC1155BatchReceived”function onERC1155BatchReceived(address, address, uint256[] ids, uint256[], bytes) public virtual returns (bytes4)Override of ERC1155Holder callback to validate batch token registration
Ensures tokens can only be received if they have registered holders
registerHolder
Section titled “registerHolder”function registerHolder(uint256 tokenId, address holder) externalRegister a holder (ephemeral address) for a token
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | The ID of the token |
| holder | address | The ephemeral address that will be able to sign for activation |
setMaxTimestampAge
Section titled “setMaxTimestampAge”function setMaxTimestampAge(uint256 newMaxAge) externalUpdate the maximum age allowed for activation timestamps
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| newMaxAge | uint256 | New maximum age in seconds |
tokenStatus
Section titled “tokenStatus”function tokenStatus(uint256 tokenId) external view returns (uint8 status)Get the status of a particular token
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | The ID of the token to query |
Return Values
Section titled “Return Values”| Name | Type | Description |
|---|---|---|
| status | uint8 | 0 = Valid, 1 = Invalid, 2 = Activated |
activate
Section titled “activate”function activate(uint256 timestamp, bytes signature) externalActivate a token by providing a signature from the registered holder
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| timestamp | uint256 | The timestamp used in the signature |
| signature | bytes | The signature proving ownership |
registerHolders
Section titled “registerHolders”function registerHolders(uint256[] tokenIds, address[] holders) externalRegister multiple holders for tokens in a single transaction
Arrays must be of equal length. Estimated gas cost is ~60k gas per registration. At current block gas limit (~30M), this means practically up to ~400 registrations per tx
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| tokenIds | uint256[] | Array of token IDs to register |
| holders | address[] | Array of holder addresses that will be able to sign for activation |