xDAI Price: $0.999966 (-0.01%)
Gas: 1 GWei

Contract

0x97C083ADb56F72B0393Aff7e58d9fB978beb48e6

Overview

xDAI Balance

Gnosis Chain LogoGnosis Chain LogoGnosis Chain Logo409.38877200637260287 xDAI

xDAI Value

$409.37 (@ $1.00/xDAI)

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Reclaim Contribu...384449662025-02-07 18:42:1574 days ago1738953735IN
0x97C083AD...78beb48e6
0 xDAI0.00013992
Reclaim Contribu...368886132024-11-06 17:49:45167 days ago1730915385IN
0x97C083AD...78beb48e6
0 xDAI0.000153892.2
Reclaim Contribu...368355262024-11-03 13:36:35170 days ago1730640995IN
0x97C083AD...78beb48e6
0 xDAI0.000174882.5
Reclaim Contribu...360962502024-09-20 10:25:40215 days ago1726827940IN
0x97C083AD...78beb48e6
0 xDAI0.000146892.09999998
Reclaim Contribu...359587722024-09-12 6:29:50223 days ago1726122590IN
0x97C083AD...78beb48e6
0 xDAI0.000195032.78807972
Reclaim Contribu...358856342024-09-07 22:20:45227 days ago1725747645IN
0x97C083AD...78beb48e6
0 xDAI0.000262532.76492505
Reclaim Contribu...358598342024-09-06 9:36:40229 days ago1725615400IN
0x97C083AD...78beb48e6
0 xDAI0.000209852.99999999
Reclaim Contribu...357981572024-09-02 17:21:40232 days ago1725297700IN
0x97C083AD...78beb48e6
0 xDAI0.000203772.91303691
Reclaim Contribu...357854872024-09-01 23:14:10233 days ago1725232450IN
0x97C083AD...78beb48e6
0 xDAI0.000154712.2117256
Reclaim Contribu...357654952024-08-31 18:35:35234 days ago1725129335IN
0x97C083AD...78beb48e6
0 xDAI0.000170682.44
Reclaim Contribu...357265742024-08-29 10:17:20237 days ago1724926640IN
0x97C083AD...78beb48e6
0 xDAI0.000209852.99999999
Reclaim Contribu...357257442024-08-29 9:05:55237 days ago1724922355IN
0x97C083AD...78beb48e6
0 xDAI0.000209853
Reclaim Contribu...357146642024-08-28 17:15:20237 days ago1724865320IN
0x97C083AD...78beb48e6
0 xDAI0.000147052.10218242
Reclaim Contribu...356976382024-08-27 16:52:25238 days ago1724777545IN
0x97C083AD...78beb48e6
0 xDAI0.00013992
Reclaim Contribu...356963412024-08-27 15:01:10238 days ago1724770870IN
0x97C083AD...78beb48e6
0 xDAI0.00013992
Reclaim Contribu...356960162024-08-27 14:33:15238 days ago1724769195IN
0x97C083AD...78beb48e6
0 xDAI0.00013992
Reclaim Contribu...356950822024-08-27 13:13:05238 days ago1724764385IN
0x97C083AD...78beb48e6
0 xDAI0.00013992
Reclaim Contribu...356932262024-08-27 10:33:55239 days ago1724754835IN
0x97C083AD...78beb48e6
0 xDAI0.00013992
Reclaim Contribu...356890632024-08-27 4:37:15239 days ago1724733435IN
0x97C083AD...78beb48e6
0 xDAI0.000209823
Reclaim Contribu...356835232024-08-26 20:41:20239 days ago1724704880IN
0x97C083AD...78beb48e6
0 xDAI0.000139882
Reclaim Contribu...356827292024-08-26 19:33:30239 days ago1724700810IN
0x97C083AD...78beb48e6
0 xDAI0.000146122.08891013
Reclaim Contribu...356817752024-08-26 18:12:00239 days ago1724695920IN
0x97C083AD...78beb48e6
0 xDAI0.000153892.19999998
Reclaim Contribu...356800552024-08-26 15:45:15239 days ago1724687115IN
0x97C083AD...78beb48e6
0 xDAI0.000153892.19999999
Reclaim Contribu...356787922024-08-26 13:56:50239 days ago1724680610IN
0x97C083AD...78beb48e6
0 xDAI0.000153892.2
Reclaim Contribu...356763072024-08-26 10:22:40240 days ago1724667760IN
0x97C083AD...78beb48e6
0 xDAI0.00027984
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
384449662025-02-07 18:42:1574 days ago1738953735
0x97C083AD...78beb48e6
588.709 xDAI
368886132024-11-06 17:49:45167 days ago1730915385
0x97C083AD...78beb48e6
315.20236 xDAI
368355262024-11-03 13:36:35170 days ago1730640995
0x97C083AD...78beb48e6
23.41593779 xDAI
360962502024-09-20 10:25:40215 days ago1726827940
0x97C083AD...78beb48e6
113.421 xDAI
359587722024-09-12 6:29:50223 days ago1726122590
0x97C083AD...78beb48e6
270.05 xDAI
358856342024-09-07 22:20:45227 days ago1725747645
0x97C083AD...78beb48e6
23.49174612 xDAI
358598342024-09-06 9:36:40229 days ago1725615400
0x97C083AD...78beb48e6
245.42565582 xDAI
357981572024-09-02 17:21:40232 days ago1725297700
0x97C083AD...78beb48e6
118.16666748 xDAI
357854872024-09-01 23:14:10233 days ago1725232450
0x97C083AD...78beb48e6
49.59292766 xDAI
357654952024-08-31 18:35:35234 days ago1725129335
0x97C083AD...78beb48e6
35.06403738 xDAI
357265742024-08-29 10:17:20237 days ago1724926640
0x97C083AD...78beb48e6
245.16666232 xDAI
357257442024-08-29 9:05:55237 days ago1724922355
0x97C083AD...78beb48e6
67.92533853 xDAI
357146642024-08-28 17:15:20237 days ago1724865320
0x97C083AD...78beb48e6
26.32590489 xDAI
356976382024-08-27 16:52:25238 days ago1724777545
0x97C083AD...78beb48e6
540.1 xDAI
356963412024-08-27 15:01:10238 days ago1724770870
0x97C083AD...78beb48e6
1,188.22 xDAI
356960162024-08-27 14:33:15238 days ago1724769195
0x97C083AD...78beb48e6
225.7618 xDAI
356950822024-08-27 13:13:05238 days ago1724764385
0x97C083AD...78beb48e6
118.822 xDAI
356932262024-08-27 10:33:55239 days ago1724754835
0x97C083AD...78beb48e6
59.411 xDAI
356890632024-08-27 4:37:15239 days ago1724733435
0x97C083AD...78beb48e6
430.99907852 xDAI
356835232024-08-26 20:41:20239 days ago1724704880
0x97C083AD...78beb48e6
216.04 xDAI
356827292024-08-26 19:33:30239 days ago1724700810
0x97C083AD...78beb48e6
67.21001999 xDAI
356817752024-08-26 18:12:00239 days ago1724695920
0x97C083AD...78beb48e6
226.842 xDAI
356800552024-08-26 15:45:15239 days ago1724687115
0x97C083AD...78beb48e6
154.46576623 xDAI
356787922024-08-26 13:56:50239 days ago1724680610
0x97C083AD...78beb48e6
23.5299966 xDAI
356763072024-08-26 10:22:40240 days ago1724667760
0x97C083AD...78beb48e6
32.406 xDAI
View All Internal Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x4FE55954...45c03B1fE
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
EthicHubLending

Compiler Version
v0.8.3+commit.8d00100c

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at gnosisscan.io on 2022-08-04
*/

// SPDX-License-Identifier: gpl-3.0
pragma solidity 0.8.3;


/**
 * Interface for the eternal storage.
 * Thanks RocketPool!
 * https://github.com/rocket-pool/rocketpool/blob/master/contracts/interface/RocketStorageInterface.sol
 */
interface IEthicHubStorage {

    //modifier for access in sets and deletes
    modifier onlyEthicHubContracts() {_;}

    // Setters
    function setAddress(bytes32 _key, address _value) external;
    function setUint(bytes32 _key, uint _value) external;
    function setString(bytes32 _key, string calldata _value) external;
    function setBytes(bytes32 _key, bytes calldata _value) external;
    function setBool(bytes32 _key, bool _value) external;
    function setInt(bytes32 _key, int _value) external;
    // Deleters
    function deleteAddress(bytes32 _key) external;
    function deleteUint(bytes32 _key) external;
    function deleteString(bytes32 _key) external;
    function deleteBytes(bytes32 _key) external;
    function deleteBool(bytes32 _key) external;
    function deleteInt(bytes32 _key) external;

    // Getters
    function getAddress(bytes32 _key) external view returns (address);
    function getUint(bytes32 _key) external view returns (uint);
    function getString(bytes32 _key) external view returns (string memory);
    function getBytes(bytes32 _key) external view returns (bytes memory);
    function getBool(bytes32 _key) external view returns (bool);
    function getInt(bytes32 _key) external view returns (int);
}







/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);
}





// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @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) {
        unchecked {
            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) {
        unchecked {
            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) {
        unchecked {
            // 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) {
        unchecked {
            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) {
        unchecked {
            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) {
        return a + b;
    }

    /**
     * @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) {
        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) {
        return a * b;
    }

    /**
     * @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.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        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) {
        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) {
        unchecked {
            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.
     *
     * 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) {
        unchecked {
            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) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}









/**
 * @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 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 Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}


/**
 * @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 Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_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 {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}







/**
 * @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 Pausable is Context {
    /**
     * @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.
     */
    constructor() {
        _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());
    }
}




contract EthicHubLending is Pausable, Ownable {
    using SafeMath for uint256;

    enum LendingState {
        Uninitialized,
        AcceptingContributions,
        Funded,
        AwaitingReturn,
        ProjectNotFunded,
        ContributionReturned,
        Default
    }

    uint8 public version;
    IEthicHubStorage public ethicHubStorage;

    mapping(address => Investor) public investors;
    uint256 public investorCount;
    uint256 public reclaimedContributions;
    uint256 public fundingStartTime; // Start time of contribution period in UNIX time
    uint256 public fundingEndTime; // End time of contribution period in UNIX time
    uint256 public totalContributed;

    bool public capReached;

    LendingState public state;

    uint256 public annualInterest;
    uint256 public totalLendingAmount;
    uint256 public lendingDays;
    uint256 public borrowerReturnDays;
    uint256 public maxDelayDays;

    address payable public borrower;
    address public localNode;
    address payable public ethicHubTeam;
    address payable public systemFeesCollector;

    uint256 public ethicHubFee;
    uint256 public systemFees;

    // Interest rate is using base uint 100 and 100% 10000, this means 1% is 100
    // this guarantee we can have a 2 decimal presicion in our calculation
    uint256 public constant interestBaseUint = 100;
    uint256 public constant interestBasePercent = 10000;

    bool public systemFeesReclaimed;
    bool public ethicHubTeamFeeReclaimed;

    uint256 public returnedAmount;

    struct Investor {
        uint256 amount;
        bool isCompensated;
    }

    struct LoanParams {
        uint256 fundingStartTime;
        uint256 fundingEndTime;
        uint256 annualInterest;
        uint256 totalLendingAmount;
        uint256 lendingDays;
        uint256 ethicHubFee;
        uint256 systemFees;
        uint256 maxDelayDays;
    }

    struct Actors {
        address payable borrower;
        address localNode;
        address payable ethicHubTeam;
        address payable systemFeesCollector;
    }

    // Events
    event CapReached(uint endTime);
    event Contribution(uint totalContributed, address indexed investor, uint amount, uint investorsCount);
    event Compensated(address indexed contributor, uint amount);
    event StateChange(uint state);
    event ReturnAmount(address indexed borrower, uint amount);
    event BorrowerChanged(address indexed newBorrower);
    event InvestorChanged(address indexed oldInvestor, address indexed newInvestor);
    event Reclaim(address indexed target, uint256 amount);

    modifier checkIfArbiter() {
        address arbiter = ethicHubStorage.getAddress(keccak256(abi.encodePacked("arbiter", this)));
        require(arbiter == msg.sender, "Sender not authorized");
        _;
    }

    modifier onlyOwnerOrLocalNode() {
        require(localNode == msg.sender || owner() == msg.sender,"Sender not authorized");
        _;
    }

    constructor(
        address _ethicHubStorage,
        LoanParams memory _loanParams,
        Actors memory _actors
    ) Ownable () Pausable () public {
        require(address(_ethicHubStorage) != address(0), "Storage address cannot be zero address");
        ethicHubStorage = IEthicHubStorage(_ethicHubStorage);

        require(_loanParams.fundingEndTime > _loanParams.fundingStartTime, "fundingEndTime should be later than fundingStartTime");
        require(_loanParams.totalLendingAmount > 0, "totalLendingAmount must be > 0");
        require(_loanParams.lendingDays > 0, "lendingDays must be > 0");
        require(_loanParams.annualInterest > 0 && _loanParams.annualInterest < 100, "_annualInterest must be between 0 and 100");
        require(_actors.borrower != address(0), "No borrower set");
        require(_actors.localNode != address(0), "No Local Node set");
        require(_actors.ethicHubTeam != address(0), "No EthicHub Team set");
        require(_actors.systemFeesCollector != address(0), "No System Fees Collector set");
        require(ethicHubStorage.getBool(keccak256(abi.encodePacked("user", "representative", _actors.borrower))), "Borrower not registered representative");
        require(ethicHubStorage.getBool(keccak256(abi.encodePacked("user", "localNode", _actors.localNode))), "Local Node is not registered");

        version = 11;
        reclaimedContributions = 0;
        borrowerReturnDays = 0;

        maxDelayDays = _loanParams.maxDelayDays;
        annualInterest = _loanParams.annualInterest;
        totalLendingAmount = _loanParams.totalLendingAmount;
        lendingDays = _loanParams.lendingDays;
        ethicHubFee = _loanParams.ethicHubFee;
        systemFees = _loanParams.systemFees;
        fundingStartTime = _loanParams.fundingStartTime;
        fundingEndTime = _loanParams.fundingEndTime;

        borrower = _actors.borrower;
        localNode = _actors.localNode;
        systemFeesCollector = _actors.systemFeesCollector;
        ethicHubTeam = _actors.ethicHubTeam;

        state = LendingState.AcceptingContributions;
    }

    function setBorrower(address payable _borrower) external checkIfArbiter {
        require(_borrower != address(0), "No borrower set");
        require(ethicHubStorage.getBool(keccak256(abi.encodePacked("user", "representative", _borrower))), "Borrower not registered representative");

        borrower = _borrower;

        emit BorrowerChanged(borrower);
    }

    function changeInvestorAddress(address _oldInvestor, address payable _newInvestor) external checkIfArbiter {
        require(_newInvestor != address(0));
        require(ethicHubStorage.getBool(keccak256(abi.encodePacked("user", "investor", _newInvestor))));
        require(investors[_oldInvestor].amount != 0, "OldInvestor should have invested in this project");
        require(
            investors[_newInvestor].amount == 0,
            "newInvestor should not have invested anything"
        );

        investors[_newInvestor].amount = investors[_oldInvestor].amount;
        investors[_newInvestor].isCompensated = investors[_oldInvestor].isCompensated;

        delete investors[_oldInvestor];

        emit InvestorChanged(_oldInvestor, _newInvestor);
    }

    function returnBorrowed() external payable {
        require(msg.sender == borrower, "In state AwaitingReturn only borrower can contribute");
        require(state == LendingState.AwaitingReturn, "State is not AwaitingReturn");

        bool projectRepayed = false;
        uint excessRepayment = 0;
        uint newReturnedAmount = 0;

        emit ReturnAmount(borrower, msg.value);

        (newReturnedAmount, projectRepayed, excessRepayment) = calculatePaymentGoal(borrowerReturnAmount(), returnedAmount, msg.value);

        returnedAmount = newReturnedAmount;

        if (projectRepayed == true) {
            borrowerReturnDays = getDaysPassedBetweenDates(fundingEndTime, block.timestamp);
            changeState(LendingState.ContributionReturned);
        }

        if (excessRepayment > 0) {
            payable(borrower).call{value: excessRepayment}('');
        }
    }

    // @notice Function to participate in contribution period
    //  Amounts from the same address should be added up
    //  If cap is reached, end time should be modified
    //  Funds should be transferred into multisig wallet
    // @param contributor Address
    function deposit(address payable contributor) external payable whenNotPaused {
        require(
            ethicHubStorage.getBool(keccak256(abi.encodePacked("user", "investor", contributor))),
            "Contributor is not registered lender"
        );
        require(state == LendingState.AcceptingContributions, "state is not AcceptingContributions");
        require(isContribPeriodRunning(), "can't contribute outside contribution period");

        uint oldTotalContributed = totalContributed;
        uint newTotalContributed = 0;
        uint excessContribAmount = 0;

        (newTotalContributed, capReached, excessContribAmount) = calculatePaymentGoal(totalLendingAmount, oldTotalContributed, msg.value);

        totalContributed = newTotalContributed;

        if (capReached) {
            fundingEndTime = block.timestamp;
            emit CapReached(fundingEndTime);
            changeState(LendingState.Funded);
        }

        if (investors[contributor].amount == 0) {
            investorCount = investorCount.add(1);
        }

        if (excessContribAmount > 0) {
            payable(contributor).call{value:excessContribAmount}('');
            investors[contributor].amount = investors[contributor].amount.add(msg.value).sub(excessContribAmount);
            emit Contribution(newTotalContributed, contributor, msg.value.sub(excessContribAmount), investorCount);
        } else {
            investors[contributor].amount = investors[contributor].amount.add(msg.value);
            emit Contribution(newTotalContributed, contributor, msg.value, investorCount);
        }
    }

    /**
     * After the contribution period ends unsuccesfully, this method enables the contributor
     *  to retrieve their contribution
     */
    function declareProjectNotFunded() external onlyOwnerOrLocalNode {
        require(totalContributed < totalLendingAmount);
        require(state == LendingState.AcceptingContributions);
        require(block.timestamp > fundingEndTime);

        changeState(LendingState.ProjectNotFunded);
    }

    function declareProjectDefault() external onlyOwnerOrLocalNode {
        require(state == LendingState.AwaitingReturn);
        require(getDelayDays(block.timestamp) >= maxDelayDays);
        changeState(LendingState.Default);
    }


    /**
     * Method to reclaim contribution after project is declared default (% of partial funds)
     * @param  beneficiary the contributor
     *
     */
    function reclaimContributionDefault(address payable beneficiary) external {
        require(state == LendingState.Default);
        require(!investors[beneficiary].isCompensated);

        // contribution = contribution * partial_funds / total_funds
        uint256 contribution = checkInvestorReturns(beneficiary);

        require(contribution > 0);

        investors[beneficiary].isCompensated = true;
        reclaimedContributions = reclaimedContributions.add(1);

        doReclaim(beneficiary, contribution);
    }

    /**
     * Method to reclaim contribution after a project is declared as not funded
     * @param  beneficiary the contributor
     *
     */
    function reclaimContribution(address payable beneficiary) external {
        require(state == LendingState.ProjectNotFunded, "State is not ProjectNotFunded");
        require(!investors[beneficiary].isCompensated, "Contribution already reclaimed");
        uint256 contribution = investors[beneficiary].amount;
        require(contribution > 0, "Contribution is 0");

        investors[beneficiary].isCompensated = true;
        reclaimedContributions = reclaimedContributions.add(1);

        doReclaim(beneficiary, contribution);
    }

    function reclaimContributionWithInterest(address payable beneficiary) external {
        require(state == LendingState.ContributionReturned, "State is not ContributionReturned");
        require(!investors[beneficiary].isCompensated, "Lender already compensated");
        uint256 contribution = checkInvestorReturns(beneficiary);
        require(contribution > 0, "Contribution is 0");

        investors[beneficiary].isCompensated = true;
        reclaimedContributions = reclaimedContributions.add(1);

        doReclaim(beneficiary, contribution);
    }

    function reclaimSystemFees() external {
        require(state == LendingState.AwaitingReturn || state == LendingState.ContributionReturned, "State is not AwaitingReturn or ContributionReturned");
        require(systemFeesReclaimed == false, "Local Node's fee already reclaimed");
        uint256 fee = totalLendingAmount.mul(systemFees).mul(interestBaseUint).div(interestBasePercent);
        require(fee > 0, "Local Node's team fee is 0");

        systemFeesReclaimed = true;

        doReclaim(systemFeesCollector, fee);
    }

    function reclaimEthicHubTeamFee() external {
        require(state == LendingState.AwaitingReturn || state == LendingState.ContributionReturned, "State is not AwaitingReturn or ContributionReturned");
        require(ethicHubTeamFeeReclaimed == false, "EthicHub team's fee already reclaimed");
        uint256 fee = totalLendingAmount.mul(ethicHubFee).mul(interestBaseUint).div(interestBasePercent);
        require(fee > 0, "EthicHub's team fee is 0");

        ethicHubTeamFeeReclaimed = true;

        doReclaim(ethicHubTeam, fee);
    }

    function reclaimLeftover() external checkIfArbiter {
        require(state == LendingState.ContributionReturned || state == LendingState.Default, "State is not ContributionReturned or Default");
        require(systemFeesReclaimed, "Local Node fee is not reclaimed");
        require(ethicHubTeamFeeReclaimed, "Team fee is not reclaimed");
        require(investorCount == reclaimedContributions, "Not all investors have reclaimed their share");

        doReclaim(ethicHubTeam, address(this).balance);
    }

    function doReclaim(address payable target, uint256 amount) internal {
        uint256 contractBalance = address(this).balance;
        uint256 reclaimAmount = (contractBalance < amount) ? contractBalance : amount;
        
        payable(target).call{value:reclaimAmount}('');

        emit Reclaim(target, reclaimAmount);
    }

    

    /**
     * Calculates if a target value is reached after increment, and by how much it was surpassed.
     * @param goal the target to achieve
     * @param oldTotal the total so far after the increment
     * @param contribValue the increment
     * @return (the incremented count, not bigger than max), (goal has been reached), (excess to return)
     */
    function calculatePaymentGoal(uint goal, uint oldTotal, uint contribValue) internal pure returns(uint, bool, uint) {
        uint newTotal = oldTotal.add(contribValue);
        bool goalReached = false;
        uint excess = 0;
        if (newTotal >= goal && oldTotal < goal) {
            goalReached = true;
            excess = newTotal.sub(goal);
            contribValue = contribValue.sub(excess);
            newTotal = goal;
        }
        return (newTotal, goalReached, excess);
    }

    function sendFundsToBorrower() external onlyOwnerOrLocalNode {
        // Waiting for Exchange
        require(state == LendingState.Funded, "State has to be AcceptingContributions");
        uint256 systemFee = totalLendingAmount.mul(systemFees).mul(interestBaseUint).div(interestBasePercent);
        uint256 teamFee = totalLendingAmount.mul(ethicHubFee).mul(interestBaseUint).div(interestBasePercent);
        changeState(LendingState.AwaitingReturn);
        payable(borrower).call{value: totalContributed.sub(systemFee).sub(teamFee)}('');
    }

    /**
    * Calculates days passed after defaulting
    * @param date timestamp to calculate days
    * @return day number
    */
    function getDelayDays(uint date) public view returns(uint) {
        uint lendingDaysSeconds = lendingDays * 1 days;
        uint defaultTime = fundingEndTime.add(lendingDaysSeconds);

        if (date < defaultTime) {
            return 0;
        } else {
            return getDaysPassedBetweenDates(defaultTime, date);
        }
    }

    /**
    * Calculates days passed between two dates in seconds
    * @param firstDate timestamp
    * @param lastDate timestamp
    * @return days passed
    */
    function getDaysPassedBetweenDates(uint firstDate, uint lastDate) public pure returns(uint) {
        require(firstDate <= lastDate, "lastDate must be bigger than firstDate");
        return lastDate.sub(firstDate).div(60).div(60).div(24);
    }

    // lendingInterestRate with 2 decimal
    // 15 * (lending days)/ 365 + 4% system fee + 3% LendingDev fee
    function lendingInterestRatePercentage() public view returns(uint256){
        return annualInterest.mul(interestBaseUint)
            // current days
            .mul(getDaysPassedBetweenDates(fundingEndTime, block.timestamp)).div(365)
            .add(systemFees.mul(interestBaseUint))
            .add(ethicHubFee.mul(interestBaseUint))
            .add(interestBasePercent);
    }

    // lendingInterestRate with 2 decimal
    function investorInterest() public view returns(uint256){
        return annualInterest.mul(interestBaseUint).mul(borrowerReturnDays).div(365).add(interestBasePercent);
    }

    function borrowerReturnAmount() public view returns(uint256) {
        uint interestGenerated = annualInterest.mul(interestBaseUint).mul(getDaysPassedBetweenDates(fundingEndTime, block.timestamp)).div(365).add(interestBasePercent);
        return totalLendingAmount.mul(interestGenerated).div(interestBasePercent);
    }


    function isContribPeriodRunning() public view returns(bool) {
        return fundingStartTime <= block.timestamp && fundingEndTime > block.timestamp && !capReached;
    }

    function checkInvestorContribution(address investor) public view returns(uint256){
        return investors[investor].amount;
    }

    function checkInvestorReturns(address investor) public view returns(uint256) {
        uint256 investorAmount = 0;
        if (state == LendingState.ContributionReturned) {
            investorAmount = investors[investor].amount;
            return investorAmount.mul(investorInterest()).div(interestBasePercent);
        } else if (state == LendingState.Default){
            investorAmount = investors[investor].amount;
            // contribution = contribution * partial_funds / total_funds
            return investorAmount.mul(returnedAmount).div(totalLendingAmount);
        } else {
            return 0;
        }
    }

    function getUserContributionReclaimStatus(address userAddress) public view returns(bool isCompensated){
        return investors[userAddress].isCompensated;
    }

    function changeState(LendingState newState) internal {
        state = newState;
        emit StateChange(uint(newState));
    }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_ethicHubStorage","type":"address"},{"components":[{"internalType":"uint256","name":"fundingStartTime","type":"uint256"},{"internalType":"uint256","name":"fundingEndTime","type":"uint256"},{"internalType":"uint256","name":"annualInterest","type":"uint256"},{"internalType":"uint256","name":"totalLendingAmount","type":"uint256"},{"internalType":"uint256","name":"lendingDays","type":"uint256"},{"internalType":"uint256","name":"ethicHubFee","type":"uint256"},{"internalType":"uint256","name":"systemFees","type":"uint256"},{"internalType":"uint256","name":"maxDelayDays","type":"uint256"}],"internalType":"struct EthicHubLending.LoanParams","name":"_loanParams","type":"tuple"},{"components":[{"internalType":"address payable","name":"borrower","type":"address"},{"internalType":"address","name":"localNode","type":"address"},{"internalType":"address payable","name":"ethicHubTeam","type":"address"},{"internalType":"address payable","name":"systemFeesCollector","type":"address"}],"internalType":"struct EthicHubLending.Actors","name":"_actors","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newBorrower","type":"address"}],"name":"BorrowerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"CapReached","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contributor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Compensated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"totalContributed","type":"uint256"},{"indexed":true,"internalType":"address","name":"investor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"investorsCount","type":"uint256"}],"name":"Contribution","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldInvestor","type":"address"},{"indexed":true,"internalType":"address","name":"newInvestor","type":"address"}],"name":"InvestorChanged","type":"event"},{"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":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Reclaim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ReturnAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"state","type":"uint256"}],"name":"StateChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"annualInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"borrower","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"borrowerReturnAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"borrowerReturnDays","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"capReached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_oldInvestor","type":"address"},{"internalType":"address payable","name":"_newInvestor","type":"address"}],"name":"changeInvestorAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"investor","type":"address"}],"name":"checkInvestorContribution","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"investor","type":"address"}],"name":"checkInvestorReturns","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"declareProjectDefault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"declareProjectNotFunded","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"contributor","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"ethicHubFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethicHubStorage","outputs":[{"internalType":"contract IEthicHubStorage","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethicHubTeam","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethicHubTeamFeeReclaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fundingEndTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fundingStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"firstDate","type":"uint256"},{"internalType":"uint256","name":"lastDate","type":"uint256"}],"name":"getDaysPassedBetweenDates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"date","type":"uint256"}],"name":"getDelayDays","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"}],"name":"getUserContributionReclaimStatus","outputs":[{"internalType":"bool","name":"isCompensated","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"interestBasePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"interestBaseUint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"investorCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"investorInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"investors","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"isCompensated","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isContribPeriodRunning","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lendingDays","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lendingInterestRatePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"localNode","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxDelayDays","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"beneficiary","type":"address"}],"name":"reclaimContribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"beneficiary","type":"address"}],"name":"reclaimContributionDefault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"beneficiary","type":"address"}],"name":"reclaimContributionWithInterest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reclaimEthicHubTeamFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reclaimLeftover","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reclaimSystemFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reclaimedContributions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"returnBorrowed","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"returnedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sendFundsToBorrower","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_borrower","type":"address"}],"name":"setBorrower","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"state","outputs":[{"internalType":"enum EthicHubLending.LendingState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"systemFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"systemFeesCollector","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"systemFeesReclaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalContributed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLendingAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x6080604052600436106102ff5760003560e01c80637a53fa5211610190578063b2552fc4116100dc578063d7e64c0011610095578063f2fde38b1161006f578063f2fde38b14610879578063f340fa0114610899578063f8a321e1146108ac578063fd6edb52146108e2576102ff565b8063d7e64c001461082d578063e78686eb14610843578063ebdd3c9c14610863576102ff565b8063b2552fc41461078c578063bd366ddc146107a2578063c19d93fb146107b7578063c3180f6f146107e3578063c762d5f7146107f8578063cfefe5a214610818576102ff565b80639302764d116101495780639ab4d3a8116101235780639ab4d3a8146107215780639b82860914610741578063a5f2e07914610761578063aceefefd14610776576102ff565b80639302764d146106ed57806397299d8a1461070357806398d2915f14610719576102ff565b80637a53fa52146106135780637ca5112c1461062d5780637df1f1b91461064d57806381c9a1141461066d57806387cf34cf1461068d5780638da5cb5b146106c9576102ff565b8063534ddf191161024f5780636ab4f92111610208578063717ba064116101e2578063717ba064146105b3578063734bb78c146105d2578063742ba8de146105e857806374eedd46146105fd576102ff565b80636ab4f9211461053c5780636f7bc9be14610552578063715018a61461059e576102ff565b8063534ddf191461048757806354fd4d50146104a75780635c07993b146104da5780635c975abb146104ef57806361c4adaa14610507578063674539691461051c576102ff565b80631df93558116102bc5780634419da33116102965780634419da331461040857806349b88203146104285780634f9359451461043d578063532da8f914610467576102ff565b80631df93558146103bd5780632e7cece3146103d357806341c8b1de146103f3576102ff565b8063023f4147146103045780630f226b6c1461032d5780630f82c53e14610343578063106099021461037b578063150c6e711461039257806315d28e11146103a7575b600080fd5b34801561031057600080fd5b5061031a60075481565b6040519081526020015b60405180910390f35b34801561033957600080fd5b5061031a61271081565b34801561034f57600080fd5b50600f54610363906001600160a01b031681565b6040516001600160a01b039091168152602001610324565b34801561038757600080fd5b506103906108f8565b005b34801561039e57600080fd5b50610390610aae565b3480156103b357600080fd5b5061031a600a5481565b3480156103c957600080fd5b5061031a60055481565b3480156103df57600080fd5b50601054610363906001600160a01b031681565b3480156103ff57600080fd5b5061031a610c25565b34801561041457600080fd5b506103906104233660046126fb565b610c86565b34801561043457600080fd5b50610390610f99565b34801561044957600080fd5b506008546104579060ff1681565b6040519015158152602001610324565b34801561047357600080fd5b5061031a610482366004612753565b611045565b34801561049357600080fd5b506103906104a23660046126c3565b61109b565b3480156104b357600080fd5b506000546104c890600160a81b900460ff1681565b60405160ff9091168152602001610324565b3480156104e657600080fd5b5061031a611158565b3480156104fb57600080fd5b5060005460ff16610457565b34801561051357600080fd5b5061031a606481565b34801561052857600080fd5b50600154610363906001600160a01b031681565b34801561054857600080fd5b5061031a600c5481565b34801561055e57600080fd5b5061058961056d3660046126c3565b6002602052600090815260409020805460019091015460ff1682565b60408051928352901515602083015201610324565b3480156105aa57600080fd5b50610390611182565b3480156105bf57600080fd5b5060145461045790610100900460ff1681565b3480156105de57600080fd5b5061031a60125481565b3480156105f457600080fd5b506103906111ec565b34801561060957600080fd5b5061031a60065481565b34801561061f57600080fd5b506014546104579060ff1681565b34801561063957600080fd5b50601154610363906001600160a01b031681565b34801561065957600080fd5b50600e54610363906001600160a01b031681565b34801561067957600080fd5b5061031a61068836600461276b565b61129d565b34801561069957600080fd5b506104576106a83660046126c3565b6001600160a01b031660009081526002602052604090206001015460ff1690565b3480156106d557600080fd5b5061036360005461010090046001600160a01b031690565b3480156106f957600080fd5b5061031a60135481565b34801561070f57600080fd5b5061031a600b5481565b610390611319565b34801561072d57600080fd5b5061031a61073c3660046126c3565b6114f5565b34801561074d57600080fd5b5061039061075c3660046126c3565b6115d0565b34801561076d57600080fd5b5061031a611710565b34801561078257600080fd5b5061031a60045481565b34801561079857600080fd5b5061031a60095481565b3480156107ae57600080fd5b50610390611751565b3480156107c357600080fd5b506008546107d690610100900460ff1681565b60405161032491906127ea565b3480156107ef57600080fd5b506103906118cf565b34801561080457600080fd5b506103906108133660046126c3565b611b8d565b34801561082457600080fd5b50610457611e27565b34801561083957600080fd5b5061031a60035481565b34801561084f57600080fd5b5061039061085e3660046126c3565b611e4e565b34801561086f57600080fd5b5061031a60155481565b34801561088557600080fd5b506103906108943660046126c3565b611f8d565b6103906108a73660046126c3565b61205b565b3480156108b857600080fd5b5061031a6108c73660046126c3565b6001600160a01b031660009081526002602052604090205490565b3480156108ee57600080fd5b5061031a600d5481565b600f546001600160a01b031633148061092f57503361092460005461010090046001600160a01b031690565b6001600160a01b0316145b6109545760405162461bcd60e51b815260040161094b90612812565b60405180910390fd5b6002600854610100900460ff16600681111561098057634e487b7160e01b600052602160045260246000fd5b146109dc5760405162461bcd60e51b815260206004820152602660248201527f53746174652068617320746f20626520416363657074696e67436f6e747269626044820152657574696f6e7360d01b606482015260840161094b565b6000610a0c612710610a066064610a00601354600a546124b890919063ffffffff16565b906124b8565b906124c4565b90506000610a32612710610a066064610a00601254600a546124b890919063ffffffff16565b9050610a3e60036124d0565b600e546007546001600160a01b0390911690610a66908390610a609086612559565b90612559565b604051600081818185875af1925050503d8060008114610aa2576040519150601f19603f3d011682016040523d82523d6000602084013e610aa7565b606091505b5050505050565b6003600854610100900460ff166006811115610ada57634e487b7160e01b600052602160045260246000fd5b1480610b0f57506005600854610100900460ff166006811115610b0d57634e487b7160e01b600052602160045260246000fd5b145b610b2b5760405162461bcd60e51b815260040161094b90612841565b60145460ff1615610b895760405162461bcd60e51b815260206004820152602260248201527f4c6f63616c204e6f646527732066656520616c7265616479207265636c61696d604482015261195960f21b606482015260840161094b565b6000610bad612710610a066064610a00601354600a546124b890919063ffffffff16565b905060008111610bff5760405162461bcd60e51b815260206004820152601a60248201527f4c6f63616c204e6f64652773207465616d206665652069732030000000000000604482015260640161094b565b6014805460ff19166001179055601154610c22906001600160a01b031682612565565b50565b6000610c81612710610c7b610c4660646012546124b890919063ffffffff16565b601354610c7b90610c589060646124b8565b610c7b61016d610a06610c6d6006544261129d565b600954610a009060646124b8565b90612607565b905090565b6001546040516000916001600160a01b0316906321f8a72190610cad90309060200161278c565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610ce191815260200190565b60206040518083038186803b158015610cf957600080fd5b505afa158015610d0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3191906126df565b90506001600160a01b0381163314610d5b5760405162461bcd60e51b815260040161094b90612812565b6001600160a01b038216610d6e57600080fd5b6001546040516001600160a01b0390911690637ae1cfca90610d949085906020016127b4565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610dc891815260200190565b60206040518083038186803b158015610de057600080fd5b505afa158015610df4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e189190612733565b610e2157600080fd5b6001600160a01b038316600090815260026020526040902054610e9f5760405162461bcd60e51b815260206004820152603060248201527f4f6c64496e766573746f722073686f756c64206861766520696e76657374656460448201526f081a5b881d1a1a5cc81c1c9bda9958dd60821b606482015260840161094b565b6001600160a01b03821660009081526002602052604090205415610f1b5760405162461bcd60e51b815260206004820152602d60248201527f6e6577496e766573746f722073686f756c64206e6f74206861766520696e766560448201526c7374656420616e797468696e6760981b606482015260840161094b565b6001600160a01b0380841660008181526002602052604080822080549487168084528284209586556001808301805491909701805460ff909216151560ff19928316179055858552918490558554909116909455517fc204b28865760f18aa0ef147ee25573d2dba9f208385c8aa65fb79150978fb6d9190a3505050565b600f546001600160a01b0316331480610fd0575033610fc560005461010090046001600160a01b031690565b6001600160a01b0316145b610fec5760405162461bcd60e51b815260040161094b90612812565b6003600854610100900460ff16600681111561101857634e487b7160e01b600052602160045260246000fd5b1461102257600080fd5b600d5461102e42611045565b101561103957600080fd5b61104360066124d0565b565b600080600b546201518061105991906128cc565b905060006110728260065461260790919063ffffffff16565b90508084101561108757600092505050611096565b611091818561129d565b925050505b919050565b6006600854610100900460ff1660068111156110c757634e487b7160e01b600052602160045260246000fd5b146110d157600080fd5b6001600160a01b03811660009081526002602052604090206001015460ff16156110fa57600080fd5b6000611105826114f5565b90506000811161111457600080fd5b6001600160a01b03821660009081526002602052604090206001908101805460ff19168217905560045461114791612607565b6004556111548282612565565b5050565b6000610c81612710610c7b61016d610a06600c54610a0060646009546124b890919063ffffffff16565b6000546001600160a01b036101009091041633146111e25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161094b565b6110436000612613565b600f546001600160a01b031633148061122357503361121860005461010090046001600160a01b031690565b6001600160a01b0316145b61123f5760405162461bcd60e51b815260040161094b90612812565b600a546007541061124f57600080fd5b6001600854610100900460ff16600681111561127b57634e487b7160e01b600052602160045260246000fd5b1461128557600080fd5b600654421161129357600080fd5b61104360046124d0565b6000818311156112fe5760405162461bcd60e51b815260206004820152602660248201527f6c61737444617465206d75737420626520626967676572207468616e2066697260448201526573744461746560d01b606482015260840161094b565b6113126018610a06603c818181888a612559565b9392505050565b600e546001600160a01b031633146113905760405162461bcd60e51b815260206004820152603460248201527f496e207374617465204177616974696e6752657475726e206f6e6c7920626f72604482015273726f7765722063616e20636f6e7472696275746560601b606482015260840161094b565b6003600854610100900460ff1660068111156113bc57634e487b7160e01b600052602160045260246000fd5b146114095760405162461bcd60e51b815260206004820152601b60248201527f5374617465206973206e6f74204177616974696e6752657475726e0000000000604482015260640161094b565b600e54604051348152600091829182916001600160a01b0316907fd2a3d0e3eea97ca0ad91f0ba5deca86ca143f6e434ef8429c892f2bab9ade4db9060200160405180910390a261146461145b611710565b6015543461266c565b60158390559094509250905060018315151415611494576114876006544261129d565b600c5561149460056124d0565b81156114f057600e546040516001600160a01b03909116908390600081818185875af1925050503d80600081146114e7576040519150601f19603f3d011682016040523d82523d6000602084013e6114ec565b606091505b5050505b505050565b6000806005600854610100900460ff16600681111561152457634e487b7160e01b600052602160045260246000fd5b141561156457506001600160a01b03821660009081526002602052604090205461155c612710610a06611555611158565b84906124b8565b915050611096565b6006600854610100900460ff16600681111561159057634e487b7160e01b600052602160045260246000fd5b14156115c657506001600160a01b038216600090815260026020526040902054600a5460155461155c9190610a069084906124b8565b6000915050611096565b6005600854610100900460ff1660068111156115fc57634e487b7160e01b600052602160045260246000fd5b146116535760405162461bcd60e51b815260206004820152602160248201527f5374617465206973206e6f7420436f6e747269627574696f6e52657475726e656044820152601960fa1b606482015260840161094b565b6001600160a01b03811660009081526002602052604090206001015460ff16156116bf5760405162461bcd60e51b815260206004820152601a60248201527f4c656e64657220616c726561647920636f6d70656e7361746564000000000000604482015260640161094b565b60006116ca826114f5565b9050600081116111145760405162461bcd60e51b81526020600482015260116024820152700436f6e747269627574696f6e206973203607c1b604482015260640161094b565b60008061172e612710610c7b61016d610a06610c6d6006544261129d565b905061174b612710610a0683600a546124b890919063ffffffff16565b91505090565b6003600854610100900460ff16600681111561177d57634e487b7160e01b600052602160045260246000fd5b14806117b257506005600854610100900460ff1660068111156117b057634e487b7160e01b600052602160045260246000fd5b145b6117ce5760405162461bcd60e51b815260040161094b90612841565b601454610100900460ff16156118345760405162461bcd60e51b815260206004820152602560248201527f4574686963487562207465616d27732066656520616c7265616479207265636c604482015264185a5b595960da1b606482015260840161094b565b6000611858612710610a066064610a00601254600a546124b890919063ffffffff16565b9050600081116118aa5760405162461bcd60e51b815260206004820152601860248201527f45746869634875622773207465616d2066656520697320300000000000000000604482015260640161094b565b6014805461ff001916610100179055601054610c22906001600160a01b031682612565565b6001546040516000916001600160a01b0316906321f8a721906118f690309060200161278c565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b815260040161192a91815260200190565b60206040518083038186803b15801561194257600080fd5b505afa158015611956573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197a91906126df565b90506001600160a01b03811633146119a45760405162461bcd60e51b815260040161094b90612812565b6005600854610100900460ff1660068111156119d057634e487b7160e01b600052602160045260246000fd5b1480611a0557506006600854610100900460ff166006811115611a0357634e487b7160e01b600052602160045260246000fd5b145b611a665760405162461bcd60e51b815260206004820152602c60248201527f5374617465206973206e6f7420436f6e747269627574696f6e52657475726e6560448201526b19081bdc88111959985d5b1d60a21b606482015260840161094b565b60145460ff16611ab85760405162461bcd60e51b815260206004820152601f60248201527f4c6f63616c204e6f646520666565206973206e6f74207265636c61696d656400604482015260640161094b565b601454610100900460ff16611b0f5760405162461bcd60e51b815260206004820152601960248201527f5465616d20666565206973206e6f74207265636c61696d656400000000000000604482015260640161094b565b60045460035414611b775760405162461bcd60e51b815260206004820152602c60248201527f4e6f7420616c6c20696e766573746f72732068617665207265636c61696d656460448201526b20746865697220736861726560a01b606482015260840161094b565b601054610c22906001600160a01b031647612565565b6001546040516000916001600160a01b0316906321f8a72190611bb490309060200161278c565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401611be891815260200190565b60206040518083038186803b158015611c0057600080fd5b505afa158015611c14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3891906126df565b90506001600160a01b0381163314611c625760405162461bcd60e51b815260040161094b90612812565b6001600160a01b038216611caa5760405162461bcd60e51b815260206004820152600f60248201526e139bc8189bdc9c9bddd95c881cd95d608a1b604482015260640161094b565b600154604051633ab9b2b960e11b60208201526d726570726573656e74617469766560901b60248201526001600160601b0319606085901b1660328201526001600160a01b0390911690637ae1cfca90604601604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401611d3191815260200190565b60206040518083038186803b158015611d4957600080fd5b505afa158015611d5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d819190612733565b611ddc5760405162461bcd60e51b815260206004820152602660248201527f426f72726f776572206e6f74207265676973746572656420726570726573656e60448201526574617469766560d01b606482015260840161094b565b600e80546001600160a01b0319166001600160a01b0384169081179091556040517fa1cc029f3440726d0dd25b6385e24d209e5bf7817d6662d6e4bfdfbc621c1cf290600090a25050565b60004260055411158015611e3c575042600654115b8015610c8157505060085460ff161590565b6004600854610100900460ff166006811115611e7a57634e487b7160e01b600052602160045260246000fd5b14611ec75760405162461bcd60e51b815260206004820152601d60248201527f5374617465206973206e6f742050726f6a6563744e6f7446756e646564000000604482015260640161094b565b6001600160a01b03811660009081526002602052604090206001015460ff1615611f335760405162461bcd60e51b815260206004820152601e60248201527f436f6e747269627574696f6e20616c7265616479207265636c61696d65640000604482015260640161094b565b6001600160a01b038116600090815260026020526040902054806111145760405162461bcd60e51b81526020600482015260116024820152700436f6e747269627574696f6e206973203607c1b604482015260640161094b565b6000546001600160a01b03610100909104163314611fed5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161094b565b6001600160a01b0381166120525760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161094b565b610c2281612613565b60005460ff16156120a15760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161094b565b6001546040516001600160a01b0390911690637ae1cfca906120c79084906020016127b4565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016120fb91815260200190565b60206040518083038186803b15801561211357600080fd5b505afa158015612127573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214b9190612733565b6121a35760405162461bcd60e51b8152602060048201526024808201527f436f6e7472696275746f72206973206e6f742072656769737465726564206c65604482015263373232b960e11b606482015260840161094b565b6001600854610100900460ff1660068111156121cf57634e487b7160e01b600052602160045260246000fd5b146122285760405162461bcd60e51b815260206004820152602360248201527f7374617465206973206e6f7420416363657074696e67436f6e747269627574696044820152626f6e7360e81b606482015260840161094b565b612230611e27565b6122915760405162461bcd60e51b815260206004820152602c60248201527f63616e277420636f6e74726962757465206f75747369646520636f6e7472696260448201526b1d5d1a5bdb881c195c9a5bd960a21b606482015260840161094b565b600060075490506000806122a8600a54843461266c565b6008805460ff19169215159283179055600783905591935090915060ff161561230e574260068190556040519081527f0d1677807e63887e44af23c98b7b1668a3b088b46f400428129d4730e695671f9060200160405180910390a161230e60026124d0565b6001600160a01b03841660009081526002602052604090205461233d57600354612339906001612607565b6003555b801561242b576040516001600160a01b038516908290600081818185875af1925050503d806000811461238c576040519150601f19603f3d011682016040523d82523d6000602084013e612391565b606091505b5050506001600160a01b0384166000908152600260205260409020546123bd908290610a609034612607565b6001600160a01b0385166000818152600260205260409020919091557f6ff14b3a8f5fae2820852e97781b139d374bfca25145c281486dc4484948428f836124053485612559565b6003546040805193845260208401929092529082015260600160405180910390a26124b2565b6001600160a01b03841660009081526002602052604090205461244e9034612607565b6001600160a01b038516600081815260026020908152604091829020939093556003548151868152349481019490945290830152907f6ff14b3a8f5fae2820852e97781b139d374bfca25145c281486dc4484948428f906060015b60405180910390a25b50505050565b600061131282846128cc565b600061131282846128ac565b6008805482919061ff0019166101008360068111156124ff57634e487b7160e01b600052602160045260246000fd5b02179055507f49628ca47affc2c0364f092b96d5c6037157da8dd90c96c281f775bd576a45b981600681111561254557634e487b7160e01b600052602160045260246000fd5b60405190815260200160405180910390a150565b600061131282846128eb565b4760008282106125755782612577565b815b9050836001600160a01b03168160405160006040518083038185875af1925050503d80600081146125c4576040519150601f19603f3d011682016040523d82523d6000602084013e6125c9565b606091505b505050836001600160a01b03167f6c4b794a4b78cc93f78e6a6accc7e3f1388e15da178a4437a895760dc24ff3c4826040516124a991815260200190565b60006113128284612894565b600080546001600160a01b03838116610100818102610100600160a81b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b600080808061267b8686612607565b905060008088831015801561268f57508888105b156126b457600191506126a2838a612559565b90506126ae8782612559565b96508892505b91989097509095509350505050565b6000602082840312156126d4578081fd5b813561131281612918565b6000602082840312156126f0578081fd5b815161131281612918565b6000806040838503121561270d578081fd5b823561271881612918565b9150602083013561272881612918565b809150509250929050565b600060208284031215612744578081fd5b81518015158114611312578182fd5b600060208284031215612764578081fd5b5035919050565b6000806040838503121561277d578182fd5b50508035926020909101359150565b6630b93134ba32b960c91b815260609190911b6001600160601b0319166007820152601b0190565b633ab9b2b960e11b81526734b73b32b9ba37b960c11b600482015260609190911b6001600160601b031916600c82015260200190565b602081016007831061280c57634e487b7160e01b600052602160045260246000fd5b91905290565b60208082526015908201527414d95b99195c881b9bdd08185d5d1a1bdc9a5e9959605a1b604082015260600190565b60208082526033908201527f5374617465206973206e6f74204177616974696e6752657475726e206f7220436040820152721bdb9d1c9a589d5d1a5bdb94995d1d5c9b9959606a1b606082015260800190565b600082198211156128a7576128a7612902565b500190565b6000826128c757634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156128e6576128e6612902565b500290565b6000828210156128fd576128fd612902565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610c2257600080fdfea26469706673582212202e36d8e84930ad1f11cec1c1667bfb4e508cc7128ca7ddca5761f6a08e53296964736f6c63430008030033

Block Transaction Gas Used Reward
view all blocks validated

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.