PWN Vault

Asset storage

1. Summary

PWN Vault is the holder contract for the locked-in collateral and paid back credit. The contract can only be operated through the PWN (logic) contract.

All approval of tokens utilized within the PWN context has to be done towards the PWN Vault address - as ultimately it's the contract accessing the tokens.

3. Contract Details

  • PWNVault.sol contract is written in Solidity version 0.8.4

Functions

The functions described below are important to understand the events the contract emits. These functions can not be called directly and the contract can only be operated through the PWN contract.

pull

Function accessing an asset and pulling it into the vault.

The function assumes a prior token approval was made with the PWNVault address to be approved.

This function takes two arguments:

  • MultiToken.Asset memory_asset - An asset construct (see MultiToken)

  • address_origin - Address from which asset is pulled into the Vault.

push

Function pushing an asset from the vault, sending to a defined recipient. This function is used for claiming a paid back loan or defaulted collateral.

This function takes two arguments:

  • MultiToken.Asset memory_asset - An asset construct (see MultiToken)

  • address_beneficiary - An address of the recipient of the asset -> is set in the PWN logic contract

pushFrom

Function pushing an asset from a lender, sending it to a borrower.

This function assumes prior approval for the asset to be spent by the borrower's address.

This function takes three arguments:

  • MultiToken.Asset memory_asset - An asset construct (see MultiToken)

  • address_origin - An address of the lender who is providing the loan asset

  • address_beneficiary - An address of the recipient of the asset -> is set in the PWN logic contract

Events

PWN Vault contract defines three events and no custom errors.

event VaultPull(MultiToken.Asset asset, address indexed origin);
event VaultPush(MultiToken.Asset asset, address indexed beneficiary);
event VaultPushFrom(MultiToken.Asset asset, address indexed origin, address indexed beneficiary);

VaultPull

VaultPull event is emitted when the pull function is called.

This event has two parameters:

  • MultiToken.Assetasset - An asset construct (see MultiToken)

  • address indexedorigin - Address from which asset is pulled into the Vault.

VaultPush

VaultPush event is emitted when the push function is called.

This event has two parameters:

  • MultiToken.Assetasset - An asset construct (see MultiToken)

  • address indexedbeneficiary - Address to which is the asset pushed (transferred) to.

VaultPushFrom

VaultPushFrom event is emitted when the pushFrom function is called.

This event has three parameters:

  • MultiToken.Assetasset - An asset construct (see MultiToken)

  • address indexedorigin - An address of the lender who is providing the loan asset

  • address indexedbeneficiary - An address of the recipient of the asset -> is set in the PWN logic contract

Last updated