ScannerRegistryCore
_stakeThresholds
mapping(uint256 => struct IStakeSubject.StakeThreshold) _stakeThresholds
ScannerUpdated
event ScannerUpdated(uint256 scannerId, uint256 chainId, string metadata)
StakeThresholdChanged
event StakeThresholdChanged(uint256 chainId, uint256 min, uint256 max, bool activated)
ScannerNotRegistered
error ScannerNotRegistered(address scanner)
PublicRegistrationDisabled
error PublicRegistrationDisabled(uint256 chainId)
onlyOwnerOf
modifier onlyOwnerOf(uint256 scannerId)
Checks sender (or metatx signer) is owner of the scanner token.
Name | Type | Description |
---|---|---|
scannerId | uint256 | ERC1155 token id of the scanner. |
adminRegister
function adminRegister(address scanner, address owner, uint256 chainId, string metadata) public
Scanner registration via admin key.
restricted to SCANNER_ADMIN_ROLE. Scanner address will be converted to uin256 ERC1155 token id.
Name | Type | Description |
---|---|---|
scanner | address | address generated by scanner software. |
owner | address | of the scanner. Will have admin privileges over the registering scanner. |
chainId | uint256 | that the scanner will monitor. |
metadata | string | IPFS pointer to scanner's metadata JSON |
isRegistered
function isRegistered(uint256 scannerId) public view returns (bool)
Checks if scannerId has been registered (minted).
Name | Type | Description |
---|---|---|
scannerId | uint256 | ERC1155 token id of the scanner. |
Name | Type | Description |
---|---|---|
[0] | bool | true if scannerId exists, false otherwise. |
register
function register(address owner, uint256 chainId, string metadata) public virtual
Public method for scanners to self register in Forta and mint registration ERC1155 token.
__msgSender() will be considered the Scanner Node address._
Name | Type | Description |
---|---|---|
owner | address | of the scanner. Will have admin privileges over the registering scanner. |
chainId | uint256 | that the scanner will monitor. |
metadata | string | IPFS pointer to scanner's metadata JSON |
_register
function _register(address scanner, address owner, uint256 chainId, string metadata) internal
Internal method for scanners to self register in Forta and mint registration ERC1155 token. Public staking must be activated in the target chainId.
Scanner address will be converted to uin256 ERC1155 token id. Will trigger _before and _after hooks within the inheritance tree.
Name | Type | Description |
---|---|---|
scanner | address | |
owner | address | of the scanner. Will have admin privileges over the registering scanner. |
chainId | uint256 | that the scanner will monitor. |
metadata | string | IPFS pointer to scanner's metadata JSON |
adminUpdate
function adminUpdate(address scanner, uint256 chainId, string metadata) public
Allows the admin to update chainId and metadata.
Restricted to SCANNER_ADMIN_ROLE. Will trigger _before and _after hooks within the inheritance tree.
Name | Type | Description |
---|---|---|
scanner | address | address of the Scanner Node. |
chainId | uint256 | that the scanner will monitor. |
metadata | string | IPFS pointer to scanner's metadata JSON |
scannerAddressToId
function scannerAddressToId(address scanner) public pure returns (uint256)
Converts scanner address to uint256 for ERC1155 Token Id.
setStakeThreshold
function setStakeThreshold(struct IStakeSubject.StakeThreshold newStakeThreshold, uint256 chainId) external
Sets stake parameters (min, max, activated) for a `chainId`. Restricted to SCANNER_ADMIN_ROLE
Name | Type | Description |
---|---|---|
newStakeThreshold | struct IStakeSubject.StakeThreshold | struct with stake parameters. |
chainId | uint256 | chain the parameters will affect. |
_getStakeThreshold
function _getStakeThreshold(uint256 subject) internal view virtual returns (struct IStakeSubject.StakeThreshold)
internal getter for _getStakeThreshold, inheriting contracts may define logic to associate a scanner with a StakeThreshold
getStakeThreshold
function getStakeThreshold(uint256 subject) external view returns (struct IStakeSubject.StakeThreshold)
Getter for StakeThreshold for the scanner with id `subject`
_isStakedOverMin
function _isStakedOverMin(uint256 scannerId) internal view virtual returns (bool)
Checks if scanner is staked over minimum stake
Name | Type | Description |
---|---|---|
scannerId | uint256 | scanner |
Name | Type | Description |
---|---|---|
[0] | bool | true if scanner is staked over the minimum threshold for that chainId, or staking is not yet enabled (stakeController = 0). false otherwise |
_beforeScannerUpdate
function _beforeScannerUpdate(uint256 scannerId, uint256 chainId, string metadata) internal virtual
_before hook triggered before scanner creation or update.
Does nothing in this base contract.
Name | Type | Description |
---|---|---|
scannerId | uint256 | ERC1155 token id of the scanner. |
chainId | uint256 | that the scanner will monitor. |
metadata | string | IPFS pointer to scanner's metadata JSON |
_scannerUpdate
function _scannerUpdate(uint256 scannerId, uint256 chainId, string metadata) internal virtual
Scanner update logic.
Emits ScannerUpdated(scannerId, chainId, metadata)
Name | Type | Description |
---|---|---|
scannerId | uint256 | ERC1155 token id of the scanner. |
chainId | uint256 | that the scanner will monitor. |
metadata | string | IPFS pointer to scanner's metadata JSON |
_afterScannerUpdate
function _afterScannerUpdate(uint256 scannerId, uint256 chainId, string metadata) internal virtual
_after hook triggered after scanner creation or update.
emits Router hook
Name | Type | Description |
---|---|---|
scannerId | uint256 | ERC1155 token id of the scanner. |
chainId | uint256 | that the scanner will monitor. |
metadata | string | IPFS pointer to scanner's metadata JSON |
_msgSender
function _msgSender() internal view virtual returns (address sender)
Helper to get either msg msg.sender if not a meta transaction, signer of forwarder metatx if it is.
_msgData
function _msgData() internal view virtual returns (bytes)
Helper to get msg.data if not a meta transaction, forwarder data in metatx if it is.
__gap
uint256[44] __gap