Skip to main content

CreditIssuer

CreditIssuer

Issue Credit to network members and store/manage credit periods.

This contract is intended to be extended by a parent contract that implements custom credit terms and underwriting logic.

Methods

__CreditIssuer_init

function __CreditIssuer_init(address _stableCredit) external nonpayable

initializes the stable credit address to issue credit for.

should be called directly after deployment (see OpenZeppelin upgradeable standards).

Parameters

NameTypeDescription
_stableCreditaddressaddress of stable credit contract to issue credit for.

creditPeriods

function creditPeriods(address) external view returns (uint256 issuedAt, uint256 expiration, uint256 graceLength, bool paused)

Parameters

NameTypeDescription
_0addressundefined

Returns

NameTypeDescription
issuedAtuint256undefined
expirationuint256undefined
graceLengthuint256undefined
pausedboolundefined

graceExpirationOf

function graceExpirationOf(address member) external view returns (uint256)

fetches a given member's credit grace period expiration timestamp.

Parameters

NameTypeDescription
memberaddressaddress of member.

Returns

NameTypeDescription
_0uint256expiration timestamp of member's credit grace period.

inActivePeriod

function inActivePeriod(address member) external view returns (bool)

returns whether a given member is in an active period.

Parameters

NameTypeDescription
memberaddressaddress of member.

Returns

NameTypeDescription
_0boolwhether member is in an active credit period.

inCompliance

function inCompliance(address member) external view returns (bool)

returns whether a given member is in compliance with credit terms.

intended to be overwritten in parent implementation to include custom compliance logic.

Parameters

NameTypeDescription
memberaddressaddress of member.

Returns

NameTypeDescription
_0boolwhether member is in compliance with credit terms.

inDefault

function inDefault(address member) external view returns (bool)

returns whether a given member is in default.

returns true if period has expired, grace period has expired, and member is not compliant.

Parameters

NameTypeDescription
memberaddressaddress of member.

Returns

NameTypeDescription
_0boolwhether member is in default.

inExpiredPeriod

function inExpiredPeriod(address member) external view returns (bool)

returns whether a given member's credit period has expired.

Parameters

NameTypeDescription
memberaddressaddress of member.

Returns

NameTypeDescription
_0boolwhether member's credit period has expired.

inGracePeriod

function inGracePeriod(address member) external view returns (bool)

returns whether a given member is in an active grace period.

Parameters

NameTypeDescription
memberaddressaddress of member.

Returns

NameTypeDescription
_0boolwhether member is in an active grace period.

inInitializedPeriod

function inInitializedPeriod(address member) external view returns (bool)

returns whether a given member's credit period is initialized.

Parameters

NameTypeDescription
memberaddressaddress of member.

Returns

NameTypeDescription
_0boolwhether member's credit period is initialized.

initializeCreditLine

function initializeCreditLine(address member, uint256 limit, uint256 initialBalance, uint256 periodLength, uint256 graceLength) external nonpayable

enables authorized address recipient manually initialize a member's credit line with provided credit terms.

by default the caller must have operator authorization. Child implementations should employ authorization logic that is appropriate for the given use case.

Parameters

NameTypeDescription
memberaddressaddress of member to initialize credit line for.
limituint256credit limit of credit line.
initialBalanceuint256initial balance of member.
periodLengthuint256length of credit period.
graceLengthuint256length of grace period.

isFrozen

function isFrozen(address member) external view returns (bool)

returns whether a given member's credit line is frozen.

returns true if member is in grace period and not compliant.

Parameters

NameTypeDescription
memberaddressaddress of member.

Returns

NameTypeDescription
_0boolwhether member's credit line is frozen.

owner

function owner() external view returns (address)

Returns the address of the current owner.

Returns

NameTypeDescription
_0addressundefined

pausePeriodOf

function pausePeriodOf(address member) external nonpayable

enables network operators to pause a given member's credit period.

by default the caller must have operator authorization. Child implementations should employ authorization logic that is appropriate for the given use case.

Parameters

NameTypeDescription
memberaddressaddress of member to pause terms for.

paused

function paused() external view returns (bool)

Returns true if the contract is paused, and false otherwise.

Returns

NameTypeDescription
_0boolundefined

periodExpirationOf

function periodExpirationOf(address member) external view returns (uint256)

fetches a given member's credit period expiration timestamp.

Parameters

NameTypeDescription
memberaddressaddress of member.

Returns

NameTypeDescription
_0uint256expiration timestamp of member's credit period.

renounceOwnership

function renounceOwnership() external nonpayable

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.

setGraceLengthOf

function setGraceLengthOf(address member, uint256 graceLength) external nonpayable

called by network operators to set the grace period length.

by default the caller must have operator authorization. Child implementations should employ authorization logic that is appropriate for the given use case.

Parameters

NameTypeDescription
memberaddressaddress of member to set grace period for.
graceLengthuint256length of grace period.

setPeriodExpirationOf

function setPeriodExpirationOf(address member, uint256 periodExpiration) external nonpayable

called by network operators to set the credit period length.

by default the caller must have operator authorization. Child implementations should employ authorization logic that is appropriate for the given use case.

Parameters

NameTypeDescription
memberaddressaddress of member to set period expiration for.
periodExpirationuint256expiration timestamp of credit period.

stableCredit

function stableCredit() external view returns (contract IStableCredit)

Returns

NameTypeDescription
_0contract IStableCreditundefined

syncCreditPeriod

function syncCreditPeriod(address member) external nonpayable returns (bool)

syncs the credit period state and returns validation status.

this function is intended to be called after credit expiration to ensure that defaulted debt is written off as lost debt.

Parameters

NameTypeDescription
memberaddressaddress of member to sync credit line for.

Returns

NameTypeDescription
_0booltransaction validation result.

transferOwnership

function transferOwnership(address newOwner) external nonpayable

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Parameters

NameTypeDescription
newOwneraddressundefined

underwriteMember

function underwriteMember(address member) external nonpayable

called by network authorized to issue credit.

intended to be overwritten in parent implementation to include custom underwriting logic.

Parameters

NameTypeDescription
memberaddressaddress of member.

unpausePeriodOf

function unpausePeriodOf(address member) external nonpayable

enables network operators to unpause a given member's credit period.

by default the caller must have operator authorization. Child implementations should employ authorization logic that is appropriate for the given use case.

Parameters

NameTypeDescription
memberaddressaddress of member to unpause period for.

updateCreditPeriod

function updateCreditPeriod(address member, uint256 periodExpiration, uint256 graceLength) external nonpayable

responsible for initializing the given member's credit period.

by default the caller must have operator authorization. Child implementations should employ authorization logic that is appropriate for the given use case.

Parameters

NameTypeDescription
memberaddressaddress of member to initialize credit period for.
periodExpirationuint256expiration timestamp of credit period.
graceLengthuint256length of grace period.

validateCreditTransaction

function validateCreditTransaction(address sender, address recipient, uint256 amount) external nonpayable returns (bool)

called by the StableCredit contract when members transfer credits.

Parameters

NameTypeDescription
senderaddresssender address of stable credit transaction.
recipientaddressrecipient address of stable credit transaction.
amountuint256of credits in transaction.

Returns

NameTypeDescription
_0booltransaction validation result.

Events

CreditLineDefaulted

event CreditLineDefaulted(address member)

Parameters

NameTypeDescription
memberaddressundefined

CreditPeriodCreated

event CreditPeriodCreated(address member, uint256 periodExpiration, uint256 graceLength)

Parameters

NameTypeDescription
memberaddressundefined
periodExpirationuint256undefined
graceLengthuint256undefined

CreditPeriodExpired

event CreditPeriodExpired(address member)

Parameters

NameTypeDescription
memberaddressundefined

CreditTermsPaused

event CreditTermsPaused(address member)

Parameters

NameTypeDescription
memberaddressundefined

CreditTermsUnpaused

event CreditTermsUnpaused(address member)

Parameters

NameTypeDescription
memberaddressundefined

GraceLengthUpdated

event GraceLengthUpdated(address member, uint256 graceLength)

Parameters

NameTypeDescription
memberaddressundefined
graceLengthuint256undefined

Initialized

event Initialized(uint8 version)

Parameters

NameTypeDescription
versionuint8undefined

OwnershipTransferred

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Parameters

NameTypeDescription
previousOwner indexedaddressundefined
newOwner indexedaddressundefined

Paused

event Paused(address account)

Parameters

NameTypeDescription
accountaddressundefined

Unpaused

event Unpaused(address account)

Parameters

NameTypeDescription
accountaddressundefined