PWN
The core interface
Last updated
The core interface
Last updated
PWN is the core interface that users are expected to use. It is the only interactive contract allowing for permissionless external calls. The contract defines the workflow functionality and handles the market making.
Deployment addresses
Mainnet:
Polygon:
Görli:
Mumbai:
Rinkeby (deprecated):
Source code
ABI
PWN.sol contract is written in Solidity version 0.8.4
Payback loans
Claim collateral or credit
Revoke offers
createLoan
A borrower can accept an existing signed off-chain offer by calling the createLoan
function.
The diagram below shows the high-level logic of the function.
This function takes two arguments supplied by the caller (borrower):
Note that a borrowed asset has to be an ERC-20 token, otherwise, the transaction will revert.
createFlexibleLoan
The internal logic is similar as with createLoan
, but this function takes one more argument:
Note that a borrowed asset has to be an ERC-20 token, otherwise, the transaction will revert.
repayLoan
The repayLoan
function allows for repaying a loan by anyone. This enables users to take a loan from one address and repay the loan from another address. The loan's underlying collateral will be transferred back to the original borrower's address and not to the address which repaid the loan.
This function assumes approval of all used assets to PWN Vault. If any of the used assets are not approved the function will revert.
The diagram below shows the high-level logic of the function.
This function takes one argument supplied by the caller:
uint256
_loanId
- ID of the LOAN being paid back
claimLoan
The owner of a LOAN token (usually the lender) can call this function to claim assets if the loan was expired or has been paid back.
The diagram below shows the high-level logic of the function.
This function takes one argument supplied by the caller:
uint256
_loanId
- ID of the LOAN to be claimed
revokeOffer
If a lender has signed an off-chain offer, they can revoke the offer by calling the revokeOffer
function.
This function takes two arguments supplied by the caller:
Create LOANs with an
PWNLOAN.Offer memory
_offer
- Offer struct with plain offer data. For more information, see
bytes memory
_signature
- of the offer typed struct signed by the lender
This function allows for accepting flexible offers (see ).
PWNLOAN.FlexibleOffer memory
_offer
- Offer struct with flexible offer data. For more information see .
PWNLOAN.FlexibleOfferValues memory
_offerValues
- Concrete values of a flexible offer set by the borrower. For more information see .
bytes memory
_signature
- of the offer typed struct signed by the lender
bytes32
_offerHash
- computed of the
bytes calldata
_signature
- of the
The PWN contract does not define any events or custom errors. All events relevant to the PWN protocol are emitted by the and contracts.