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.
2. Important links
3. Contract details
PWNConfig.sol is written in Solidity version 0.8.16
Features
Stores PWN Protocol parameters
Inherited contracts, implemented Interfaces and ERCs
Registers a state fingerprint computer for a given asset.
This function takes two arguments supplied by the owner:
addressasset - The asset for which the computer is registered
addresscomputer - The computer to be registered. Use a zero address to remove a computer
Implementation
function registerStateFingerprintComputer(address asset, address computer) external onlyOwner {
if (computer != address(0))
if (!IStateFingerpringComputer(computer).supportsToken(asset))
revert InvalidComputerContract({ computer: computer, asset: asset });
_sfComputerRegistry[asset] = computer;
}
registerPoolAdapter
Overview
Registers a pool adapter for a given pool.
This function takes two arguments supplied by the owner:
addresspool - The pool for which the adapter is registered
addressadapter - The adapter to be registered
Implementation
function registerPoolAdapter(address pool, address adapter) external onlyOwner {
_poolAdapterRegistry[pool] = adapter;
}
View Functions
loanMetadataUri
Overview
Returns a LOAN token metadata URI based on a loan contract that minted the token.
This function takes one argument supplied by the caller:
addressloanContract - Address of a loan contract
Implementation
function loanMetadataUri(address loanContract) external view returns (string memory uri) {
uri = _loanMetadataUri[loanContract];
// If there is no metadata uri for a loan contract, use default metadata uri.
if (bytes(uri).length == 0)
uri = _loanMetadataUri[address(0)];
}
getStateFingerprintComputer
Overview
Returns the state fingerprint computer for a given asset.
This function takes one argument supplied by the caller:
addressasset - Address of the asset for which the computer is requested