Blockwell

Invest Contract

About

Stats

Public Functions 59
Event Types 20
Code Size 26,958 bytes

Library Use

Uses SafeMath for uint256.
Uses BlockwellQuill for BlockwellQuill.Data.

Events (20) keyboard_arrow_up

AddedToGroup Event

Parameters help
groupId
uint8 help
account
address help

AssetLocked Event

Parameters help
asset
address help
account
address help
value
uint256 help

AssetReturned Event

Parameters help
asset
address help
to
address help
value
uint256 help

AssetUnlocked Event

Parameters help
asset
address help
account
address help
value
uint256 help

BwAddressSet Event

Parameters help
index
uint8 help
account
address help
value
address help

BwChalkSet Event

Parameters help
index
uint8 help
account
address help
value
uint256 help

BwQuillSet Event

Parameters help
index
uint8 help
account
address help
value
string help

Decrease Event

Parameters help
account
address help
value
uint256 help

Increase Event

Parameters help
account
address help
value
uint256 help
assetPaid
address help
assetValue
uint256 help

KycVerificationRemoved Event

Parameters help
account
address help

KycVerified Event

Parameters help
account
address help

Paused Event

Parameters help
account
address help
attorney
bool help

Payment Event

Parameters help
asset
address help
from
address help
value
uint256 help
price
uint256 help
transactionHash
bytes32 help

PriceSet Event

Parameters help
price
uint256 help

Refund Event

Parameters help
asset
address help
to
address help
value
uint256 help

RemovedFromGroup Event

Parameters help
groupId
uint8 help
account
address help

TokenPriceRemoved Event

Parameters help
tokenAddress
address help

TokenPriceSet Event

Parameters help
tokenAddress
address help
price
uint256 help

Unpaused Event

Parameters help
account
address help

Withdraw Event

Parameters help
asset
address help
withdrawer
address help
value
uint256 help

Token Struct

Members
index
uint help
price
uint256 help

User Struct

Members
kycVerified
bool help
balance
uint256 help
assets
mapping(address => uint256) help
assetList
address[] help

ADMIN Constant

uint8 help
1

KYC_ADDER Constant

uint8 help
2

LISTENER Constant

uint8 help
3

ATTORNEY Constant

uint8 help
4

ORACLE Constant

uint8 help
5

name Variable

string help

symbol Variable

string help

decimals Variable

uint8 help

limited Variable

bool help

remainingSupply Variable

uint256 help

price Variable

uint256 help

users Variable

mapping(address => User) help
Internal Variable

unlockedAssets Variable

mapping(address => uint256) help
Internal Variable

withdrawnAssets Variable

mapping(address => uint256) help
Internal Variable

totalTokenSupply Variable

uint256 help
Internal Variable

tokens Variable

mapping(address => Token) help
Internal Variable

tokenList Variable

address[] help
Internal Variable

bwQuill1 Variable

BlockwellQuill.Data help
Internal Variable

bwQuill2 Variable

BlockwellQuill.Data help
Internal Variable

bwQuill3 Variable

BlockwellQuill.Data help
Internal Variable

bwChalk1 Variable

BlockwellQuill.Data help
Internal Variable

bwChalk2 Variable

BlockwellQuill.Data help
Internal Variable

bwAddress1 Variable

BlockwellQuill.Data help
Internal Variable

bwAddress2 Variable

BlockwellQuill.Data help
Internal Variable

pauseState Variable

PauseState help
Internal Variable

groups Variable

Groups.GroupMap help
Internal Variable

Functions Expand All Collapse All

addAttorney keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function addAttorney(address account) public onlyAdminOrAttorney {
  _add(ATTORNEY, account);
}

removeAttorney keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function removeAttorney(address account) public onlyAdminOrAttorney {
  _remove(ATTORNEY, account);
}

isAttorney keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function isAttorney(address account) public view returns (bool) {
  return _contains(ATTORNEY, account);
}

addAdmin keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function addAdmin(address account) public onlyAdminOrAttorney {
  _addAdmin(account);
}

removeAdmin keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function removeAdmin(address account) public onlyAdminOrAttorney {
  _remove(ADMIN, account);
}

isAdmin keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function isAdmin(address account) public view returns (bool) {
  return _contains(ADMIN, account);
}

addKycAdder keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function addKycAdder(address account) public onlyAdminOrAttorney {
  _add(KYC_ADDER, account);
}

removeKycAdder keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function removeKycAdder(address account) public onlyAdminOrAttorney {
  _remove(KYC_ADDER, account);
}

isKycAdder keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function isKycAdder(address account) public view returns (bool) {
  return _contains(KYC_ADDER, account);
}

addListener keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function addListener(address account) public onlyAdminOrAttorney {
  _add(LISTENER, account);
}

removeListener keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function removeListener(address account) public onlyAdminOrAttorney {
  _remove(LISTENER, account);
}

isListener keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function isListener(address account) public view returns (bool) {
  return _contains(LISTENER, account);
}

addOracle keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function addOracle(address account) public onlyAdminOrAttorney {
  _add(ORACLE, account);
}

removeOracle keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function removeOracle(address account) public onlyAdminOrAttorney {
  _remove(ORACLE, account);
}

isOracle keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function isOracle(address account) public view returns (bool) {
  return _contains(ORACLE, account);
}

paused keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function paused() public view returns (bool) {
  return pauseState.paused;
}

pausedByAttorney keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function pausedByAttorney() public view returns (bool) {
  return pauseState.paused && pauseState.pausedByAttorney;
}

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable

Modifiers help

Source Code
function() public payable whenNotPaused {
  if (!isAdmin(msg.sender)) {
    uint256 give = msg.value.div(price).mul(10**uint256(decimals));

    emit Payment(address(0x0), msg.sender, msg.value, price, bytes32(0));
    _assetPaid(address(0x0), msg.sender, msg.value);
    _increase(msg.sender, give, address(0x0), msg.value);
  }
}

applyTokenPayment keyboard_arrow_up

Parameters help

Name Type
from
address help
value
uint256 help
tokenAddress
address help
transactionHash
bytes32 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyListener checks for the following:
null
Source Code
function applyTokenPayment(
  address from,
  uint256 value,
  address tokenAddress,
  bytes32 transactionHash
) public onlyListener whenNotPaused {
  if (!isAdmin(from)) {
    _tokenPayment(from, value, tokenAddress, transactionHash);
  }
}

isKycVerified keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function isKycVerified(address account) public view returns (bool) {
  return users[account].kycVerified;
}

kycVerify keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyKycAdder checks for the following:
null

Requirements help

Source Code
function kycVerify(address account) public onlyKycAdder {
  User storage user = users[account];

  require(!user.kycVerified, "User already KYC Verified");

  address asset;
  for (uint256 i = 0; i < user.assetList.length; i++) {
    asset = user.assetList[i];
    unlockedAssets[asset] = unlockedAssets[asset].add(user.assets[asset]);
    emit AssetUnlocked(asset, account, user.assets[asset]);
  }

  user.kycVerified = true;
  emit KycVerified(account);
}

kycRemoveVerification keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdmin checks for the following:
null
Source Code
function kycRemoveVerification(address account) public onlyAdmin {
  User storage user = users[account];

  require(user.kycVerified, "User not KYC verified");

  address asset;
  for (uint256 i = 0; i < user.assetList.length; i++) {
    asset = user.assetList[i];
    unlockedAssets[asset] = unlockedAssets[asset].sub(user.assets[asset]);
    emit AssetLocked(asset, account, user.assets[asset]);
  }

  user.kycVerified = false;
  emit KycVerificationRemoved(account);
}

refund keyboard_arrow_up

Parameters help

Name Type
asset
address help
to
address help
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function refund(
  address asset,
  address to,
  uint256 value
) public onlyAdminOrAttorney {
  _returnAsset(asset, to, value);
  _assetRefunded(asset, to, value);
}

refundAllAssets keyboard_arrow_up

Parameters help

Name Type
to
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function refundAllAssets(address to) public onlyAdminOrAttorney {
  User storage user = users[to];

  for (uint256 i = 0; i < user.assetList.length; i++) {
    refund(user.assetList[i], to, user.assets[user.assetList[i]]);
  }

  delete user.assetList;
  _decrease(to, user.balance);
}

returnAsset keyboard_arrow_up

Parameters help

Name Type
asset
address help
to
address help
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function returnAsset(
  address asset,
  address to,
  uint256 value
) public onlyAdminOrAttorney {
  _returnAsset(asset, to, value);
  emit AssetReturned(asset, to, value);
}

decrease keyboard_arrow_up

Parameters help

Name Type
account
address help
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function decrease(address account, uint256 value) public onlyAdminOrAttorney {
  _decrease(account, value);
}

getAssetList keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function getAssetList(address account) public view returns (address[]) {
  return users[account].assetList;
}

getAssetAmounts keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function getAssetAmounts(address account) public view returns (uint256[]) {
  User storage user = users[account];
  uint256[] memory totals = new uint256[](user.assetList.length);

  for (uint256 i = 0; i < user.assetList.length; i++) {
    totals[i] = user.assets[user.assetList[i]];
  }

  return totals;
}

getAmount keyboard_arrow_up

Parameters help

Name Type
account
address help
asset
address help

Properties

Visibility help public
Mutability help view
Source Code
function getAmount(address account, address asset)
  public
  view
  returns (uint256)
{
  return users[account].assets[asset];
}

setPrice keyboard_arrow_up

Parameters help

Name Type
newPrice
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrOracle checks for the following:
One or more of the following: -null - ORnull
Source Code
function setPrice(uint256 newPrice) public onlyAdminOrOracle {
  price = newPrice;
  emit PriceSet(price);
}

setTokenPrice keyboard_arrow_up

Parameters help

Name Type
tokenAddress
address help
tokenPrice
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrOracle checks for the following:
One or more of the following: -null - ORnull

Requirements help

Source Code
function setTokenPrice(address tokenAddress, uint256 tokenPrice)
  public
  onlyAdminOrOracle
{
  _setTokenPrice(tokenAddress, tokenPrice);
}

removeToken keyboard_arrow_up

Parameters help

Name Type
tokenAddress
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function removeToken(address tokenAddress) public onlyAdminOrAttorney {
  Token storage token = tokens[tokenAddress];

  require(
    token.price > 0,
    "Token must exist in the contract for it to be removed"
  );
  require(
    tokenList[token.index] == tokenAddress,
    "Token index must match the listed one"
  );

  address replacement = tokenList[tokenList.length - 1];

  if (replacement != tokenAddress) {
    // Move the last element into the slot we're removing
    tokenList[token.index] = replacement;

    tokens[replacement].index = token.index;
  }
  tokenList.length--;
  delete (tokens[tokenAddress]);

  emit TokenPriceRemoved(tokenAddress);
}

getTokenPrice keyboard_arrow_up

Parameters help

Name Type
tokenAddress
address help

Properties

Visibility help public
Mutability help view
Source Code
function getTokenPrice(address tokenAddress) public view returns (uint256) {
  return tokens[tokenAddress].price;
}

getTokenTotal keyboard_arrow_up

Parameters help

Name Type
tokenAddress
address help
value
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getTokenTotal(address tokenAddress, uint256 value)
  public
  view
  returns (uint256)
{
  Token storage token = tokens[tokenAddress];

  return value.div(token.price).mul(10**uint256(decimals));
}

getTokenList keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function getTokenList() public view returns (address[]) {
  return tokenList;
}

getTokenPrices keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function getTokenPrices() public view returns (uint256[]) {
  uint256[] memory prices = new uint256[](tokenList.length);

  for (uint256 i = 0; i < tokenList.length; i++) {
    prices[i] = tokens[tokenList[i]].price;
  }

  return prices;
}

setBwQuill1 keyboard_arrow_up

Parameters help

Name Type
account
address help
value
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrKycAdder checks for the following:
One or more of the following: -null - ORnull
Source Code
function setBwQuill1(address account, string value) public onlyAdminOrKycAdder {
  bwQuill1.setString(account, value);
  emit BwQuillSet(1, account, value);
}

getBwQuill1 keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function getBwQuill1(address account) public view returns (string) {
  return bwQuill1.getString(account);
}

setBwQuill2 keyboard_arrow_up

Parameters help

Name Type
account
address help
value
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function setBwQuill2(address account, string value) public onlyAdminOrAttorney {
  bwQuill2.setString(account, value);
  emit BwQuillSet(2, account, value);
}

getBwQuill2 keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function getBwQuill2(address account) public view returns (string) {
  return bwQuill2.getString(account);
}

setBwQuill3 keyboard_arrow_up

Parameters help

Name Type
account
address help
value
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function setBwQuill3(address account, string value) public onlyAdminOrAttorney {
  bwQuill3.setString(account, value);
  emit BwQuillSet(3, account, value);
}

getBwQuill3 keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function getBwQuill3(address account) public view returns (string) {
  return bwQuill3.getString(account);
}

setBwChalk1 keyboard_arrow_up

Parameters help

Name Type
account
address help
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrKycAdder checks for the following:
One or more of the following: -null - ORnull
Source Code
function setBwChalk1(address account, uint256 value)
  public
  onlyAdminOrKycAdder
{
  bwChalk1.setUint256(account, value);
  emit BwChalkSet(1, account, value);
}

getBwChalk1 keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function getBwChalk1(address account) public view returns (uint256) {
  return bwChalk1.getUint256(account);
}

setBwChalk2 keyboard_arrow_up

Parameters help

Name Type
account
address help
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function setBwChalk2(address account, uint256 value)
  public
  onlyAdminOrAttorney
{
  bwChalk2.setUint256(account, value);
  emit BwChalkSet(2, account, value);
}

getBwChalk2 keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function getBwChalk2(address account) public view returns (uint256) {
  return bwChalk2.getUint256(account);
}

setBwAddress1 keyboard_arrow_up

Parameters help

Name Type
account
address help
value
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrKycAdder checks for the following:
One or more of the following: -null - ORnull
Source Code
function setBwAddress1(address account, address value)
  public
  onlyAdminOrKycAdder
{
  bwAddress1.setAddress(account, value);
  emit BwAddressSet(1, account, value);
}

getBwAddress1 keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function getBwAddress1(address account) public view returns (address) {
  return bwAddress1.getAddress(account);
}

setBwAddress2 keyboard_arrow_up

Parameters help

Name Type
account
address help
value
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull
Source Code
function setBwAddress2(address account, address value)
  public
  onlyAdminOrAttorney
{
  bwAddress2.setAddress(account, value);
  emit BwAddressSet(2, account, value);
}

getBwAddress2 keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function getBwAddress2(address account) public view returns (address) {
  return bwAddress2.getAddress(account);
}

pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function pause() public whenNotPaused {
  bool attorney = isAttorney(msg.sender);
  require(attorney || isAdmin(msg.sender), "Must be an admin or attorney");

  _pause(attorney);
}

unpause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

whenPaused checks for the following:
Source Code
function unpause() public whenPaused {
  if (!isAttorney(msg.sender)) {
    require(isAdmin(msg.sender), "Must be an admin or attorney");
    require(
      !pausedByAttorney(),
      "Only attorneys can unpause after an attorney has paused"
    );
  }
  _unpause();
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function totalSupply() public view returns (uint256) {
  return totalTokenSupply;
}

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function balanceOf(address account) public view returns (uint256) {
  return users[account].balance;
}

availableToWithdraw keyboard_arrow_up

Parameters help

Name Type
asset
address help

Properties

Visibility help public
Mutability help view
Source Code
function availableToWithdraw(address asset) public view returns (uint256) {
  return unlockedAssets[asset].sub(withdrawnAssets[asset]);
}

withdrawTokens keyboard_arrow_up

Parameters help

Name Type
token
Erc20 help
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull

Requirements help

Source Code
function withdrawTokens(Erc20 token, uint256 value) public onlyAdminOrAttorney {
  _withdrawAsset(address(token), value);
  token.transfer(msg.sender, value);
}

withdrawEther keyboard_arrow_up

Parameters help

Name Type
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdminOrAttorney checks for the following:
One or more of the following: -null - ORnull

Requirements help

Source Code
function withdrawEther(uint256 value) public onlyAdminOrAttorney {
  _withdrawAsset(address(0x0), value);
  msg.sender.transfer(value);
}

tokensWithdrawn keyboard_arrow_up

Parameters help

Name Type
token
address help

Properties

Visibility help public
Mutability help view
Source Code
function tokensWithdrawn(address token) public view returns (uint256) {
  return withdrawnAssets[token];
}

etherWithdrawn keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function etherWithdrawn() public view returns (uint256) {
  return withdrawnAssets[address(0x0)];
}

Internal Functions Expand All Collapse All

Internal functions are parts of the contract that can't be used directly, but instead are used by the public functions listed above.

internal Invest.init keyboard_arrow_up

Parameters help

Name Type
sender
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function init(address sender) internal {
  _addAdmin(sender);
}

internal Invest._returnAsset keyboard_arrow_up

Parameters help

Name Type
asset
address help
to
address help
value
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _returnAsset(
  address asset,
  address to,
  uint256 value
) internal {
  if (asset == address(0x0)) {
    to.transfer(value);
  } else {
    Erc20 token = Erc20(asset);
    require(token.transfer(to, value));
  }
}

internal Invest._withdrawAsset keyboard_arrow_up

Parameters help

Name Type
asset
address help
value
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _withdrawAsset(address asset, uint256 value) internal {
  require(
    availableToWithdraw(asset) >= value,
    "Cannot withdraw more than is unlocked"
  );
  withdrawnAssets[asset] = withdrawnAssets[asset].add(value);
  emit Withdraw(asset, msg.sender, value);
}

internal Invest._tokenPayment keyboard_arrow_up

Parameters help

Name Type
from
address help
value
uint256 help
tokenAddress
address help
transactionHash
bytes32 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _tokenPayment(
  address from,
  uint256 value,
  address tokenAddress,
  bytes32 transactionHash
) internal {
  uint256 tokenPrice = getTokenPrice(tokenAddress);
  uint256 give = getTokenTotal(tokenAddress, value);

  emit Payment(tokenAddress, from, value, tokenPrice, transactionHash);
  _increase(from, give, tokenAddress, value);
  _assetPaid(tokenAddress, from, value);
}

internal Invest._assetPaid keyboard_arrow_up

Parameters help

Name Type
asset
address help
account
address help
value
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _assetPaid(
  address asset,
  address account,
  uint256 value
) internal {
  User storage user = users[account];
  // No reason to record the asset if it's 0 value
  if (value > 0) {
    uint256 paid = user.assets[asset];

    if (paid > 0) {
      user.assets[asset] = paid.add(value);
    } else {
      user.assetList.push(asset);
      user.assets[asset] = value;
    }

    if (user.kycVerified) {
      unlockedAssets[asset] = unlockedAssets[asset].add(value);
      emit AssetUnlocked(asset, account, value);
    }
  }
}

internal Invest._assetRefunded keyboard_arrow_up

Parameters help

Name Type
asset
address help
account
address help
value
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _assetRefunded(
  address asset,
  address account,
  uint256 value
) internal {
  User storage user = users[account];
  user.assets[asset] = user.assets[asset].sub(value);

  if (user.kycVerified) {
    unlockedAssets[asset] = unlockedAssets[asset].sub(value);
    emit AssetLocked(asset, account, value);
    require(
      unlockedAssets[asset] >= withdrawnAssets[asset],
      "Cannot refund assets to KYC Verified users without unlocked assets available"
    );
  }

  emit Refund(asset, account, value);
}

internal Invest._setTokenPrice keyboard_arrow_up

Parameters help

Name Type
tokenAddress
address help
tokenPrice
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _setTokenPrice(address tokenAddress, uint256 tokenPrice) internal {
  require(tokenPrice > 0, "Token price must be higher than 0");

  Token storage token = tokens[tokenAddress];
  if (token.price > 0) {
    token.price = tokenPrice;
  } else {
    tokenList.push(tokenAddress);
    token.price = tokenPrice;
    token.index = tokenList.length - 1;
  }
  emit TokenPriceSet(tokenAddress, tokenPrice);
}

internal Invest._increase keyboard_arrow_up

Parameters help

Name Type
account
address help
value
uint256 help
asset
address help
assetValue
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _increase(
  address account,
  uint256 value,
  address asset,
  uint256 assetValue
) internal {
  User storage user = users[account];
  if (limited) {
    remainingSupply = remainingSupply.sub(value);
  } else {
    totalTokenSupply = totalTokenSupply.add(value);
  }
  user.balance = user.balance.add(value);

  emit Increase(account, value, asset, assetValue);
}

internal Invest._decrease keyboard_arrow_up

Parameters help

Name Type
account
address help
value
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _decrease(address account, uint256 value) internal {
  User storage user = users[account];
  user.balance = user.balance.sub(value);

  if (limited) {
    remainingSupply = remainingSupply.add(value);
  } else {
    totalTokenSupply = totalTokenSupply.sub(value);
  }

  emit Decrease(account, value);
}

internal Pausable.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {
  pauseState = PauseState(false, false);
}

internal Pausable._pause keyboard_arrow_up

Parameters help

Name Type
attorney
bool help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _pause(bool attorney) internal {
  pauseState.paused = true;
  pauseState.pausedByAttorney = attorney;
  emit Paused(msg.sender, attorney);
}

internal Pausable._unpause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
function _unpause() internal {
  pauseState.paused = false;
  pauseState.pausedByAttorney = false;
  emit Unpaused(msg.sender);
}

internal UserGroups._addAttorney keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _addAttorney(address account) internal {
  _add(ATTORNEY, account);
}

internal UserGroups._addAdmin keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _addAdmin(address account) internal {
  _add(ADMIN, account);
}

internal UserGroups._add keyboard_arrow_up

Parameters help

Name Type
groupId
uint8 help
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _add(uint8 groupId, address account) internal {
  groups.add(groupId, account);
  emit AddedToGroup(groupId, account);
}

internal UserGroups._remove keyboard_arrow_up

Parameters help

Name Type
groupId
uint8 help
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _remove(uint8 groupId, address account) internal {
  groups.remove(groupId, account);
  emit RemovedFromGroup(groupId, account);
}

internal UserGroups._contains keyboard_arrow_up

Parameters help

Name Type
groupId
uint8 help
account
address help

Properties

Visibility help internal
Mutability help view
Source Code
function _contains(uint8 groupId, address account)
  internal
  view
  returns (bool)
{
  return groups.contains(groupId, account);
}