Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
NftLogic
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 200 runs
Other Settings:
istanbul EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.8.4; import {Errors} from "../helpers/Errors.sol"; import {DataTypes} from "../types/DataTypes.sol"; /** * @title NftLogic library * @author BendDao; Forked and edited by Unlockd * @notice Implements the logic to update the nft state */ library NftLogic { /** * @dev Initializes a nft * @param nft The nft object * @param uNftAddress The address of the uNFT contract **/ function init(DataTypes.NftData storage nft, address uNftAddress) external { require(nft.uNftAddress == address(0), Errors.RL_RESERVE_ALREADY_INITIALIZED); nft.uNftAddress = uNftAddress; } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.8.4; /** * @title Errors library * @author BendDao; Forked and edited by Unlockd * @notice Defines the error messages emitted by the different contracts of the Unlockd protocol */ library Errors { enum ReturnCode { SUCCESS, FAILED } string public constant SUCCESS = "0"; //common errors string public constant CALLER_NOT_POOL_ADMIN = "100"; // 'The caller must be the pool admin' string public constant CALLER_NOT_ADDRESS_PROVIDER = "101"; string public constant INVALID_FROM_BALANCE_AFTER_TRANSFER = "102"; string public constant INVALID_TO_BALANCE_AFTER_TRANSFER = "103"; string public constant CALLER_NOT_ONBEHALFOF_OR_IN_WHITELIST = "104"; string public constant CALLER_NOT_POOL_LIQUIDATOR = "105"; string public constant INVALID_ZERO_ADDRESS = "106"; string public constant CALLER_NOT_LTV_MANAGER = "107"; string public constant CALLER_NOT_PRICE_MANAGER = "108"; string public constant CALLER_NOT_UTOKEN_MANAGER = "109"; //math library errors string public constant MATH_MULTIPLICATION_OVERFLOW = "200"; string public constant MATH_ADDITION_OVERFLOW = "201"; string public constant MATH_DIVISION_BY_ZERO = "202"; //validation & check errors string public constant VL_INVALID_AMOUNT = "301"; // 'Amount must be greater than 0' string public constant VL_NO_ACTIVE_RESERVE = "302"; // 'Action requires an active reserve' string public constant VL_RESERVE_FROZEN = "303"; // 'Action cannot be performed because the reserve is frozen' string public constant VL_NOT_ENOUGH_AVAILABLE_USER_BALANCE = "304"; // 'User cannot withdraw more than the available balance' string public constant VL_BORROWING_NOT_ENABLED = "305"; // 'Borrowing is not enabled' string public constant VL_COLLATERAL_BALANCE_IS_0 = "306"; // 'The collateral balance is 0' string public constant VL_HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD = "307"; // 'Health factor is lesser than the liquidation threshold' string public constant VL_COLLATERAL_CANNOT_COVER_NEW_BORROW = "308"; // 'There is not enough collateral to cover a new borrow' string public constant VL_NO_DEBT_OF_SELECTED_TYPE = "309"; // 'for repayment of stable debt, the user needs to have stable debt, otherwise, he needs to have variable debt' string public constant VL_NO_ACTIVE_NFT = "310"; string public constant VL_NFT_FROZEN = "311"; string public constant VL_SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = "312"; // 'User did not borrow the specified currency' string public constant VL_INVALID_HEALTH_FACTOR = "313"; string public constant VL_INVALID_ONBEHALFOF_ADDRESS = "314"; string public constant VL_INVALID_TARGET_ADDRESS = "315"; string public constant VL_INVALID_RESERVE_ADDRESS = "316"; string public constant VL_SPECIFIED_LOAN_NOT_BORROWED_BY_USER = "317"; string public constant VL_SPECIFIED_RESERVE_NOT_BORROWED_BY_USER = "318"; string public constant VL_HEALTH_FACTOR_HIGHER_THAN_LIQUIDATION_THRESHOLD = "319"; string public constant VL_TIMEFRAME_EXCEEDED = "320"; string public constant VL_VALUE_EXCEED_TREASURY_BALANCE = "321"; //lend pool errors string public constant LP_CALLER_NOT_LEND_POOL_CONFIGURATOR = "400"; // 'The caller of the function is not the lending pool configurator' string public constant LP_IS_PAUSED = "401"; // 'Pool is paused' string public constant LP_NO_MORE_RESERVES_ALLOWED = "402"; string public constant LP_NOT_CONTRACT = "403"; string public constant LP_BORROW_NOT_EXCEED_LIQUIDATION_THRESHOLD = "404"; string public constant LP_BORROW_IS_EXCEED_LIQUIDATION_PRICE = "405"; string public constant LP_NO_MORE_NFTS_ALLOWED = "406"; string public constant LP_INVALID_USER_NFT_AMOUNT = "407"; string public constant LP_INCONSISTENT_PARAMS = "408"; string public constant LP_NFT_IS_NOT_USED_AS_COLLATERAL = "409"; string public constant LP_CALLER_MUST_BE_AN_UTOKEN = "410"; string public constant LP_INVALID_NFT_AMOUNT = "411"; string public constant LP_NFT_HAS_USED_AS_COLLATERAL = "412"; string public constant LP_DELEGATE_CALL_FAILED = "413"; string public constant LP_AMOUNT_LESS_THAN_EXTRA_DEBT = "414"; string public constant LP_AMOUNT_LESS_THAN_REDEEM_THRESHOLD = "415"; string public constant LP_AMOUNT_GREATER_THAN_MAX_REPAY = "416"; string public constant LP_NFT_TOKEN_ID_EXCEED_MAX_LIMIT = "417"; string public constant LP_NFT_SUPPLY_NUM_EXCEED_MAX_LIMIT = "418"; string public constant LP_CALLER_NOT_LEND_POOL_LIQUIDATOR_NOR_GATEWAY = "419"; string public constant LP_CONSECUTIVE_BIDS_NOT_ALLOWED = "420"; string public constant LP_INVALID_OVERFLOW_VALUE = "421"; string public constant LP_CALLER_NOT_NFT_HOLDER = "422"; string public constant LP_NFT_NOT_ALLOWED_TO_SELL = "423"; string public constant LP_RESERVES_WITHOUT_ENOUGH_LIQUIDITY = "424"; string public constant LP_COLLECTION_NOT_SUPPORTED = "425"; string public constant LP_MSG_VALUE_DIFFERENT_FROM_CONFIG_FEE = "426"; string public constant LP_INVALID_SAFE_HEALTH_FACTOR = "427"; string public constant LP_AMOUNT_LESS_THAN_DEBT = "428"; string public constant LP_AMOUNT_DIFFERENT_FROM_REQUIRED_BUYOUT_PRICE = "429"; string public constant LP_CALLER_NOT_DEBT_TOKEN_MANAGER = "430"; string public constant LP_CALLER_NOT_RESERVOIR_OR_DEBT_MARKET = "431"; string public constant LP_AMOUNT_LESS_THAN_BUYOUT_PRICE = "432"; //lend pool loan errors string public constant LPL_CLAIM_HASNT_STARTED_YET = "479"; string public constant LPL_INVALID_LOAN_STATE = "480"; string public constant LPL_INVALID_LOAN_AMOUNT = "481"; string public constant LPL_INVALID_TAKEN_AMOUNT = "482"; string public constant LPL_AMOUNT_OVERFLOW = "483"; string public constant LPL_BID_PRICE_LESS_THAN_DEBT_PRICE = "484"; string public constant LPL_BID_PRICE_LESS_THAN_HIGHEST_PRICE = "485"; string public constant LPL_BID_REDEEM_DURATION_HAS_END = "486"; string public constant LPL_BID_USER_NOT_SAME = "487"; string public constant LPL_BID_REPAY_AMOUNT_NOT_ENOUGH = "488"; string public constant LPL_BID_AUCTION_DURATION_HAS_END = "489"; string public constant LPL_BID_AUCTION_DURATION_NOT_END = "490"; string public constant LPL_BID_PRICE_LESS_THAN_BORROW = "491"; string public constant LPL_INVALID_BIDDER_ADDRESS = "492"; string public constant LPL_AMOUNT_LESS_THAN_BID_FINE = "493"; string public constant LPL_INVALID_BID_FINE = "494"; string public constant LPL_BID_PRICE_LESS_THAN_MIN_BID_REQUIRED = "495"; string public constant LPL_BID_NOT_BUYOUT_PRICE = "496"; string public constant LPL_BUYOUT_DURATION_HAS_END = "497"; string public constant LPL_BUYOUT_PRICE_LESS_THAN_BORROW = "498"; string public constant LPL_CALLER_MUST_BE_MARKET_ADAPTER = "499"; //common token errors string public constant CT_CALLER_MUST_BE_LEND_POOL = "500"; // 'The caller of this function must be a lending pool' string public constant CT_INVALID_MINT_AMOUNT = "501"; //invalid amount to mint string public constant CT_INVALID_BURN_AMOUNT = "502"; //invalid amount to burn string public constant CT_BORROW_ALLOWANCE_NOT_ENOUGH = "503"; string public constant CT_CALLER_MUST_BE_DEBT_MARKET = "504"; // 'The caller of this function must be a debt market' //reserve logic errors string public constant RL_RESERVE_ALREADY_INITIALIZED = "601"; // 'Reserve has already been initialized' string public constant RL_LIQUIDITY_INDEX_OVERFLOW = "602"; // Liquidity index overflows uint128 string public constant RL_VARIABLE_BORROW_INDEX_OVERFLOW = "603"; // Variable borrow index overflows uint128 string public constant RL_LIQUIDITY_RATE_OVERFLOW = "604"; // Liquidity rate overflows uint128 string public constant RL_VARIABLE_BORROW_RATE_OVERFLOW = "605"; // Variable borrow rate overflows uint128 //configure errors string public constant LPC_RESERVE_LIQUIDITY_NOT_0 = "700"; // 'The liquidity of the reserve needs to be 0' string public constant LPC_INVALID_CONFIGURATION = "701"; // 'Invalid risk parameters for the reserve' string public constant LPC_CALLER_NOT_EMERGENCY_ADMIN = "702"; // 'The caller must be the emergency admin' string public constant LPC_INVALID_UNFT_ADDRESS = "703"; string public constant LPC_INVALIED_LOAN_ADDRESS = "704"; string public constant LPC_NFT_LIQUIDITY_NOT_0 = "705"; string public constant LPC_PARAMS_MISMATCH = "706"; // NFT assets & token ids mismatch string public constant LPC_FEE_PERCENTAGE_TOO_HIGH = "707"; string public constant LPC_INVALID_LTVMANAGER_ADDRESS = "708"; string public constant LPC_INCONSISTENT_PARAMS = "709"; string public constant LPC_INVALID_SAFE_HEALTH_FACTOR = "710"; //reserve config errors string public constant RC_INVALID_LTV = "730"; string public constant RC_INVALID_LIQ_THRESHOLD = "731"; string public constant RC_INVALID_LIQ_BONUS = "732"; string public constant RC_INVALID_DECIMALS = "733"; string public constant RC_INVALID_RESERVE_FACTOR = "734"; string public constant RC_INVALID_REDEEM_DURATION = "735"; string public constant RC_INVALID_AUCTION_DURATION = "736"; string public constant RC_INVALID_REDEEM_FINE = "737"; string public constant RC_INVALID_REDEEM_THRESHOLD = "738"; string public constant RC_INVALID_MIN_BID_FINE = "739"; string public constant RC_INVALID_MAX_BID_FINE = "740"; string public constant RC_INVALID_MAX_CONFIG_TIMESTAMP = "741"; //address provider erros string public constant LPAPR_PROVIDER_NOT_REGISTERED = "760"; // 'Provider is not registered' string public constant LPAPR_INVALID_ADDRESSES_PROVIDER_ID = "761"; //NFTOracleErrors string public constant NFTO_INVALID_PRICEM_ADDRESS = "900"; //Debt Market string public constant DM_CALLER_NOT_THE_OWNER = "1000"; string public constant DM_DEBT_SHOULD_EXIST = "1001"; string public constant DM_INVALID_AMOUNT = "1002"; string public constant DM_FAIL_ON_SEND_ETH = "1003"; string public constant DM_DEBT_SHOULD_NOT_BE_SOLD = "1004"; string public constant DM_DEBT_ALREADY_EXIST = "1005"; string public constant DM_LOAN_SHOULD_EXIST = "1006"; string public constant DM_AUCTION_ALREADY_ENDED = "1007"; string public constant DM_BID_PRICE_HIGHER_THAN_SELL_PRICE = "1008"; string public constant DM_BID_PRICE_LESS_THAN_PREVIOUS_BID = "1009"; string public constant DM_INVALID_SELL_TYPE = "1010"; string public constant DM_AUCTION_NOT_ALREADY_ENDED = "1011"; string public constant DM_INVALID_CLAIM_RECEIVER = "1012"; string public constant DM_AMOUNT_DIFFERENT_FROM_SELL_PRICE = "1013"; string public constant DM_BID_PRICE_LESS_THAN_MIN_BID_PRICE = "1014"; string public constant DM_BORROWED_AMOUNT_DIVERGED = "1015"; string public constant DM_INVALID_AUTHORIZED_ADDRESS = "1016"; string public constant DM_CALLER_NOT_THE_OWNER_OR_AUTHORIZED = "1017"; string public constant DM_INVALID_DELTA_BID_PERCENT = "1018"; string public constant DM_IS_PAUSED = "1019"; }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.8.4; library DataTypes { struct ReserveData { //stores the reserve configuration ReserveConfigurationMap configuration; //the liquidity index. Expressed in ray uint128 liquidityIndex; //variable borrow index. Expressed in ray uint128 variableBorrowIndex; //the current supply rate. Expressed in ray uint128 currentLiquidityRate; //the current variable borrow rate. Expressed in ray uint128 currentVariableBorrowRate; uint40 lastUpdateTimestamp; //tokens addresses address uTokenAddress; address debtTokenAddress; //address of the interest rate strategy address interestRateAddress; //the id of the reserve. Represents the position in the list of the active reserves uint8 id; } struct NftData { //stores the nft configuration NftConfigurationMap configuration; //address of the uNFT contract address uNftAddress; //the id of the nft. Represents the position in the list of the active nfts uint8 id; uint256 maxSupply; uint256 maxTokenId; } struct ReserveConfigurationMap { //bit 0-15: LTV //bit 16-31: Liq. threshold //bit 32-47: Liq. bonus //bit 48-55: Decimals //bit 56: Reserve is active //bit 57: reserve is frozen //bit 58: borrowing is enabled //bit 59: stable rate borrowing enabled //bit 60-63: reserved //bit 64-79: reserve factor uint256 data; } struct NftConfigurationMap { //bit 0-15: LTV //bit 16-31: Liq. threshold //bit 32-47: Liq. bonus //bit 56: NFT is active //bit 57: NFT is frozen //bit 64-71: Redeem duration //bit 72-79: Auction duration //bit 80-95: Redeem fine //bit 96-111: Redeem threshold //bit 112-127: Min bid fine //bit 128-159: Timestamp Config uint256 data; } /** * @dev Enum describing the current state of a loan * State change flow: * Created -> Active -> Repaid * -> Auction -> Defaulted */ enum LoanState { // We need a default that is not 'Created' - this is the zero value None, // The loan data is stored, but not initiated yet. Created, // The loan has been initialized, funds have been delivered to the borrower and the collateral is held. Active, // The loan is in auction, higest price liquidator will got chance to claim it. Auction, // The loan has been repaid, and the collateral has been returned to the borrower. This is a terminal state. Repaid, // The loan was delinquent and collateral claimed by the liquidator. This is a terminal state. Defaulted } struct LoanData { //the id of the nft loan uint256 loanId; //the current state of the loan LoanState state; //address of borrower address borrower; //address of nft asset token address nftAsset; //the id of nft token uint256 nftTokenId; //address of reserve asset token address reserveAsset; //scaled borrow amount. Expressed in ray uint256 scaledAmount; //start time of first bid time uint256 bidStartTimestamp; //bidder address of higest bid address bidderAddress; //price of higest bid uint256 bidPrice; //borrow amount of loan uint256 bidBorrowAmount; //bidder address of first bid address firstBidderAddress; } struct ExecuteDepositParams { address initiator; address asset; uint256 amount; address onBehalfOf; uint16 referralCode; } struct ExecuteWithdrawParams { address initiator; address asset; uint256 amount; address to; } struct ExecuteBorrowParams { address initiator; address asset; uint256 amount; address nftAsset; uint256 nftTokenId; address onBehalfOf; uint16 referralCode; } struct ExecuteRepayParams { address initiator; address nftAsset; uint256 nftTokenId; uint256 amount; } struct ExecuteAuctionParams { address initiator; address nftAsset; uint256 nftTokenId; uint256 bidPrice; address onBehalfOf; uint256 auctionDurationConfigFee; uint256 bidDelta; } struct ExecuteRedeemParams { address initiator; address nftAsset; uint256 nftTokenId; uint256 amount; uint256 bidFine; uint256 safeHealthFactor; } struct ExecuteLiquidateParams { address initiator; address nftAsset; uint256 nftTokenId; uint256 amount; } struct ExecuteBuyoutParams { address initiator; address nftAsset; uint256 nftTokenId; address onBehalfOf; } struct ExecuteLiquidateMarketsParams { address nftAsset; uint256 nftTokenId; uint256 liquidateFeePercentage; uint256 amountOutMin; } struct ExecuteLendPoolStates { uint256 pauseStartTime; uint256 pauseDurationTime; } struct ExecuteYearnParams { address underlyingAsset; uint256 amount; } enum DebtMarketType { FixedPrice, //0 Auction, //1 Mixed //2 } enum DebtMarketState { //No bids New, //Exist bids Active, //Is sold Sold, Canceled } struct DebtMarketListing { uint256 debtId; address debtor; address nftAsset; uint256 tokenId; DebtMarketType sellType; DebtMarketState state; uint256 sellPrice; address reserveAsset; uint256 scaledAmount; address bidderAddress; uint256 bidPrice; uint256 auctionEndTimestamp; uint256 startBiddingPrice; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "istanbul", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract Creation Code
61019561003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100355760003560e01c8063e33de0081461003a575b600080fd5b81801561004657600080fd5b5061005a6100553660046100d2565b61005c565b005b600182015460408051808201909152600381526236303160e81b6020820152906001600160a01b0316156100ac5760405162461bcd60e51b81526004016100a3919061010c565b60405180910390fd5b5060019190910180546001600160a01b0319166001600160a01b03909216919091179055565b600080604083850312156100e4578182fd5b8235915060208301356001600160a01b0381168114610101578182fd5b809150509250929050565b6000602080835283518082850152825b818110156101385785810183015185820160400152820161011c565b818111156101495783604083870101525b50601f01601f191692909201604001939250505056fea2646970667358221220576c00c234a70f1562aff82fca7be05415f8a2f1a624c97a68c0ad5f3110e58c64736f6c63430008040033
Deployed Bytecode
0x7324517212c4c7eb68f285bf126f8aef17d65e80d230146080604052600436106100355760003560e01c8063e33de0081461003a575b600080fd5b81801561004657600080fd5b5061005a6100553660046100d2565b61005c565b005b600182015460408051808201909152600381526236303160e81b6020820152906001600160a01b0316156100ac5760405162461bcd60e51b81526004016100a3919061010c565b60405180910390fd5b5060019190910180546001600160a01b0319166001600160a01b03909216919091179055565b600080604083850312156100e4578182fd5b8235915060208301356001600160a01b0381168114610101578182fd5b809150509250929050565b6000602080835283518082850152825b818110156101385785810183015185820160400152820161011c565b818111156101495783604083870101525b50601f01601f191692909201604001939250505056fea2646970667358221220576c00c234a70f1562aff82fca7be05415f8a2f1a624c97a68c0ad5f3110e58c64736f6c63430008040033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.