creation_sourcecode: {"Address.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.6.2;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies in extcodesize, which returns 0 for contracts in\n        // construction, since the code is only stored at the end of the\n        // constructor execution.\n\n        uint256 size;\n        // solhint-disable-next-line no-inline-assembly\n        assembly { size := extcodesize(account) }\n        return size \u003e 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity\u0027s `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance \u003e= amount, \"Address: insufficient balance\");\n\n        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n        (bool success, ) = recipient.call{ value: amount }(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain`call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n      return functionCall(target, data, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n        return _functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n        require(address(this).balance \u003e= value, \"Address: insufficient balance for call\");\n        return _functionCallWithValue(target, data, value, errorMessage);\n    }\n\n    function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\n        require(isContract(target), \"Address: call to non-contract\");\n\n        // solhint-disable-next-line avoid-low-level-calls\n        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\n        if (success) {\n            return returndata;\n        } else {\n            // Look for revert reason and bubble it up if present\n            if (returndata.length \u003e 0) {\n                // The easiest way to bubble the revert reason is using memory via assembly\n\n                // solhint-disable-next-line no-inline-assembly\n                assembly {\n                    let returndata_size := mload(returndata)\n                    revert(add(32, returndata), returndata_size)\n                }\n            } else {\n                revert(errorMessage);\n            }\n        }\n    }\n}\n"},"Context.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.6.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with GSN meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address payable) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes memory) {\n        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n        return msg.data;\n    }\n}\n"},"ERC20.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.6.0;\n\nimport \"./Context.sol\";\nimport \"./IERC20.sol\";\nimport \"./SafeMath.sol\";\nimport \"./Address.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin guidelines: functions revert instead\n * of returning `false` on failure. This behavior is nonetheless conventional\n * and does not conflict with the expectations of ERC20 applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn\u0027t required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20 {\n    using SafeMath for uint256;\n    using Address for address;\n\n    mapping(address =\u003e uint256) private _balances;\n\n    mapping(address =\u003e mapping(address =\u003e uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string internal _name;\n    string internal _symbol;\n    uint8 private _decimals;\n\n    /**\n     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with\n     * a default value of 18.\n     *\n     * To select a different value for {decimals}, use {_setupDecimals}.\n     *\n     * All three of these values are immutable: they can only be set once during\n     * construction.\n     */\n    constructor (string memory name, string memory symbol) public {\n        _name = name;\n        _symbol = symbol;\n        _decimals = 18;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5,05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is\n     * called.\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view returns (uint8) {\n        return _decimals;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view override returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view override returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `recipient` cannot be the zero address.\n     * - the caller must have a balance of at least `amount`.\n     */\n    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n        _transfer(_msgSender(), recipient, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual override returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 amount) public virtual override returns (bool) {\n        _approve(_msgSender(), spender, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Emits an {Approval} event indicating the updated allowance. This is not\n     * required by the EIP. See the note at the beginning of {ERC20};\n     *\n     * Requirements:\n     * - `sender` and `recipient` cannot be the zero address.\n     * - `sender` must have a balance of at least `amount`.\n     * - the caller must have allowance for ``sender``\u0027s tokens of at least\n     * `amount`.\n     */\n    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\n        _transfer(sender, recipient, amount);\n        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \"ERC20: transfer amount exceeds allowance\"));\n        return true;\n    }\n\n    /**\n     * @dev Atomically increases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));\n        return true;\n    }\n\n    /**\n     * @dev Atomically decreases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `spender` must have allowance for the caller of at least\n     * `subtractedValue`.\n     */\n    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, \"ERC20: decreased allowance below zero\"));\n        return true;\n    }\n\n    /**\n     * @dev Moves tokens `amount` from `sender` to `recipient`.\n     *\n     * This is internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * Requirements:\n     *\n     * - `sender` cannot be the zero address.\n     * - `recipient` cannot be the zero address.\n     * - `sender` must have a balance of at least `amount`.\n     */\n    function _transfer(address sender, address recipient, uint256 amount) internal virtual {\n        require(sender != address(0), \"ERC20: transfer from the zero address\");\n        require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n        _beforeTokenTransfer(sender, recipient, amount);\n\n        _balances[sender] = _balances[sender].sub(amount, \"ERC20: transfer amount exceeds balance\");\n        _balances[recipient] = _balances[recipient].add(amount);\n        emit Transfer(sender, recipient, amount);\n    }\n\n    /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n     * the total supply.\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * Requirements\n     *\n     * - `to` cannot be the zero address.\n     */\n    function _mint(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: mint to the zero address\");\n\n        _beforeTokenTransfer(address(0), account, amount);\n\n        _totalSupply = _totalSupply.add(amount);\n        _balances[account] = _balances[account].add(amount);\n        emit Transfer(address(0), account, amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from `account`, reducing the\n     * total supply.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * Requirements\n     *\n     * - `account` cannot be the zero address.\n     * - `account` must have at least `amount` tokens.\n     */\n    function _burn(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: burn from the zero address\");\n\n        _beforeTokenTransfer(account, address(0), amount);\n\n        _balances[account] = _balances[account].sub(amount, \"ERC20: burn amount exceeds balance\");\n        _totalSupply = _totalSupply.sub(amount);\n        emit Transfer(account, address(0), amount);\n    }\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     */\n    function _approve(address owner, address spender, uint256 amount) internal virtual {\n        require(owner != address(0), \"ERC20: approve from the zero address\");\n        require(spender != address(0), \"ERC20: approve to the zero address\");\n\n        _allowances[owner][spender] = amount;\n        emit Approval(owner, spender, amount);\n    }\n\n    /**\n     * @dev Sets {decimals} to a value other than the default one of 18.\n     *\n     * WARNING: This function should only be called from the constructor. Most\n     * applications that interact with token contracts will not expect\n     * {decimals} to ever change, and may work incorrectly if it does.\n     */\n    function _setupDecimals(uint8 decimals_) internal {\n        _decimals = decimals_;\n    }\n\n    /**\n     * @dev Hook that is called before any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``\u0027s tokens\n     * will be to transferred to `to`.\n     * - when `from` is zero, `amount` tokens will be minted for `to`.\n     * - when `to` is zero, `amount` of ``from``\u0027s tokens will be burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n"},"IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.6.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller\u0027s account to `recipient`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address recipient, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller\u0027s tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender\u0027s allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `sender` to `recipient` using the\n     * allowance mechanism. `amount` is then deducted from the caller\u0027s\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n"},"Properties.sol":{"content":"/*\n* SPDX-License-Identifier: UNLICENSED\n* Copyright © 2021 Blocksquare d.o.o.\n*/\n\npragma solidity ^0.6.12;\n\nimport \"./PropToken.sol\";\n\n/// @title Properties\ncontract Properties is PropToken {\n    uint256 private _commonEquity;\n    uint256 private _preferredEquity;\n    uint256 private _mezzanine;\n    uint256 private _juniorDebt;\n    uint256 private _seniorDebt;\n\n    uint16 private _royaltyPercentage;\n\n    modifier onlyPropManagerOrSpecialWallet {\n        require(PropTokenHelpers(getDataAddress()).canEditProperty(_msgSender(), address(this)) || _msgSender() == PropTokenHelpers(getDataAddress()).getSpecialWallet(), \"Properties: You need to be property manager!\");\n        _;\n    }\n\n    event CapitalStackChange(address indexed property, uint256 tokenizationAmount, uint256 commonEquity, uint256 preferredEquity, uint256 mezzanine,\n        uint256 juniorDebt, uint256 seniorDebt);\n\n    constructor(address owner, address propertyRegistry) public PropToken(\"BlocksquarePropertyToken\", \"BSPT\") {\n        transferOwnership(owner);\n        _propertyRegistry = propertyRegistry;\n    }\n\n    /// @notice change royalty percentage\n    /// @param royaltyPercentage Percent for royalties (5% is entered as 500)\n    function addRoyaltyPercentage(uint16 royaltyPercentage) public onlyPropManagerOrSpecialWallet {\n        require(_royaltyPercentage == 0, \"Properties: Royalty percentage already set!\");\n        require(_royaltyPercentage \u003c= 10000, \"Properties: Royalty percentage must be less or equal to 10000\");\n        _royaltyPercentage = royaltyPercentage;\n    }\n\n    /// @notice change capital stack information\n    /// @param cap Max amount of tokens that can be minted\n    /// @param commonEquity Common equity amount\n    /// @param preferredEquity Preferred equity amount\n    /// @param mezzanine Mezzanine amount\n    /// @param juniorDebt Junior debt amount\n    /// @param seniorDebt Senior debt amount\n    function changeCapitalStack(uint256 cap, uint256 commonEquity, uint256 preferredEquity, uint256 mezzanine,\n        uint256 juniorDebt, uint256 seniorDebt) public onlyPropManagerOrSpecialWallet {\n        require(cap.add(commonEquity).add(preferredEquity).add(mezzanine).add(juniorDebt).add(seniorDebt) == 100000 * 1 ether,\n            \"Properties: The sum of the capital stack needs to be same as maximum supply of BSPT\");\n        require(cap \u003e= totalSupply(), \"Properties: Cap needs to be bigger or equal to total supply\");\n        _cap = cap;\n        _commonEquity = commonEquity;\n        _preferredEquity = preferredEquity;\n        _mezzanine = mezzanine;\n        _juniorDebt = juniorDebt;\n        _seniorDebt = seniorDebt;\n        emit CapitalStackChange(address(this), cap, commonEquity, preferredEquity, mezzanine, juniorDebt, seniorDebt);\n    }\n\n    /// @notice can only be called by property registry\n    function changeTokenNameAndSymbol(string memory name, string memory symbol) external {\n        require(msg.sender == _propertyRegistry, \"Properties: Transaction must come from registry!\");\n        _name = name;\n        _symbol = symbol;\n    }\n\n    /// @notice see property registry contract\n    function getProperty(uint64 index) public view returns (string memory propertyType, string memory kadastralMunicipality, string memory parcelNumber, string memory ID, uint64 buildingPart) {\n        return PropTokenHelpers(_propertyRegistry).getPropertyInfo(address(this), index);\n    }\n\n    /// @notice see property registry contract\n    function getBasicInfo() public view returns (string memory streetLocation, string memory geoLocation, uint256 propertyValuation, uint256 tokenValuation, string memory propertyValuationCurrency) {\n        return PropTokenHelpers(_propertyRegistry).getBasicInfo(address(this));\n    }\n\n    /// @notice see property registry contract\n    function getIPFSHash() public view returns (string memory) {\n        return PropTokenHelpers(_propertyRegistry).getIPFS(address(this));\n    }\n\n    /// @notice retrieves current capital stack information\n    function getCapitalStack() public view returns (uint256 tokenization, uint256 commonEquity, uint256 preferredEquity,\n        uint256 mezzanine, uint256 juniorDebt, uint256 seniorDebt) {\n        return (_cap,\n        _commonEquity,\n        _preferredEquity,\n        _mezzanine,\n        _juniorDebt,\n        _seniorDebt);\n    }\n\n    /// @notice retrieves current royalty percent\n    function getRoyaltyPercentage() public view returns (uint16) {\n        return _royaltyPercentage;\n    }\n\n    /// @dev fallback function to prevent any ether to be sent to this contract\n    receive() external payable {\n        revert();\n    }\n}\n"},"PropToken.sol":{"content":"/*\n* SPDX-License-Identifier: UNLICENSED\n* Copyright © 2021 Blocksquare d.o.o.\n*/\n\npragma solidity ^0.6.12;\n\nimport \"./ERC20.sol\";\nimport \"./Context.sol\";\n\ninterface PropTokenHelpers {\n    function freezeProperty(address prop) external;\n\n    function unfreezeProperty(address prop) external;\n\n    function isPropTokenFrozen(address property) external view returns (bool);\n\n    function hasSystemAdminRights(address addr) external view returns (bool);\n\n    function getLicencedIssuerFee() external view returns (uint256);\n\n    function getBlocksquareFee() external view returns (uint256);\n\n    function getCertifiedPartnerFee() external view returns (uint256);\n\n    function getBlocksquareAddress() external view returns (address);\n\n    function getDataProxy() external view returns (address);\n\n    function canTransferPropTokensTo(address wallet, address property) external view returns (bool);\n\n    function isCPAdminOfProperty(address user, address property) external view returns (bool);\n\n    function getCPOfProperty(address prop) external view returns (address);\n\n    function getSpecialWallet() external view returns (address);\n\n    function getBasicInfo(address property) external view returns (string memory streetLocation, string memory geoLocation, uint256 propertyValuation, uint256 tokenValuation, string memory propertyValuationCurrency);\n\n    function getPropertyInfo(address property, uint64 index) external view returns (string memory propertyType, string memory kadastralMunicipality, string memory parcelNumber, string memory ID, uint64 buildingPart);\n\n    function getIPFS(address property) external view returns (string memory);\n\n    function getOceanPointContract() external view returns (address);\n\n    function canEditProperty(address wallet, address property) external view returns (bool);\n\n    function isContractWhitelisted(address cont) external view returns (bool);\n}\n\ncontract Owned is Context {\n    address internal _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    constructor () internal {\n        address msgSender = _msgSender();\n        _owner = msgSender;\n        emit OwnershipTransferred(address(0), msgSender);\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n        _;\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions anymore. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby removing any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        emit OwnershipTransferred(_owner, address(0));\n        _owner = address(0);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        emit OwnershipTransferred(_owner, newOwner);\n        _owner = newOwner;\n    }\n}\n\n/// @title Property Token\ncontract PropToken is ERC20, Owned {\n    using SafeMath for uint256;\n\n    uint256 internal _cap;\n\n    address private _mintContract;\n    address private _burnContract;\n    address internal _propertyRegistry;\n\n    bool private _canMint;\n\n    modifier onlySystemAdmin {\n        require(PropTokenHelpers(getDataAddress()).hasSystemAdminRights(msg.sender), \"PropToken: You need to have system admin rights!\");\n        _;\n    }\n\n    modifier onlyPropManager {\n        require(PropTokenHelpers(getDataAddress()).isCPAdminOfProperty(msg.sender, address(this)) || msg.sender == PropTokenHelpers(getDataAddress()).getCPOfProperty(address(this)),\n            \"PropToken: you don\u0027t have permission!\");\n        _;\n    }\n\n    constructor(string memory name, string memory symbol) internal ERC20(name, symbol) {\n    }\n\n    function changeLI(address newOwner) public onlySystemAdmin {\n        _owner = newOwner;\n    }\n\n    /**\n    * @dev Sends `amount` of token from caller address to `recipient`\n    * @param recipient Address where we are sending to\n    * @param amount Amount of tokens to send\n    * @return bool Returns true if transfer was successful\n    */\n    function transfer(address recipient, uint256 amount) public override returns (bool) {\n        _transferWithFee(msg.sender, recipient, amount);\n        return true;\n    }\n\n    /**\n    * @dev Sends `amount` of token from `sender` to `recipient`\n    * @param sender Address from which we send\n    * @param recipient Address where we are sending to\n    * @param amount Amount of tokens to send\n    * @return bool Returns true if transfer was successful\n    */\n    function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {\n        _approve(sender, msg.sender, allowance(sender, msg.sender).sub(amount, \"ERC20: transfer amount exceeds allowance\"));\n        _transferWithFee(sender, recipient, amount);\n        return true;\n    }\n\n    /// @notice mint tokens for given wallets\n    /// @param accounts Array of wallets\n    /// @param amounts Amount of tokens to mint to each wallet\n    function mint(address[] memory accounts, uint256[] memory amounts) public returns (bool) {\n        require(_canMint, \"PropToken: Minting is not enabled!\");\n        require(PropTokenHelpers(getDataAddress()).isCPAdminOfProperty(msg.sender, address(this)) || _mintContract == msg.sender, \"PropToken: you don\u0027t have permission to mint\");\n        require(accounts.length == amounts.length, \"PropToken: Arrays must be of same length!\");\n        for (uint256 i = 0; i \u003c accounts.length; i++) {\n            require(totalSupply().add(amounts[i]) \u003c= _cap, \"PropToken: cap exceeded\");\n            require(PropTokenHelpers(getDataAddress()).canTransferPropTokensTo(accounts[i], address(this)), \"PropToken: Wallet is not whitelisted\");\n            _mint(accounts[i], amounts[i]);\n        }\n        return true;\n    }\n\n    /// @notice burn and mint at he same time\n    /// @param from Address from which we burn\n    /// @param to Address to which we mint\n    /// @param amount Amount of tokens to burn and mint\n    function burnAndMint(address from, address to, uint256 amount) public onlySystemAdmin returns (bool) {\n        _burn(from, amount);\n        _mint(to, amount);\n        return true;\n    }\n\n    function contractBurn(address user, uint256 amount) public returns (bool) {\n        require(msg.sender == _burnContract, \"PropToken: Only burn contract can burn tokens from users!\");\n        _burn(user, amount);\n        return true;\n    }\n\n    /// @notice You need permission to call this function\n    function freezeToken() public onlyPropManager {\n        PropTokenHelpers(getDataAddress()).freezeProperty(address(this));\n    }\n\n\n    /// @notice You need permission to call this function\n    function unfreezeToken() public onlyPropManager {\n        PropTokenHelpers(getDataAddress()).unfreezeProperty(address(this));\n    }\n\n    /// @notice set contract that is allowed to mint\n    /// @param mintContract Address of contract that is allowed to mint\n    function setMintContract(address mintContract) public onlyPropManager {\n        require(PropTokenHelpers(getDataAddress()).isContractWhitelisted(mintContract), \"PropToken: Contract is not whitelisted\");\n        _mintContract = mintContract;\n    }\n\n    /// @notice set contract that is allowed to burn\n    /// @param burnContract Address of contract that is allowed to burn\n    function setBurnContract(address burnContract) public onlyPropManager {\n        require(PropTokenHelpers(getDataAddress()).isContractWhitelisted(burnContract), \"PropToken: Contract is not whitelisted\");\n        _burnContract = burnContract;\n    }\n\n    /// @notice set this contract into minting mode\n    function allowMint() public {\n        require(PropTokenHelpers(getDataAddress()).isCPAdminOfProperty(msg.sender, address(this)), \"PropToken: Only CP admin!\");\n        _canMint = true;\n    }\n\n    function _transferWithFee(address sender, address recipient, uint256 amount) internal {\n        require(sender != address(0), \"PropToken: transfer from the zero address\");\n        require(recipient != address(0), \"PropToken: transfer to the zero address\");\n        require(!PropTokenHelpers(getDataAddress()).isPropTokenFrozen(address(this)), \"PropToken: Transactions are frozen\");\n        address blocksquare = PropTokenHelpers(getDataAddress()).getBlocksquareAddress();\n        address cp = PropTokenHelpers(getDataAddress()).getCPOfProperty(address(this));\n\n        if (PropTokenHelpers(getDataAddress()).hasSystemAdminRights(sender) || recipient == getOceanPointContract() || recipient == _burnContract) {\n            _transfer(sender, recipient, amount);\n        }\n        else if (recipient == blocksquare || recipient == cp || recipient == owner()) {\n            _transfer(sender, recipient, amount);\n        }\n        else {\n            require(PropTokenHelpers(getDataAddress()).canTransferPropTokensTo(recipient, address(this)), \"PropToken: Can\u0027t send tokens to!\");\n            if (sender == blocksquare || sender == cp || sender == owner()) {\n                _transfer(sender, recipient, amount);\n            }\n            else {\n                _fee(sender, recipient, amount, blocksquare, cp);\n            }\n        }\n    }\n\n    function _fee(address sender, address recipient, uint256 amount, address blocksquare, address cp) private {\n        uint256 blocksquareFee = (amount.mul(PropTokenHelpers(getDataAddress()).getBlocksquareFee())).div(1000);\n        uint256 liFee = (amount.mul(PropTokenHelpers(getDataAddress()).getLicencedIssuerFee())).div(1000);\n        uint256 cpFee = (amount.mul(PropTokenHelpers(getDataAddress()).getCertifiedPartnerFee())).div(1000);\n\n        uint256 together = blocksquareFee.add(liFee).add(cpFee);\n\n        _transfer(sender, blocksquare, blocksquareFee);\n        _transfer(sender, cp, cpFee);\n        _transfer(sender, owner(), liFee);\n\n        _transfer(sender, recipient, amount.sub(together));\n    }\n\n    function getDataAddress() internal view returns (address) {\n        return PropTokenHelpers(_propertyRegistry).getDataProxy();\n    }\n\n    /// @notice gets maximum number of tokens that can be created\n    function cap() public view returns (uint256) {\n        return _cap;\n    }\n\n    /// @notice check if this property can be minted\n    function canBeMinted() public view returns (bool) {\n        return _canMint;\n    }\n\n    /// @notice retrieves address of contract that is allowed to mint\n    function getMintContract() public view returns (address) {\n        return _mintContract;\n    }\n\n    /// @notice retrieves address of contract that is allowed to burn\n    function getBurnContract() public view returns (address) {\n        return _burnContract;\n    }\n\n    /// @notice retrieves ocean point contract address\n    function getOceanPointContract() public view returns (address) {\n        return PropTokenHelpers(getDataAddress()).getOceanPointContract();\n    }\n}\n"},"SafeMath.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.6.0;\n\n/**\n * @dev Wrappers over Solidity\u0027s arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it\u0027s recommended to use it always.\n */\nlibrary SafeMath {\n    /**\n     * @dev Returns the addition of two unsigned integers, reverting on\n     * overflow.\n     *\n     * Counterpart to Solidity\u0027s `+` operator.\n     *\n     * Requirements:\n     *\n     * - Addition cannot overflow.\n     */\n    function add(uint256 a, uint256 b) internal pure returns (uint256) {\n        uint256 c = a + b;\n        require(c \u003e= a, \"SafeMath: addition overflow\");\n\n        return c;\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, reverting on\n     * overflow (when the result is negative).\n     *\n     * Counterpart to Solidity\u0027s `-` operator.\n     *\n     * Requirements:\n     *\n     * - Subtraction cannot overflow.\n     */\n    function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n        return sub(a, b, \"SafeMath: subtraction overflow\");\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n     * overflow (when the result is negative).\n     *\n     * Counterpart to Solidity\u0027s `-` operator.\n     *\n     * Requirements:\n     *\n     * - Subtraction cannot overflow.\n     */\n    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        require(b \u003c= a, errorMessage);\n        uint256 c = a - b;\n\n        return c;\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, reverting on\n     * overflow.\n     *\n     * Counterpart to Solidity\u0027s `*` operator.\n     *\n     * Requirements:\n     *\n     * - Multiplication cannot overflow.\n     */\n    function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n        // Gas optimization: this is cheaper than requiring \u0027a\u0027 not being zero, but the\n        // benefit is lost if \u0027b\u0027 is also tested.\n        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n        if (a == 0) {\n            return 0;\n        }\n\n        uint256 c = a * b;\n        require(c / a == b, \"SafeMath: multiplication overflow\");\n\n        return c;\n    }\n\n    /**\n     * @dev Returns the integer division of two unsigned integers. Reverts on\n     * division by zero. The result is rounded towards zero.\n     *\n     * Counterpart to Solidity\u0027s `/` operator. Note: this function uses a\n     * `revert` opcode (which leaves remaining gas untouched) while Solidity\n     * uses an invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function div(uint256 a, uint256 b) internal pure returns (uint256) {\n        return div(a, b, \"SafeMath: division by zero\");\n    }\n\n    /**\n     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\n     * division by zero. The result is rounded towards zero.\n     *\n     * Counterpart to Solidity\u0027s `/` operator. Note: this function uses a\n     * `revert` opcode (which leaves remaining gas untouched) while Solidity\n     * uses an invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        require(b \u003e 0, errorMessage);\n        uint256 c = a / b;\n        // assert(a == b * c + a % b); // There is no case in which this doesn\u0027t hold\n\n        return c;\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n     * Reverts when dividing by zero.\n     *\n     * Counterpart to Solidity\u0027s `%` operator. This function uses a `revert`\n     * opcode (which leaves remaining gas untouched) while Solidity uses an\n     * invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n        return mod(a, b, \"SafeMath: modulo by zero\");\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n     * Reverts with custom message when dividing by zero.\n     *\n     * Counterpart to Solidity\u0027s `%` operator. This function uses a `revert`\n     * opcode (which leaves remaining gas untouched) while Solidity uses an\n     * invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        require(b != 0, errorMessage);\n        return a % b;\n    }\n}\n"}}