PWN LOAN
Last updated
Last updated
PWN LOAN is a PWN contextual extension of a standard token. Each LOAN is defined as an ERC-1155 NFT. The PWN LOAN contract allows for reading the contextual information of the loans (like status, expirations, etc.) but all of its contract features can only be called through the contract.
Deployment addresses
Mainnet:
Polygon:
Görli:
Mumbai:
Rinkeby (deprecated):
Source code
ABI
PWNLOAN.sol contract is written in Solidity version 0.8.4
The PWN LOAN token is a tokenized representation of a loan that can aquire different states:
Dead/None - Loan is not created or has been claimed and can be burned.
Running - Loan is created by passing offer data and offer signature signed by a lender.
Paid back - Loan has been fully paid back before the expiration date. The LOAN owner is able to claim lent credit + interest.
Expired - Loan had not been fully paid back before expiration date. LOAN owner is able to claim collateral.
Each LOAN token is defined by the LOAN token struct.
LOAN
token struct has the following properties:
uint8
status
address
borrower
Address of the borrower - stays the same for entire lifespan of the token
uint32
duration
Loan duration in seconds
uint40
expiration
Unix timestamp (in seconds) setting up the default deadline
collateral
Asset used as a loan collateral. Consisting of another Asset
struct defined in the MultiToken library
asset
Asset to be borrowed by lender to borrower. Consisting of another Asset
struct defined in the MultiToken library
uint256
loanRepayAmount
Amount of LOAN asset to be repaid
Functions that don't modify the state of the contract. These functions are used to get information about the LOAN token.
getStatus
This function takes one argument:
uint256
_loanId
- Loan id
getExpiration
Returns the exact expiration time of a particular LOAN as a unix timestamp in seconds.
This function takes one argument:
uint256
_loanId
- Loan id
getDuration
Returns loan duration period of particular LOAN in seconds.
This function takes one argument:
uint256
_loanId
- Loan id
getBorrower
Returns borrower address of particular LOAN.
This function takes one argument:
uint256
_loanId
- Loan id
getCollateral
This function takes one argument:
uint256
_loanId
- Loan id
getLoanAsset
This function takes one argument:
uint256
_loanId
- Loan id
getLoanRepayAmout
Returns loan repay amount of a particular LOAN.
This function takes one argument:
uint256
_loanId
- Loan id
isRevoked
Utility function to find out if offer is revoked. Returns a boolean.
This function takes one argument:
bytes32
_offerHash
- Hash of the offer struct
PWNLOAN contract defines four events and no custom errors.
LOANCreated
LOANCreated event is emitted when a borrower accepts an offer.
This event has three parameters:
uint256 indexed
loanId
- The ID of the LOAN token
address indexed
lender
- Address of the lender
OfferRevoked
OfferRevoked event is emitted when a lender decides to revoke an offer.
This event has one parameter:
PaidBack
PaidBack event is emitted when a borrower repays a loan.
This event has one parameter:
uint256
loanId
- The ID of the LOAN token
LOANClaimed
LOANClaimed event is emitted when a lender claims the repaid amount or loan underlying collateral in case of a default.
This event has one parameter:
uint256
loanId
- The ID of the LOAN token
see
MultiToken.Asset
(see )
MultiToken.Asset
(see )
This contract inherits from the ERC-1155 token standard. This comes with all of the ERC-1155 functionalities like transfers etc. Please read the specification for more details.
Returns LOAN status number. To understand what different status means please refer to above.
Returns collateral asset of a particular LOAN. By asset we mean Asset struct described in .
Returns loan asset of particular LOAN. By asset we mean Asset struct described in .
bytes32 indexed
offerHash
- computed of the offer struct
bytes32 indexed
offerHash
- computed of the offer struct