ScannerRegistryCore
ScannerRegistryCore
_stakeThresholds
ScannerUpdated
StakeThresholdChanged
ScannerNotRegistered
PublicRegistrationDisabled
onlyOwnerOf
Checks sender (or metatx signer) is owner of the scanner token.
Name | Type | Description |
---|---|---|
scannerId | uint256 | ERC721 token id of the scanner. |
adminRegister
Scanner registration via admin key.
restricted to SCANNER_ADMIN_ROLE. Scanner address will be converted to uin256 ERC721 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
Checks if scannerId has been registered (minted).
Name | Type | Description |
---|---|---|
scannerId | uint256 | ERC721 token id of the scanner. |
Name | Type | Description |
---|---|---|
[0] | bool | true if scannerId exists, false otherwise. |
register
Public method for scanners to self register in Forta and mint registration ERC721 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
Internal method for scanners to self register in Forta and mint registration ERC721 token. Public staking must be activated in the target chainId.
Scanner address will be converted to uin256 ERC721 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
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
Converts scanner address to uint256 for ERC721 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
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 and is registered, or staking is not yet enabled (stakeController = 0). false otherwise |
_beforeScannerUpdate
_before hook triggered before scanner creation or update.
Does nothing in this base contract.
Name | Type | Description |
---|---|---|
scannerId | uint256 | ERC721 token id of the scanner. |
chainId | uint256 | that the scanner will monitor. |
metadata | string | IPFS pointer to scanner's metadata JSON |
_scannerUpdate
Scanner update logic.
Emits ScannerUpdated(scannerId, chainId, metadata)
Name | Type | Description |
---|---|---|
scannerId | uint256 | ERC721 token id of the scanner. |
chainId | uint256 | that the scanner will monitor. |
metadata | string | IPFS pointer to scanner's metadata JSON |
_afterScannerUpdate
_after hook triggered after scanner creation or update.
emits Router hook
Name | Type | Description |
---|---|---|
scannerId | uint256 | ERC721 token id of the scanner. |
chainId | uint256 | that the scanner will monitor. |
metadata | string | IPFS pointer to scanner's metadata JSON |
_msgSender
Helper to get either msg msg.sender if not a meta transaction, signer of forwarder metatx if it is.
_msgData
Helper to get msg.data if not a meta transaction, forwarder data in metatx if it is.