1. Summary

The PWNHub.sol contract stores tags for each contract in the protocol and therefore defines what contracts are a valid part of the protocol.

3. Contract details

  • PWNHub.sol is written in Solidity version 0.8.16


  • Stores tags

  • Sets tags

  • Provides view functions to read tags

Inherited contracts, implemented Interfaces and ERCs




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


function setTag(address _address, bytes32 tag, bool _hasTag) public onlyOwner {
    tags[_address][tag] = _hasTag;
    emit TagSet(_address, tag, _hasTag);


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


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



This function checks if an address has a supplied tag set and returns a boolean.

This function takes two arguments supplied by the caller:

  • address_address - Address to check

  • bytes32tag - Tag to check


function hasTag(address _address, bytes32 tag) external view returns (bool) {
    return tags[_address][tag];


The PWN Hub contract defines one event and no custom errors.

event TagSet(address indexed _address, bytes32 indexed tag, bool hasTag);

TagSet event is emitted when a tag is set for an address.

This event has three parameters:

  • address indexed_address - Address the tag is set to

  • bytes32 indexedtag - Tag that has been set to the address

  • boolhasTag - Boolean determining if the tag has been set or unset

Last updated