Skip to content

Latest commit

 

History

History
321 lines (278 loc) · 9.73 KB

POT.md

File metadata and controls

321 lines (278 loc) · 9.73 KB

Proof of Authority Tokens (POTs) (POT.sol)

View Source: contracts/core/token/POT.sol

↗ Extends: NPM

POT

POTs can't be used outside of the protocol for example in DEXes. Once NPM token is launched, it will replace POTs. For now, Neptune Mutual team and a few others will have access to POTs. POTs aren't conventional ERC-20 tokens; they can't be transferred freely; they don't have any value, and therefore must not be purchased or sold. Again, POTs are distributed to individuals and companies who particpate in our governance and dispute management portals.

Contract Members

Constants & Variables

contract IStore public s;
mapping(address => bool) public whitelist;
bytes32 public constant NS_MEMBERS;

Events

event WhitelistUpdated(address indexed updatedBy, address[]  accounts, bool[]  statuses);

Functions

function (address timelockOrOwner, IStore store) public nonpayable NPM 

Arguments

Name Type Description
timelockOrOwner address
store IStore
Source Code
constructor(address timelockOrOwner, IStore store) NPM(timelockOrOwner, "Neptune Mutual POT", "POT") {
    // require(timelockOrOwner != address(0), "Invalid owner"); // Already checked in `NPM`
    require(address(store) != address(0), "Invalid store");

    s = store;
    whitelist[address(this)] = true;
    whitelist[timelockOrOwner] = true;
  }

_throwIfNotProtocolMember

function _throwIfNotProtocolMember(address account) private view

Arguments

Name Type Description
account address
Source Code
function _throwIfNotProtocolMember(address account) private view {
    bytes32 key = keccak256(abi.encodePacked(NS_MEMBERS, account));
    bool isMember = s.getBool(key);

    // POTs can only be used within the Neptune Mutual protocol
    require(isMember == true, "Access denied");
  }

updateWhitelist

Updates whitelisted addresses. Provide a list of accounts and list of statuses to add or remove from the whitelist.

function updateWhitelist(address[] accounts, bool[] statuses) external nonpayable onlyOwner 

Arguments

Name Type Description
accounts address[]
statuses bool[]
Source Code
function updateWhitelist(address[] calldata accounts, bool[] memory statuses) external onlyOwner {
    require(accounts.length > 0, "No account");
    require(accounts.length == statuses.length, "Invalid args");

    for (uint256 i = 0; i < accounts.length; i++) {
      whitelist[accounts[i]] = statuses[i];
    }

    emit WhitelistUpdated(msg.sender, accounts, statuses);
  }

_beforeTokenTransfer

function _beforeTokenTransfer(address from, address to, uint256 ) internal view whenNotPaused 

Arguments

Name Type Description
from address
to address
uint256
Source Code
function _beforeTokenTransfer(
    address from,
    address to,
    uint256
  ) internal view override whenNotPaused {
    // Token mints
    if (from == address(0)) {
      // aren't restricted
      return;
    }

    // Someone not whitelisted
    // ............................ can still transfer to a whitelisted address
    if (whitelist[from] == false && whitelist[to] == false) {
      // and to the Neptune Mutual Protocol contracts but nowhere else
      _throwIfNotProtocolMember(to);
    }
  }

Contracts