core-artifacts
Version:
Consist artifacts of the maple protocol
745 lines (744 loc) • 526 kB
JSON
{
"id": "cd16fc629b966ce4bca14c4291f94fc4",
"_format": "hh-sol-build-info-1",
"solcVersion": "0.6.11",
"solcLongVersion": "0.6.11+commit.5ef660b1",
"input": {
"language": "Solidity",
"sources": {
"contracts/core/premium-calculator/v1/PremiumCalc.sol": {
"content": "// SPDX-License-Identifier: AGPL-3.0-or-later // hevm: flattened sources of contracts/core/premium-calculator/v1/PremiumCalc.sol\npragma solidity =0.6.11 >=0.6.0 <0.8.0;\n\n////// contracts/core/calculator/v1/interfaces/ICalc.sol\n/* pragma solidity 0.6.11; */\n\n/// @title Calc calculates.\ninterface ICalc {\n\n /**\n @dev The Calculator type.\n */\n function calcType() external pure returns (uint8);\n\n /**\n @dev The Calculator name.\n */\n function name() external pure returns (bytes32);\n\n}\n\n////// lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\n/* pragma solidity >=0.6.0 <0.8.0; */\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n\n////// contracts/core/funds-distribution-token/v1/interfaces/IBasicFDT.sol\n/* pragma solidity 0.6.11; */\n\n/* import { IERC20 } from \"../../../../../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\"; */\n\n/// @title BasicFDT implements the basic level FDT functionality for accounting for revenues.\ninterface IBasicFDT is IERC20 {\n\n /**\n @dev This event emits when new funds are distributed.\n @param by The address of the sender that distributed funds.\n @param fundsDistributed The amount of funds received for distribution.\n */\n event FundsDistributed(address indexed by, uint256 fundsDistributed);\n\n /**\n @dev This event emits when distributed funds are withdrawn by a token holder.\n @param by The address of the receiver of funds.\n @param fundsWithdrawn The amount of funds that were withdrawn.\n @param totalWithdrawn The total amount of funds that were withdrawn.\n */\n event FundsWithdrawn(address indexed by, uint256 fundsWithdrawn, uint256 totalWithdrawn);\n\n /**\n @dev This event emits when the internal `pointsPerShare` is updated.\n @dev First, and only, parameter is the new value of the internal `pointsPerShare`.\n */\n event PointsPerShareUpdated(uint256);\n\n /**\n @dev This event emits when an account's `pointsCorrection` is updated.\n @dev First parameter is the address of some account.\n @dev Second parameter is the new value of the account's `pointsCorrection`.\n */\n event PointsCorrectionUpdated(address indexed, int256);\n\n /**\n @dev Returns the amount of funds that an account can withdraw.\n @param _owner The address of some FDT holder.\n @return The amount funds that `_owner` can withdraw.\n */\n function withdrawableFundsOf(address _owner) external view returns (uint256);\n\n /**\n @dev Withdraws all available funds for the calling FDT holder.\n */\n function withdrawFunds() external;\n\n /**\n @dev Returns the amount of funds that an account has withdrawn.\n @param _owner The address of a token holder.\n @return The amount of funds that `_owner` has withdrawn.\n */\n function withdrawnFundsOf(address _owner) external view returns (uint256);\n\n /**\n @dev Returns the amount of funds that an account has earned in total. \n @dev accumulativeFundsOf(_owner) = withdrawableFundsOf(_owner) + withdrawnFundsOf(_owner) \n = (pointsPerShare * balanceOf(_owner) + pointsCorrection[_owner]) / pointsMultiplier \n @param _owner The address of a token holder.\n @return The amount of funds that `_owner` has earned in total.\n */\n function accumulativeFundsOf(address _owner) external view returns (uint256);\n\n /**\n @dev Registers a payment of funds in tokens. \n @dev May be called directly after a deposit is made. \n @dev Calls _updateFundsTokenBalance(), whereby the contract computes the delta of the new and previous \n `fundsToken` balance and increments the total received funds (cumulative), by delta, by calling _distributeFunds().\n */\n function updateFundsReceived() external;\n\n}\n\n////// contracts/core/loan/v1/interfaces/ILoanFDT.sol\n/* pragma solidity 0.6.11; */\n\n/* import { IERC20 } from \"../../../../../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\"; */\n\n/* import { IBasicFDT } from \"../../../funds-distribution-token/v1/interfaces/IBasicFDT.sol\"; */\n\ninterface ILoanFDT is IBasicFDT {\n\n /**\n @dev The `fundsToken` (dividends).\n */\n function fundsToken() external view returns (IERC20);\n\n /**\n @dev The amount of `fundsToken` (Liquidity Asset) currently present and accounted for in this contract.\n */\n function fundsTokenBalance() external view returns (uint256);\n\n /**\n @dev Withdraws all available funds for a token holder.\n */\n function withdrawFunds() external override;\n\n}\n\n////// contracts/core/loan/v1/interfaces/ILoan.sol\n/* pragma solidity 0.6.11; */\n\n/* import { IERC20 } from \"../../../../../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\"; */\n\n/* import { ILoanFDT } from \"./ILoanFDT.sol\"; */\n\ninterface ILoan is ILoanFDT {\n\n /**\n Ready = The Loan has been initialized and is ready for funding (assuming funding period hasn't ended).\n Active = The Loan has been drawdown and the Borrower is making payments.\n Matured = The Loan is fully paid off and has \"matured\".\n Expired = The Loan did not initiate, and all funding was returned to Lenders.\n Liquidated = The Loan has been liquidated.\n */\n enum State { Ready, Active, Matured, Expired, Liquidated }\n\n /**\n @dev Emits an event indicating the Loan was funded.\n @param fundedBy The Pool that funded the Loan.\n @param amountFunded The amount the Loan was funded for.\n */\n event LoanFunded(address indexed fundedBy, uint256 amountFunded);\n\n /**\n @dev Emits an event indicating the balance for an account was updated.\n @param account The address of an account.\n @param token The token address of the asset.\n @param balance The new balance of `token` for `account`.\n */\n event BalanceUpdated(address indexed account, address indexed token, uint256 balance);\n\n /**\n @dev Emits an event indicating the some loaned amount was drawn down.\n @param drawdownAmount The amount that was drawn down.\n */\n event Drawdown(uint256 drawdownAmount);\n\n /**\n @dev Emits an event indicating the state of the Loan changed.\n @param state The state of the Loan.\n */\n event LoanStateChanged(State state);\n\n /**\n @dev Emits an event indicating the an Admin for the Loan was set.\n @param loanAdmin The address of some Loan Admin.\n @param allowed Whether `loanAdmin` is a Loan Admin for this Loan.\n */\n event LoanAdminSet(address indexed loanAdmin, bool allowed);\n\n /**\n @dev Emits an event indicating the a payment was made for the Loan.\n @param totalPaid The total amount paid.\n @param principalPaid The principal portion of the amount paid.\n @param interestPaid The interest portion of the amount paid.\n @param paymentsRemaining The amount of payment remaining.\n @param principalOwed The outstanding principal of the Loan.\n @param nextPaymentDue The timestamp of the due date of the next payment.\n @param latePayment Whether this payment was late.\n */\n event PaymentMade(\n uint256 totalPaid,\n uint256 principalPaid,\n uint256 interestPaid,\n uint256 paymentsRemaining,\n uint256 principalOwed,\n uint256 nextPaymentDue,\n bool latePayment\n );\n\n /**\n @dev Emits an event indicating the the Loan was liquidated.\n @param collateralSwapped The amount of Collateral Asset swapped.\n @param liquidityAssetReturned The amount of Liquidity Asset recovered from swap.\n @param liquidationExcess The amount of Liquidity Asset returned to borrower.\n @param defaultSuffered The remaining losses after the liquidation.\n */\n event Liquidation(\n uint256 collateralSwapped,\n uint256 liquidityAssetReturned,\n uint256 liquidationExcess,\n uint256 defaultSuffered\n );\n\n /**\n @dev The current state of this Loan, as defined in the State enum below.\n */\n function loanState() external view returns (State);\n\n /**\n @dev The asset deposited by Lenders into the FundingLocker, when funding this Loan.\n */\n function liquidityAsset() external view returns (IERC20);\n\n /**\n @dev The asset deposited by Borrower into the CollateralLocker, for collateralizing this Loan.\n */\n function collateralAsset() external view returns (IERC20);\n\n /**\n @dev The FundingLocker that holds custody of Loan funds before drawdown.\n */\n function fundingLocker() external view returns (address);\n\n /**\n @dev The FundingLockerFactory.\n */\n function flFactory() external view returns (address);\n\n /**\n @dev The CollateralLocker that holds custody of Loan collateral.\n */\n function collateralLocker() external view returns (address);\n\n /**\n @dev The CollateralLockerFactory.\n */\n function clFactory() external view returns (address);\n\n /**\n @dev The Borrower of this Loan, responsible for repayments.\n */\n function borrower() external view returns (address);\n\n /**\n @dev The RepaymentCalc for this Loan.\n */\n function repaymentCalc() external view returns (address);\n\n /**\n @dev The LateFeeCalc for this Loan.\n */\n function lateFeeCalc() external view returns (address);\n\n /**\n @dev The PremiumCalc for this Loan.\n */\n function premiumCalc() external view returns (address);\n\n /**\n @dev The LoanFactory that deployed this Loan.\n */\n function superFactory() external view returns (address);\n\n /**\n @param loanAdmin The address of some admin.\n @return Whether the `loanAdmin` has permission to do certain operations in case of disaster management.\n */\n function loanAdmins(address loanAdmin) external view returns (bool);\n\n /**\n @dev The unix timestamp due date of the next payment.\n */\n function nextPaymentDue() external view returns (uint256);\n\n /**\n @dev The APR in basis points.\n */\n function apr() external view returns (uint256);\n\n /**\n @dev The number of payments remaining on the Loan.\n */\n function paymentsRemaining() external view returns (uint256);\n\n /**\n @dev The total length of the Loan term in days.\n */\n function termDays() external view returns (uint256);\n\n /**\n @dev The time between Loan payments in seconds.\n */\n function paymentIntervalSeconds() external view returns (uint256);\n\n /**\n @dev The total requested amount for Loan.\n */\n function requestAmount() external view returns (uint256);\n\n /**\n @dev The percentage of value of the drawdown amount to post as collateral in basis points.\n */\n function collateralRatio() external view returns (uint256);\n\n /**\n @dev The timestamp of when Loan was instantiated.\n */\n function createdAt() external view returns (uint256);\n\n /**\n @dev The time for a Loan to be funded in seconds.\n */\n function fundingPeriod() external view returns (uint256);\n\n /**\n @dev The time a Borrower has, after a payment is due, to make a payment before a liquidation can occur.\n */\n function defaultGracePeriod() external view returns (uint256);\n\n /**\n @dev The amount of principal owed (initially the drawdown amount).\n */\n function principalOwed() external view returns (uint256);\n\n /**\n @dev The amount of principal that has been paid by the Borrower since the Loan instantiation.\n */\n function principalPaid() external view returns (uint256);\n\n /**\n @dev The amount of interest that has been paid by the Borrower since the Loan instantiation.\n */\n function interestPaid() external view returns (uint256);\n\n /**\n @dev The amount of fees that have been paid by the Borrower since the Loan instantiation.\n */\n function feePaid() external view returns (uint256);\n\n /**\n @dev The amount of excess that has been returned to the Lenders after the Loan drawdown.\n */\n function excessReturned() external view returns (uint256);\n\n /**\n @dev The amount of Collateral Asset that has been liquidated after default.\n */\n function amountLiquidated() external view returns (uint256);\n\n /**\n @dev The amount of Liquidity Asset that has been recovered after default.\n */\n function amountRecovered() external view returns (uint256);\n\n /**\n @dev The difference between `amountRecovered` and `principalOwed` after liquidation.\n */\n function defaultSuffered() external view returns (uint256);\n\n /**\n @dev The amount of Liquidity Asset that is to be returned to the Borrower, if `amountRecovered > principalOwed`.\n */\n function liquidationExcess() external view returns (uint256);\n\n /**\n @dev Draws down funding from FundingLocker, posts collateral, and transitions the Loan state from `Ready` to `Active`. \n @dev Only the Borrower can call this function. \n @dev It emits four `BalanceUpdated` events. \n @dev It emits a `LoanStateChanged` event. \n @dev It emits a `Drawdown` event. \n @param amt the amount of Liquidity Asset the Borrower draws down. Remainder is returned to the Loan where it can be claimed back by LoanFDT holders.\n */\n function drawdown(uint256 amt) external;\n\n /**\n @dev Makes a payment for this Loan. \n @dev Amounts are calculated for the Borrower. \n */\n function makePayment() external;\n\n /**\n @dev Makes the full payment for this Loan (a.k.a. \"calling\" the Loan). \n @dev This requires the Borrower to pay a premium fee. \n */\n function makeFullPayment() external;\n \n /**\n @dev Funds this Loan and mints LoanFDTs for `mintTo` (DebtLocker in the case of Pool funding). \n @dev Only LiquidityLocker using valid/approved Pool can call this function. \n @dev It emits a `LoanFunded` event. \n @dev It emits a `BalanceUpdated` event. \n @param mintTo The address that LoanFDTs are minted to.\n @param amt The amount to fund the Loan.\n */\n function fundLoan(address mintTo, uint256 amt) external;\n\n /**\n @dev Handles returning capital to the Loan, where it can be claimed back by LoanFDT holders, \n if the Borrower has not drawn down on the Loan past the drawdown grace period. \n @dev It emits a `LoanStateChanged` event. \n */\n function unwind() external;\n\n /**\n @dev Triggers a default if the Loan meets certain default conditions, liquidating all collateral and updating accounting. \n @dev Only the an account with sufficient LoanFDTs of this Loan can call this function. \n @dev It emits a `BalanceUpdated` event. \n @dev It emits a `Liquidation` event. \n @dev It emits a `LoanStateChanged` event. \n */\n function triggerDefault() external;\n\n /**\n @dev Triggers paused state. \n @dev Halts functionality for certain functions. Only the Borrower or a Loan Admin can call this function. \n */\n function pause() external;\n\n /**\n @dev Triggers unpaused state. \n @dev Restores functionality for certain functions. \n @dev Only the Borrower or a Loan Admin can call this function. \n */\n function unpause() external;\n\n /**\n @dev Sets a Loan Admin. \n @dev Only the Borrower can call this function. \n @dev It emits a `LoanAdminSet` event. \n @param loanAdmin The address being allowed or disallowed as a Loan Admin.\n @param allowed The atatus of a Loan Admin.\n */\n function setLoanAdmin(address loanAdmin, bool allowed) external;\n\n /**\n @dev Transfers any locked funds to the Governor. \n @dev Only the Governor can call this function. \n @param token The address of the token to be reclaimed.\n */\n function reclaimERC20(address token) external;\n\n /**\n @dev Withdraws all available funds earned through LoanFDT for a token holder. \n @dev It emits a `BalanceUpdated` event. \n */\n function withdrawFunds() external override;\n\n /**\n @dev Returns the expected amount of Liquidity Asset to be recovered from a liquidation based on current oracle prices.\n @return The minimum amount of Liquidity Asset that can be expected by swapping Collateral Asset.\n */\n function getExpectedAmountRecovered() external view returns (uint256);\n\n /**\n @dev Returns information of the next payment amount.\n @return The entitled interest of the next payment (Principal + Interest only when the next payment is last payment of the Loan).\n @return The entitled principal amount needed to be paid in the next payment.\n @return The entitled interest amount needed to be paid in the next payment.\n @return The payment due date.\n @return Whether the payment is late.\n */\n function getNextPayment() external view returns (uint256, uint256, uint256, uint256, bool);\n\n /**\n @dev Returns the information of a full payment amount.\n @return total Principal and interest owed, combined.\n @return principal Principal owed.\n @return interest Interest owed.\n */\n function getFullPayment() external view returns (uint256 total, uint256 principal, uint256 interest);\n\n /**\n @dev Calculates the collateral required to draw down amount.\n @param amt The amount of the Liquidity Asset to draw down from the FundingLocker.\n @return The amount of the Collateral Asset required to post in the CollateralLocker for a given drawdown amount.\n */\n function collateralRequiredForDrawdown(uint256 amt) external view returns (uint256);\n\n}\n\n////// contracts/core/premium-calculator/v1/interfaces/IPremiumCalc.sol\n/* pragma solidity 0.6.11; */\n\n/* import { ICalc } from \"../../../calculator/v1/interfaces/ICalc.sol\"; */\n\n/// @title PremiumCalc calculates premium fees on Loans.\ninterface IPremiumCalc is ICalc {\n\n /**\n @dev The flat percentage fee (in basis points) of principal to charge as a premium when calling a Loan.\n */\n function premiumFee() external view returns (uint256);\n\n /**\n @dev Calculates the premium payment for a Loan, when making a full payment.\n @param _loan The address of a Loan to calculate a premium payment for.\n @return total The principal + interest.\n @return principalOwed The principal.\n @return interest The interest.\n */\n function getPremiumPayment(address _loan) external view returns (uint256 total, uint256 principalOwed, uint256 interest);\n\n}\n\n////// lib/openzeppelin-contracts/contracts/math/SafeMath.sol\n/* pragma solidity >=0.6.0 <0.8.0; */\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return mod(a, b, \"SafeMath: modulo by zero\");\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts with custom message when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b != 0, errorMessage);\n return a % b;\n }\n}\n\n////// contracts/core/premium-calculator/v1/PremiumCalc.sol\n/* pragma solidity 0.6.11; */\n\n/* import { SafeMath } from \"../../../../lib/openzeppelin-contracts/contracts/math/SafeMath.sol\"; */\n\n/* import { ILoan } from \"../../loan/v1/interfaces/ILoan.sol\"; */\n\n/* import { IPremiumCalc } from \"./interfaces/IPremiumCalc.sol\"; */\n\n/// @title PremiumCalc calculates premium fees on Loans.\ncontract PremiumCalc is IPremiumCalc {\n\n using SafeMath for uint256;\n\n uint8 public override constant calcType = 12; // PREMIUM type.\n bytes32 public override constant name = \"FLAT\";\n\n uint256 public override immutable premiumFee;\n\n constructor(uint256 _premiumFee) public {\n premiumFee = _premiumFee;\n }\n\n function getPremiumPayment(address _loan) external override view returns (uint256 total, uint256 principalOwed, uint256 interest) {\n principalOwed = ILoan(_loan).principalOwed();\n interest = principalOwed.mul(premiumFee).div(10_000);\n total = interest.add(principalOwed);\n }\n\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers"
],
"": [
"ast"
]
}
}
}
},
"output": {
"contracts": {
"contracts/core/premium-calculator/v1/PremiumCalc.sol": {
"IBasicFDT": {
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "by",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "fundsDistributed",
"type": "uint256"
}
],
"name": "FundsDistributed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "by",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "fundsWithdrawn",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "totalWithdrawn",
"type": "uint256"
}
],
"name": "FundsWithdrawn",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "",
"type": "address"
},
{
"indexed": false,
"internalType": "int256",
"name": "",
"type": "int256"
}
],
"name": "PointsCorrectionUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "PointsPerShareUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "_owner",
"type": "address"
}
],
"name": "accumulativeFundsOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "updateFundsReceived",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "withdrawFunds",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_owner",
"type": "address"
}
],
"name": "withdrawableFundsOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_owner",
"type": "address"
}
],
"name": "withdrawnFundsOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
],
"evm": {
"bytecode": {
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"methodIdentifiers": {
"accumulativeFundsOf(address)": "4e97415f",
"allowance(address,address)": "dd62ed3e",
"approve(address,uint256)": "095ea7b3",
"balanceOf(address)": "70a08231",
"totalSupply()": "18160ddd",
"transfer(address,uint256)": "a9059cbb",
"transferFrom(address,address,uint256)": "23b872dd",
"updateFundsReceived()": "46c162de",
"withdrawFunds()": "24600fc3",
"withdrawableFundsOf(address)": "443bb293",
"withdrawnFundsOf(address)": "0041c52c"
}
}
},
"ICalc": {
"abi": [
{
"inputs": [],
"name": "calcType",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "pure",
"type": "function"
}
],
"evm": {
"bytecode": {
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"methodIdentifiers": {
"calcType()": "9d8ae446",
"name()": "06fdde03"
}
}
},
"IERC20": {
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
],
"evm": {
"bytecode": {
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"methodIdentifiers": {
"allowance(address,address)": "dd62ed3e",
"approve(address,uint256)": "095ea7b3",
"balanceOf(address)": "70a08231",
"totalSupply()": "18160ddd",
"transfer(address,uint256)": "a9059cbb",
"transferFrom(address,address,uint256)": "23b872dd"
}
}
},
"ILoan": {
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "balance",
"type": "uint256"
}
],
"name": "BalanceUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "drawdownAmount",
"type": "uint256"
}
],
"name": "Drawdown",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "by",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "fundsDistributed",
"type": "uint256"
}
],
"name": "FundsDistributed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{