The PWNHub.sol contract stores tags for each contract in the protocol and therefore defines what contracts are a valid part of the protocol.
2. Important links
3. Contract details
PWNHub.sol is written in Solidity version 0.8.16
Features
Stores tags
Sets tags
Provides view functions to read tags
Inherited contracts, implemented Interfaces and ERCs
Functions
setTag
Overview
An owner of the PWN Hub can add and remove tag to/from different address. This way new contracts to the protocol are added and old ones are deprecated.
This function takes three arguments supplied by the owner:
address_address - Address to which a tag is set
bytes32tag - Tag that is set to the address
bool_hasTag - Boolean determining if the tag will be added or removed
Implementation
function setTag(address _address, bytes32 tag, bool _hasTag) public onlyOwner {
tags[_address][tag] = _hasTag;
emit TagSet(_address, tag, _hasTag);
}
setTags
Overview
This function allows performing setTag on multiple addresses and tags at the same time. Only the addition or removal of tags can be done in one call.
This function takes three arguments supplied by the owner:
address[] memory_addresses - Addresses to which a corresponding tag is set
bytes32[] memorytags - Tags that are set to the corresponding addresses
bool_hasTag - Boolean determining if the tags will be added or removed
Implementation
function setTags(address[] memory _addresses, bytes32[] memory _tags, bool _hasTag) external onlyOwner {
if (_addresses.length != _tags.length)
revert InvalidInputData();
uint256 length = _tags.length;
for (uint256 i; i < length;) {
setTag(_addresses[i], _tags[i], _hasTag);
unchecked { ++i; }
}
}
View Functions
hasTag
Overview
This function checks if an address has a supplied tag set and returns a boolean.
This function takes two arguments supplied by the caller: