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.

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 Event

Members
index
uint help
price
uint256 help

User Event

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

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();
    }

totalSupply keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

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

balanceOf keyboard_arrow_up

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)];
    }