Contract 0x345518162D4afd5bdcF73EE8175e2dBD6bcE98a0

 
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x399bf72cd1b89eb9189b618e9d37ac42192c7115c4df511c6b15be180fcaf6100x6080604097356632021-08-04 7:46:4582 days 2 hrs agoInsurAce Protocol: Deployer IN  Contract Creation0 BNB0.012052446
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RewardController

Compiler Version
v0.7.3+commit.9bfce1f6

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 17 : RewardController.sol
/*
    Copyright (C) 2020 InsurAce.io

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see http://www.gnu.org/licenses/
*/

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.7.3;

import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";

import {ISecurityMatrix} from "../secmatrix/ISecurityMatrix.sol";
import {IStakingV2Controller} from "../stakingV2/IStakingV2Controller.sol";
import {ICover} from "../cover/ICover.sol";
import {IClaim} from "../claim/IClaim.sol";
import {IReferralProgram} from "../referral/IReferralProgram.sol";
import {Math} from "../common/Math.sol";
import {IRewardController} from "./IRewardController.sol";

contract RewardController is IRewardController, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable {
    using SafeERC20Upgradeable for IERC20Upgradeable;
    using SafeMathUpgradeable for uint256;
    using AddressUpgradeable for address;

    // the security matrix address
    address public smx;
    // the INSUR token address
    address public insur;
    // the cover address
    address public cover;
    // the claim address
    address public claim;
    // the staking V2 controller address
    address public stakingController;
    // vesting duration
    uint256 public vestingDuration;
    mapping(address => uint256) public vestingVestingAmountPerAccount;
    mapping(address => uint256) public vestingStartBlockPerAccount;
    mapping(address => uint256) public vestingEndBlockPerAccount;
    mapping(address => uint256) public vestingWithdrawableAmountPerAccount;
    mapping(address => uint256) public vestingWithdrawedAmountPerAccount;

    // the referral program address
    address public referralProgram;

    function initialize() public initializer {
        __Ownable_init();
        __Pausable_init();
        __ReentrancyGuard_init();
    }

    function setup(
        address _securityMatrixAddress,
        address _coverAddress,
        address _claimAddress,
        address _referralProgram,
        address _stakingControllerAddress,
        address _insur
    ) external onlyOwner {
        require(_securityMatrixAddress != address(0), "S:1");
        require(_coverAddress != address(0), "S:2");
        require(_claimAddress != address(0), "S:3");
        require(_referralProgram != address(0), "S:4");
        require(_stakingControllerAddress != address(0), "S:5");
        require(_insur != address(0), "S:6");
        smx = _securityMatrixAddress;
        cover = _coverAddress;
        claim = _claimAddress;
        referralProgram = _referralProgram;
        stakingController = _stakingControllerAddress;
        insur = _insur;
        vestingDuration = 1;
    }

    function setupVesting(uint256 _vestingDuration) external onlyOwner {
        vestingDuration = _vestingDuration;
    }

    function pauseAll() external onlyOwner whenNotPaused {
        _pause();
    }

    function unPauseAll() external onlyOwner whenPaused {
        _unpause();
    }

    modifier allowedCaller() {
        require((ISecurityMatrix(smx).isAllowdCaller(address(this), _msgSender())) || (_msgSender() == owner()), "allowedCaller");
        _;
    }

    function _reClacVesting(address _account, uint256 _amount) private {
        require(_amount != 0, "_reClacVesting:1");
        uint256 currentBlock = block.number;
        if (currentBlock >= vestingEndBlockPerAccount[_account]) {
            vestingWithdrawableAmountPerAccount[_account] = vestingWithdrawableAmountPerAccount[_account].add(vestingVestingAmountPerAccount[_account]);
            vestingVestingAmountPerAccount[_account] = _amount;
            vestingStartBlockPerAccount[_account] = currentBlock;
            vestingEndBlockPerAccount[_account] = vestingDuration.add(currentBlock);
        } else if (currentBlock < vestingEndBlockPerAccount[_account] && currentBlock > vestingStartBlockPerAccount[_account]) {
            uint256 delta = currentBlock.sub(vestingStartBlockPerAccount[_account]);
            uint256 duration = vestingEndBlockPerAccount[_account].sub(vestingStartBlockPerAccount[_account]);
            uint256 tempWithdraw = vestingVestingAmountPerAccount[_account].mul(delta).div(duration);
            uint256 remaining = vestingVestingAmountPerAccount[_account].sub(tempWithdraw);
            vestingVestingAmountPerAccount[_account] = remaining.add(_amount);
            vestingStartBlockPerAccount[_account] = currentBlock;
            vestingWithdrawableAmountPerAccount[_account] = tempWithdraw.add(vestingWithdrawableAmountPerAccount[_account]);
            vestingEndBlockPerAccount[_account] = vestingDuration.add(currentBlock);
        } else {
            vestingVestingAmountPerAccount[_account] = _amount.add(vestingVestingAmountPerAccount[_account]);
        }
    }

    function unlockReward(
        address[] memory _tokenList,
        bool _bBuyCoverUnlockedAmt,
        bool _bClaimUnlockedAmt,
        bool _bReferralUnlockedAmt
    ) external whenNotPaused nonReentrant {
        uint256 buyCoverUnlockedAmt = 0;
        if (_bBuyCoverUnlockedAmt) {
            buyCoverUnlockedAmt = ICover(cover).unlockRewardByController(_msgSender(), address(this));
        }
        uint256 claimUnlockedAmt = 0;
        if (_bClaimUnlockedAmt) {
            claimUnlockedAmt = IClaim(claim).unlockRewardByController(_msgSender(), address(this));
        }
        uint256 referralUnlockedAmt = 0;
        if (_bReferralUnlockedAmt) {
            referralUnlockedAmt = IReferralProgram(referralProgram).unlockRewardByController(_msgSender(), address(this));
        }
        uint256 stakingUnlockedAmt = 0;
        if (_tokenList.length != 0) {
            stakingUnlockedAmt = IStakingV2Controller(stakingController).unlockRewardsFromPoolsByController(_msgSender(), address(this), _tokenList);
        }
        uint256 totalRewards = buyCoverUnlockedAmt.add(claimUnlockedAmt).add(referralUnlockedAmt).add(stakingUnlockedAmt);
        require(totalRewards != 0, "unlockReward:1");
        _reClacVesting(_msgSender(), totalRewards);
    }

    function getRewardInfo() public view returns (uint256, uint256) {
        address beneficiary = _msgSender();
        uint256 currentBlock = block.number;
        uint256 withdrawableReward = 0;
        uint256 vestingReward = 0;
        if (currentBlock >= vestingEndBlockPerAccount[beneficiary]) {
            withdrawableReward = vestingVestingAmountPerAccount[beneficiary];
            vestingReward = 0;
        } else if (currentBlock < vestingEndBlockPerAccount[beneficiary] && currentBlock > vestingStartBlockPerAccount[beneficiary]) {
            uint256 delta = currentBlock.sub(vestingStartBlockPerAccount[beneficiary]);
            uint256 duration = vestingEndBlockPerAccount[beneficiary].sub(vestingStartBlockPerAccount[beneficiary]);
            uint256 tempWithdraw = vestingVestingAmountPerAccount[beneficiary].mul(delta).div(duration);
            uint256 remaining = vestingVestingAmountPerAccount[beneficiary].sub(tempWithdraw);
            withdrawableReward = tempWithdraw;
            vestingReward = remaining;
        } else {
            withdrawableReward = 0;
            vestingReward = vestingVestingAmountPerAccount[beneficiary];
        }
        return (withdrawableReward.add(vestingWithdrawableAmountPerAccount[beneficiary]), vestingReward);
    }

    function withdrawReward(uint256 _amount) external whenNotPaused nonReentrant {
        require(_amount > 0, "withdrawR:1");
        address beneficiary = _msgSender();
        uint256 currentBlock = block.number;
        if (currentBlock >= vestingEndBlockPerAccount[beneficiary]) {
            vestingWithdrawableAmountPerAccount[beneficiary] = vestingWithdrawableAmountPerAccount[beneficiary].add(vestingVestingAmountPerAccount[beneficiary]);
            vestingVestingAmountPerAccount[beneficiary] = 0;
            vestingStartBlockPerAccount[beneficiary] = 0;
            vestingEndBlockPerAccount[beneficiary] = 0;
        } else if (currentBlock < vestingEndBlockPerAccount[beneficiary] && currentBlock > vestingStartBlockPerAccount[beneficiary]) {
            uint256 delta = currentBlock.sub(vestingStartBlockPerAccount[beneficiary]);
            uint256 duration = vestingEndBlockPerAccount[beneficiary].sub(vestingStartBlockPerAccount[beneficiary]);
            uint256 tempWithdraw = vestingVestingAmountPerAccount[beneficiary].mul(delta).div(duration);
            uint256 remaining = vestingVestingAmountPerAccount[beneficiary].sub(tempWithdraw);
            vestingVestingAmountPerAccount[beneficiary] = remaining;
            vestingStartBlockPerAccount[beneficiary] = currentBlock;
            vestingWithdrawableAmountPerAccount[beneficiary] = tempWithdraw.add(vestingWithdrawableAmountPerAccount[beneficiary]);
        }
        require(_amount <= vestingWithdrawableAmountPerAccount[beneficiary], "withdrawR:2");
        vestingWithdrawableAmountPerAccount[beneficiary] = vestingWithdrawableAmountPerAccount[beneficiary].sub(_amount);
        vestingWithdrawedAmountPerAccount[beneficiary] = vestingWithdrawedAmountPerAccount[beneficiary].add(_amount);
        IERC20Upgradeable(insur).safeTransfer(beneficiary, _amount);
    }
}

File 2 of 17 : SafeMathUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMathUpgradeable {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

File 3 of 17 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/Initializable.sol";
/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal initializer {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal initializer {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
    uint256[49] private __gap;
}

File 4 of 17 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./ContextUpgradeable.sol";
import "../proxy/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal initializer {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal initializer {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
    uint256[49] private __gap;
}

File 5 of 17 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;
import "../proxy/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    function __ReentrancyGuard_init() internal initializer {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal initializer {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
    uint256[49] private __gap;
}

File 6 of 17 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 7 of 17 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20Upgradeable.sol";
import "../../math/SafeMathUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20Upgradeable {
    using SafeMathUpgradeable for uint256;
    using AddressUpgradeable for address;

    function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 8 of 17 : ISecurityMatrix.sol
/*
    Copyright (C) 2020 InsurAce.io

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see http://www.gnu.org/licenses/
*/

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.7.3;

interface ISecurityMatrix {
    function isAllowdCaller(address _callee, address _caller) external view returns (bool);
}

File 9 of 17 : IStakingV2Controller.sol
/*
    Copyright (C) 2020 InsurAce.io

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see http://www.gnu.org/licenses/
*/

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.7.3;

interface IStakingV2Controller {
    function stakeTokens(uint256 _amount, address _token) external payable;

    function proposeUnstake(uint256 _amount, address _token) external;

    function withdrawTokens(uint256 _amount, address _token) external;

    function unlockRewardsFromPoolsByController(
        address staker,
        address _to,
        address[] memory _tokenList
    ) external returns (uint256);

    function showRewardsFromPools(address[] memory _tokenList) external view returns (uint256);
}

File 10 of 17 : ICover.sol
/*
    Copyright (C) 2020 InsurAce.io

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see http://www.gnu.org/licenses/
*/

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.7.3;

interface ICover {
    function getPremium(
        uint256[] memory products,
        uint256[] memory durationInDays,
        uint256[] memory amounts,
        address currency,
        address owner,
        uint256 referralCode,
        uint256[] memory rewardPercentages
    )
        external
        view
        returns (
            uint256,
            uint256[] memory,
            uint256,
            uint256[] memory
        );

    function buyCover(
        uint16[] memory products,
        uint16[] memory durationInDays,
        uint256[] memory amounts,
        address currency,
        address owner,
        uint256 referralCode,
        uint256 premiumAmount,
        uint256[] memory helperParameters,
        uint256[] memory securityParameters,
        uint8[] memory v,
        bytes32[] memory r,
        bytes32[] memory s
    ) external payable;

    function unlockRewardByController(address owner, address to) external returns (uint256);

    function getRewardAmount() external view returns (uint256);

    function getCoverOwnerRewardAmount(uint256 premiumAmount2Insur, uint256 overwrittenRewardPctg) external view returns (uint256, uint256);

    function getINSURRewardBalanceDetails() external view returns (uint256, uint256);

    function removeINSURRewardBalance(address toAddress, uint256 amount) external;

    function setBuyCoverMaxBlkNumLatency(uint256 numOfBlocks) external;

    function setBuyCoverSigner(address signer, bool enabled) external;
}

File 11 of 17 : IClaim.sol
/*
    Copyright (C) 2020 InsurAce.io

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see http://www.gnu.org/licenses/
*/

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.7.3;

interface IClaim {
    function getClaimFeeAmount(uint256 claimAmount) external view returns (uint256);

    function getAdjustedClaimStatus(uint256 claimId) external view returns (uint256);

    function getClaimDetails(uint256 claimId)
        external
        view
        returns (
            uint256,
            address,
            uint256,
            uint256,
            uint256,
            string memory,
            uint256
        );

    function claim(
        uint256 coverId,
        uint256 lossAmount,
        uint256 lossEventTime,
        uint256 claimAmount,
        string memory otherClaimInfo
    ) external payable;

    function deposit(address currency, uint256 amount) external payable;

    function withdrawPayout(address currency, uint256 amount) external;

    function unlockRewardByController(address assessor, address to) external returns (uint256);

    function getRewardAmount() external view returns (uint256);
}

File 12 of 17 : IReferralProgram.sol
/*
    Copyright (C) 2020 InsurAce.io

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see http://www.gnu.org/licenses/
*/

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.7.3;

interface IReferralProgram {
    function getReferralINSURRewardPctg(uint256 rewardType) external view returns (uint256);

    function setReferralINSURRewardPctg(uint256 rewardType, uint256 percent) external;

    function getReferralINSURRewardAmount() external view returns (uint256);

    function getTotalReferralINSURRewardAmount() external view returns (uint256);

    function getRewardPctg(uint256 rewardType, uint256 overwrittenRewardPctg) external view returns (uint256);

    function getRewardAmount(
        uint256 rewardType,
        uint256 baseAmount,
        uint256 overwrittenRewardPctg
    ) external view returns (uint256);

    function processReferralReward(
        address referrer,
        address referee,
        uint256 rewardType,
        uint256 baseAmount,
        uint256 rewardPctg
    ) external;

    function unlockRewardByController(address referrer, address to) external returns (uint256);

    function getINSURRewardBalanceDetails() external view returns (uint256, uint256);

    function removeINSURRewardBalance(address toAddress, uint256 amount) external;
}

File 13 of 17 : Math.sol
/*
    Copyright (C) 2020 InsurAce.io

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see http://www.gnu.org/licenses/
*/

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.7.3;

import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";

// a library for performing various math operations
library Math {
    using SafeMathUpgradeable for uint256;

    function max(uint256 x, uint256 y) internal pure returns (uint256) {
        return x < y ? y : x;
    }

    function min(uint256 x, uint256 y) internal pure returns (uint256) {
        return x < y ? x : y;
    }

    // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
    function sqrt(uint256 y) internal pure returns (uint256 z) {
        if (y > 3) {
            z = y;
            uint256 x = y.div(2).add(1);
            while (x < z) {
                z = x;
                x = (y.div(x).add(x)).div(2);
            }
        } else if (y != 0) {
            z = 1;
        }
    }

    // power private function
    function pow(uint256 _base, uint256 _exponent) internal pure returns (uint256) {
        if (_exponent == 0) {
            return 1;
        } else if (_exponent == 1) {
            return _base;
        } else if (_base == 0 && _exponent != 0) {
            return 0;
        } else {
            uint256 z = _base;
            for (uint256 i = 1; i < _exponent; i++) {
                z = z.mul(_base);
            }
            return z;
        }
    }
}

File 14 of 17 : IRewardController.sol
/*
    Copyright (C) 2020 InsurAce.io

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see http://www.gnu.org/licenses/
*/

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.7.3;

// solhint-disable-next-line no-empty-blocks
interface IRewardController {

}

File 15 of 17 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;
import "../proxy/Initializable.sol";

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal initializer {
        __Context_init_unchained();
    }

    function __Context_init_unchained() internal initializer {
    }
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
    uint256[50] private __gap;
}

File 16 of 17 : Initializable.sol
// SPDX-License-Identifier: MIT

// solhint-disable-next-line compiler-version
pragma solidity >=0.4.24 <0.8.0;

import "../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {

    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /// @dev Returns true if and only if the function is running in the constructor
    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 17 of 17 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain`call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"claim","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cover","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"insur","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"referralProgram","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_securityMatrixAddress","type":"address"},{"internalType":"address","name":"_coverAddress","type":"address"},{"internalType":"address","name":"_claimAddress","type":"address"},{"internalType":"address","name":"_referralProgram","type":"address"},{"internalType":"address","name":"_stakingControllerAddress","type":"address"},{"internalType":"address","name":"_insur","type":"address"}],"name":"setup","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_vestingDuration","type":"uint256"}],"name":"setupVesting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"smx","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingController","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unPauseAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokenList","type":"address[]"},{"internalType":"bool","name":"_bBuyCoverUnlockedAmt","type":"bool"},{"internalType":"bool","name":"_bClaimUnlockedAmt","type":"bool"},{"internalType":"bool","name":"_bReferralUnlockedAmt","type":"bool"}],"name":"unlockReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vestingDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"vestingEndBlockPerAccount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"vestingStartBlockPerAccount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"vestingVestingAmountPerAccount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"vestingWithdrawableAmountPerAccount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"vestingWithdrawedAmountPerAccount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawReward","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50612360806100206000396000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c8063713e6a09116100c3578063a64fb0a61161007c578063a64fb0a6146103de578063cdc42344146103e6578063e655fcc0146103ee578063e7d931e414610414578063f2fde38b1461041c578063ffe6e7d71461044257610158565b8063713e6a091461034a578063715018a6146103525780637b96f6111461035a5780638129fc1c146103805780638da5cb5b14610388578063a299e6441461039057610158565b806352588197116101155780635258819714610205578063595c6a671461022b5780635c975abb146102335780636067a8a51461024f578063699c8f33146102755780636a69d93f1461029657610158565b8063071143af1461015d57806307c97ffb146101955780631514617e1461019f5780633dd4160e146101a75780634e71d92d146101c4578063523a3f08146101e8575b600080fd5b6101836004803603602081101561017357600080fd5b50356001600160a01b031661044a565b60408051918252519081900360200190f35b61019d61045c565b005b610183610518565b61019d600480360360208110156101bd57600080fd5b503561051e565b6101cc610585565b604080516001600160a01b039092168252519081900360200190f35b61019d600480360360208110156101fe57600080fd5b5035610594565b6101836004803603602081101561021b57600080fd5b50356001600160a01b031661094c565b61019d61095e565b61023b610a15565b604080519115158252519081900360200190f35b6101836004803603602081101561026557600080fd5b50356001600160a01b0316610a1e565b61027d610a30565b6040805192835260208301919091528051918290030190f35b61019d600480360360808110156102ac57600080fd5b8101906020810181356401000000008111156102c757600080fd5b8201836020820111156102d957600080fd5b803590602001918460208302840111640100000000831117156102fb57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505050508035151591506020810135151590604001351515610bcb565b6101cc610fbc565b61019d610fcb565b6101836004803603602081101561037057600080fd5b50356001600160a01b0316611077565b61019d611089565b6101cc611143565b61019d600480360360c08110156103a657600080fd5b506001600160a01b038135811691602081013582169160408201358116916060810135821691608082013581169160a0013516611152565b6101cc6113ae565b6101cc6113bd565b6101836004803603602081101561040457600080fd5b50356001600160a01b03166113cc565b6101cc6113de565b61019d6004803603602081101561043257600080fd5b50356001600160a01b03166113ed565b6101cc6114f0565b60cf6020526000908152604090205481565b6104646114ff565b6001600160a01b0316610475611143565b6001600160a01b0316146104be576040805162461bcd60e51b815260206004820181905260248201526000805160206122e1833981519152604482015290519081900360640190fd5b6104c6610a15565b61050e576040805162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015290519081900360640190fd5b610516611503565b565b60ce5481565b6105266114ff565b6001600160a01b0316610537611143565b6001600160a01b031614610580576040805162461bcd60e51b815260206004820181905260248201526000805160206122e1833981519152604482015290519081900360640190fd5b60ce55565b60cc546001600160a01b031681565b61059c610a15565b156105e1576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b60026097541415610639576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026097558061067e576040805162461bcd60e51b815260206004820152600b60248201526a7769746864726177523a3160a81b604482015290519081900360640190fd5b60006106886114ff565b6001600160a01b038116600090815260d160205260409020549091504390811061071a576001600160a01b038216600090815260cf602090815260408083205460d2909252909120546106da916115a3565b6001600160a01b038316600090815260d2602090815260408083209390935560cf815282822082905560d0815282822082905560d1905290812055610869565b6001600160a01b038216600090815260d160205260409020548110801561075857506001600160a01b038216600090815260d0602052604090205481115b15610869576001600160a01b038216600090815260d06020526040812054610781908390611606565b6001600160a01b038416600090815260d0602090815260408083205460d190925282205492935090916107b391611606565b6001600160a01b038516600090815260cf6020526040812054919250906107e69083906107e09086611663565b906116bc565b6001600160a01b038616600090815260cf60205260408120549192509061080d9083611606565b6001600160a01b038716600090815260cf6020908152604080832084905560d0825280832089905560d290915290205490915061084b9083906115a3565b6001600160a01b038716600090815260d26020526040902055505050505b6001600160a01b038216600090815260d260205260409020548311156108c4576040805162461bcd60e51b815260206004820152600b60248201526a3bb4ba34323930bba91d1960a91b604482015290519081900360640190fd5b6001600160a01b038216600090815260d260205260409020546108e79084611606565b6001600160a01b038316600090815260d2602090815260408083209390935560d39052205461091690846115a3565b6001600160a01b03808416600090815260d3602052604090209190915560ca5461094291168385611723565b5050600160975550565b60d16020526000908152604090205481565b6109666114ff565b6001600160a01b0316610977611143565b6001600160a01b0316146109c0576040805162461bcd60e51b815260206004820181905260248201526000805160206122e1833981519152604482015290519081900360640190fd5b6109c8610a15565b15610a0d576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b61051661177a565b60655460ff1690565b60d26020526000908152604090205481565b6000806000610a3d6114ff565b6001600160a01b038116600090815260d16020526040812054919250439181908310610a845750506001600160a01b038216600090815260cf602052604081205490610b9c565b6001600160a01b038416600090815260d1602052604090205483108015610ac257506001600160a01b038416600090815260d0602052604090205483115b15610b80576001600160a01b038416600090815260d06020526040812054610aeb908590611606565b6001600160a01b038616600090815260d0602090815260408083205460d19092528220549293509091610b1d91611606565b6001600160a01b038716600090815260cf602052604081205491925090610b4a9083906107e09086611663565b6001600160a01b038816600090815260cf602052604081205491925090610b719083611606565b919550909350610b9c92505050565b50506001600160a01b038216600090815260cf60205260408120545b6001600160a01b038416600090815260d26020526040902054610bc09083906115a3565b955093505050509091565b610bd3610a15565b15610c18576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b60026097541415610c70576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260975560008315610d155760cb546001600160a01b0316630b0b9311610c966114ff565b306040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b0316815260200192505050602060405180830381600087803b158015610ce657600080fd5b505af1158015610cfa573d6000803e3d6000fd5b505050506040513d6020811015610d1057600080fd5b505190505b60008315610db55760cc546001600160a01b0316630b0b9311610d366114ff565b306040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b0316815260200192505050602060405180830381600087803b158015610d8657600080fd5b505af1158015610d9a573d6000803e3d6000fd5b505050506040513d6020811015610db057600080fd5b505190505b60008315610e555760d4546001600160a01b0316630b0b9311610dd66114ff565b306040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b0316815260200192505050602060405180830381600087803b158015610e2657600080fd5b505af1158015610e3a573d6000803e3d6000fd5b505050506040513d6020811015610e5057600080fd5b505190505b60008751600014610f3e5760cd546001600160a01b031663d5c71c37610e796114ff565b308b6040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b0316815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015610ee8578181015183820152602001610ed0565b50505050905001945050505050602060405180830381600087803b158015610f0f57600080fd5b505af1158015610f23573d6000803e3d6000fd5b505050506040513d6020811015610f3957600080fd5b505190505b6000610f5682610f50858189896115a3565b906115a3565b905080610f9b576040805162461bcd60e51b815260206004820152600e60248201526d756e6c6f636b5265776172643a3160901b604482015290519081900360640190fd5b610fac610fa66114ff565b826117fd565b5050600160975550505050505050565b60cd546001600160a01b031681565b610fd36114ff565b6001600160a01b0316610fe4611143565b6001600160a01b03161461102d576040805162461bcd60e51b815260206004820181905260248201526000805160206122e1833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380546001600160a01b0319169055565b60d06020526000908152604090205481565b600054610100900460ff16806110a257506110a2611aab565b806110b0575060005460ff16155b6110eb5760405162461bcd60e51b815260040180806020018281038252602e815260200180612292602e913960400191505060405180910390fd5b600054610100900460ff16158015611116576000805460ff1961ff0019909116610100171660011790555b61111e611abc565b611126611b59565b61112e611bf6565b8015611140576000805461ff00191690555b50565b6033546001600160a01b031690565b61115a6114ff565b6001600160a01b031661116b611143565b6001600160a01b0316146111b4576040805162461bcd60e51b815260206004820181905260248201526000805160206122e1833981519152604482015290519081900360640190fd5b6001600160a01b0386166111f5576040805162461bcd60e51b8152602060048201526003602482015262533a3160e81b604482015290519081900360640190fd5b6001600160a01b038516611236576040805162461bcd60e51b8152602060048201526003602482015262299d1960e91b604482015290519081900360640190fd5b6001600160a01b038416611277576040805162461bcd60e51b8152602060048201526003602482015262533a3360e81b604482015290519081900360640190fd5b6001600160a01b0383166112b8576040805162461bcd60e51b815260206004820152600360248201526214ce8d60ea1b604482015290519081900360640190fd5b6001600160a01b0382166112f9576040805162461bcd60e51b8152602060048201526003602482015262533a3560e81b604482015290519081900360640190fd5b6001600160a01b03811661133a576040805162461bcd60e51b8152602060048201526003602482015262299d1b60e91b604482015290519081900360640190fd5b60c980546001600160a01b03199081166001600160a01b039889161790915560cb805482169688169690961790955560cc805486169487169490941790935560d4805485169286169290921790915560cd8054841691851691909117905560ca80549092169216919091179055600160ce55565b60ca546001600160a01b031681565b60d4546001600160a01b031681565b60d36020526000908152604090205481565b60cb546001600160a01b031681565b6113f56114ff565b6001600160a01b0316611406611143565b6001600160a01b03161461144f576040805162461bcd60e51b815260206004820181905260248201526000805160206122e1833981519152604482015290519081900360640190fd5b6001600160a01b0381166114945760405162461bcd60e51b81526004018080602001828103825260268152602001806122466026913960400191505060405180910390fd5b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380546001600160a01b0319166001600160a01b0392909216919091179055565b60c9546001600160a01b031681565b3390565b61150b610a15565b611553576040805162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015290519081900360640190fd5b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6115866114ff565b604080516001600160a01b039092168252519081900360200190a1565b6000828201838110156115fd576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b60008282111561165d576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008261167257506000611600565b8282028284828161167f57fe5b04146115fd5760405162461bcd60e51b81526004018080602001828103825260218152602001806122c06021913960400191505060405180910390fd5b6000808211611712576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161171b57fe5b049392505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611775908490611c8b565b505050565b611782610a15565b156117c7576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586115866114ff565b80611842576040805162461bcd60e51b815260206004820152601060248201526f5f7265436c616356657374696e673a3160801b604482015290519081900360640190fd5b6001600160a01b038216600090815260d16020526040902054439081106118ed576001600160a01b038316600090815260cf602090815260408083205460d290925290912054611891916115a3565b6001600160a01b038416600090815260d2602090815260408083209390935560cf815282822085905560d090522081905560ce546118cf90826115a3565b6001600160a01b038416600090815260d16020526040902055611775565b6001600160a01b038316600090815260d160205260409020548110801561192b57506001600160a01b038316600090815260d0602052604090205481115b15611a69576001600160a01b038316600090815260d06020526040812054611954908390611606565b6001600160a01b038516600090815260d0602090815260408083205460d1909252822054929350909161198691611606565b6001600160a01b038616600090815260cf6020526040812054919250906119b39083906107e09086611663565b6001600160a01b038716600090815260cf6020526040812054919250906119da9083611606565b90506119e681876115a3565b6001600160a01b038816600090815260cf602090815260408083209390935560d0815282822088905560d290522054611a209083906115a3565b6001600160a01b038816600090815260d2602052604090205560ce54611a4690866115a3565b6001600160a01b038816600090815260d160205260409020555061177592505050565b6001600160a01b038316600090815260cf6020526040902054611a8d9083906115a3565b6001600160a01b038416600090815260cf6020526040902055505050565b6000611ab630611d3c565b15905090565b600054610100900460ff1680611ad55750611ad5611aab565b80611ae3575060005460ff16155b611b1e5760405162461bcd60e51b815260040180806020018281038252602e815260200180612292602e913960400191505060405180910390fd5b600054610100900460ff16158015611b49576000805460ff1961ff0019909116610100171660011790555b611b51611d42565b61112e611de2565b600054610100900460ff1680611b725750611b72611aab565b80611b80575060005460ff16155b611bbb5760405162461bcd60e51b815260040180806020018281038252602e815260200180612292602e913960400191505060405180910390fd5b600054610100900460ff16158015611be6576000805460ff1961ff0019909116610100171660011790555b611bee611d42565b61112e611edb565b600054610100900460ff1680611c0f5750611c0f611aab565b80611c1d575060005460ff16155b611c585760405162461bcd60e51b815260040180806020018281038252602e815260200180612292602e913960400191505060405180910390fd5b600054610100900460ff16158015611c83576000805460ff1961ff0019909116610100171660011790555b61112e611f86565b6060611ce0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661202c9092919063ffffffff16565b80519091501561177557808060200190516020811015611cff57600080fd5b50516117755760405162461bcd60e51b815260040180806020018281038252602a815260200180612301602a913960400191505060405180910390fd5b3b151590565b600054610100900460ff1680611d5b5750611d5b611aab565b80611d69575060005460ff16155b611da45760405162461bcd60e51b815260040180806020018281038252602e815260200180612292602e913960400191505060405180910390fd5b600054610100900460ff1615801561112e576000805460ff1961ff0019909116610100171660011790558015611140576000805461ff001916905550565b600054610100900460ff1680611dfb5750611dfb611aab565b80611e09575060005460ff16155b611e445760405162461bcd60e51b815260040180806020018281038252602e815260200180612292602e913960400191505060405180910390fd5b600054610100900460ff16158015611e6f576000805460ff1961ff0019909116610100171660011790555b6000611e796114ff565b603380546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015611140576000805461ff001916905550565b600054610100900460ff1680611ef45750611ef4611aab565b80611f02575060005460ff16155b611f3d5760405162461bcd60e51b815260040180806020018281038252602e815260200180612292602e913960400191505060405180910390fd5b600054610100900460ff16158015611f68576000805460ff1961ff0019909116610100171660011790555b6065805460ff191690558015611140576000805461ff001916905550565b600054610100900460ff1680611f9f5750611f9f611aab565b80611fad575060005460ff16155b611fe85760405162461bcd60e51b815260040180806020018281038252602e815260200180612292602e913960400191505060405180910390fd5b600054610100900460ff16158015612013576000805460ff1961ff0019909116610100171660011790555b60016097558015611140576000805461ff001916905550565b606061203b8484600085612045565b90505b9392505050565b6060824710156120865760405162461bcd60e51b815260040180806020018281038252602681526020018061226c6026913960400191505060405180910390fd5b61208f85611d3c565b6120e0576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061211f5780518252601f199092019160209182019101612100565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612181576040519150601f19603f3d011682016040523d82523d6000602084013e612186565b606091505b50915091506121968282866121a1565b979650505050505050565b606083156121b057508161203e565b8251156121c05782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561220a5781810151838201526020016121f2565b50505050905090810190601f1680156122375780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212200f4e03afc2b002698d3bf238a6f14802b75347d9cd5308752194cdd4cf226d1a64736f6c63430007030033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.