Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Latest commit

 

History

History
362 lines (300 loc) · 9.8 KB

StoreBase.md

File metadata and controls

362 lines (300 loc) · 9.8 KB

StoreBase.sol

View Source: contracts/core/store/StoreBase.sol

↗ Extends: IStore, Pausable, Ownable ↘ Derived Contracts: Store

StoreBase

Contract Members

Constants & Variables

//public members
mapping(bytes32 => int256) public intStorage;
mapping(bytes32 => uint256) public uintStorage;
mapping(bytes32 => uint256[]) public uintsStorage;
mapping(bytes32 => address) public addressStorage;
mapping(bytes32 => mapping(address => bool)) public addressBooleanStorage;
mapping(bytes32 => string) public stringStorage;
mapping(bytes32 => bytes) public bytesStorage;
mapping(bytes32 => bytes32) public bytes32Storage;
mapping(bytes32 => bool) public boolStorage;
mapping(bytes32 => address[]) public addressArrayStorage;
mapping(bytes32 => mapping(address => uint256)) public addressArrayAddressPositionMap;

//private members
bytes32 private constant _NS_MEMBERS;

Functions

function () internal nonpayable

Arguments

Name Type Description
Source Code
constructor() {
    boolStorage[keccak256(abi.encodePacked(_NS_MEMBERS, msg.sender))] = true;
    boolStorage[keccak256(abi.encodePacked(_NS_MEMBERS, address(this)))] = true;
  }

recoverEther

Recover all Ether held by the contract.

function recoverEther(address sendTo) external nonpayable onlyOwner 

Arguments

Name Type Description
sendTo address
Source Code
function recoverEther(address sendTo) external onlyOwner {
    // @suppress-pausable Can only be called by the owner
    // @suppress-reentrancy Can only be called by the owner
    // slither-disable-next-line arbitrary-send
    payable(sendTo).transfer(address(this).balance);
  }

recoverToken

Recover all IERC-20 compatible tokens sent to this address.

function recoverToken(address token, address sendTo) external nonpayable onlyOwner 

Arguments

Name Type Description
token address IERC-20 The address of the token contract
sendTo address
Source Code
function recoverToken(address token, address sendTo) external onlyOwner {
    // @suppress-pausable Can only be called by the owner
    // @suppress-reentrancy Can only be called by the owner
    // @suppress-address-trust-issue Although the token can't be trusted, the owner has to check the token code manually.
    IERC20 erc20 = IERC20(token);

    uint256 balance = erc20.balanceOf(address(this));
    require(erc20.transfer(sendTo, balance), "Transfer failed");
  }

pause

function pause() external nonpayable onlyOwner 

Arguments

Name Type Description
Source Code
function pause() external onlyOwner {
    // @suppress-reentrancy Can only be called by the owner
    super._pause();
  }

unpause

function unpause() external nonpayable onlyOwner 

Arguments

Name Type Description
Source Code
function unpause() external onlyOwner {
    // @suppress-reentrancy Can only be called by the owner
    super._unpause();
  }

isProtocolMember

function isProtocolMember(address contractAddress) public view
returns(bool)

Arguments

Name Type Description
contractAddress address
Source Code
function isProtocolMember(address contractAddress) public view returns (bool) {
    return boolStorage[keccak256(abi.encodePacked(_NS_MEMBERS, contractAddress))];
  }

_throwIfPaused

function _throwIfPaused() internal view

Arguments

Name Type Description
Source Code
function _throwIfPaused() internal view {
    require(!super.paused(), "Pausable: paused");
  }

_throwIfSenderNotProtocolMember

function _throwIfSenderNotProtocolMember() internal view

Arguments

Name Type Description
Source Code
function _throwIfSenderNotProtocolMember() internal view {
    require(isProtocolMember(msg.sender), "Forbidden");
  }

Contracts