Access Control

1. Summary

Contracts in the PWN Protocol can implement PWNHubAccessControl.sol for managing their access control through the PWN Hub. This is not a standalone contract.

3. Contract details

  • PWNHubAccessControl.sol is written in Solidity version 0.8.16

Features

  • Implements modifiers for managing access control through the PWN Hub

Modifiers

onlyActiveLoan

Overview

This modifier reverts if msg.sender doesn't have the ACTIVE_LOAN tag set in the PWN Hub.

Implementation

modifier onlyActiveLoan() {
    if (hub.hasTag(msg.sender, PWNHubTags.ACTIVE_LOAN) == false)
        revert CallerMissingHubTag(PWNHubTags.ACTIVE_LOAN);
    _;
}
onlyWithTag

Overview

This modifier reverts if msg.sender doesn't have the supplied tag set in the PWN Hub.

This modifier defines one parameter:

  • bytes32tag

Implementation

modifier onlyWithTag(bytes32 tag) {
    if (hub.hasTag(msg.sender, tag) == false)
        revert CallerMissingHubTag(tag);
    _;
}

Last updated