PWN Config

1. Summary

The PWNConfig.sol contract stores the core parameters of the protocol. The parameters are the following:

To prevent any attacks there is a hard cap of 10 % on the fee size.

The config contract is meant to be used behind a proxy contract, which enables the addition and removal of parameters as the protocol evolves. The proxy implementation used is the TransparentUpgradableProxy from Open Zeppelin.

3. Contract details

  • PWNConfig.sol is written in Solidity version 0.8.16

Features

  • Stores PWN Protocol parameters

Inherited contracts, implemented Interfaces and ERCs

Functions

setFee

Overview

Updates the fee parameter of the PWN Protocol.

This function takes one argument supplied by the owner:

  • uint16_fee - New fee in basis points

Implementation

function setFee(uint16 _fee) external onlyOwner {
    _setFee(_fee);
}
setFeeCollector

Overview

Updates the address that collects the PWN Protocol fees.

This function takes one argument supplied by the owner:

  • address_feeCollector

Implementation

function setFeeCollector(address _feeCollector) external onlyOwner {
    _setFeeCollector(_feeCollector);
}
setLoanMetadataUri

Overview

Updates the metadata URI for a loan contract.

This function takes two arguments supplied by the owner:

  • addressloanContract - Address of the loan contract for which the URI is updated

  • string memorymetadataUri - New URI

Implementation

function setLoanMetadataUri(address loanContract, string memory metadataUri) external onlyOwner {
    loanMetadataUri[loanContract] = metadataUri;
    emit LoanMetadataUriUpdated(loanContract, metadataUri);
}

Events

The PWN Config contract defines one event and no custom errors.

event FeeUpdated(uint16 oldFee, uint16 newFee);
event FeeCollectorUpdated(address oldFeeCollector, address newFeeCollector);
event LoanMetadataUriUpdated(address indexed loanContract, string newUri);
FeeUpdated

FeeUpdated event is emitted when the protocol fee is updated. Fees are represented in basis points.

This event has two parameters:

  • uint16oldFee

  • uint16newFee

FeeCollectorUpdated

FeeCollectorUpdated event is emitted when the protocol fees collector address is updated.

This event has two parameters:

  • addressoldFeeCollector

  • addressnewFeeCollector

LoanMetadataUriUpdated

LoanMetadataUriUpdated event is emitted when a metadata URI for a loan contract is updated.

This event has two parameters:

  • address indexedloanContract - Address of the loan contract for which the URI is updated

  • stringnewUri

Last updated