Developer Docs
AppGitHub
  • Welcome!
  • Smart contracts
    • Core
      • Introduction
      • Deep Dive
      • Smart Contract Reference
        • PWN Hub
          • Tags
        • PWN Config
        • PWN Vault
        • Loan Types
          • Simple Loan
        • Proposals
          • Simple Loan Proposal
            • Simple Proposal
            • List Proposal
            • Elastic Proposal
            • Elastic Chainlink Proposal
            • Dutch Proposal
        • PWN Utilized Credit
        • PWN LOAN
        • PWN Revoked Nonce
        • Peripheral Contracts
          • Acceptor Controller
            • World ID
          • State Fingerprint Computer
            • UniV3
            • Chicken Bonds
          • Pool Adapter
            • Aave
            • Compound
            • ERC4626
        • Miscellaneous
          • PWN Fee Calculator
          • PWN Signature Checker
          • PWN Errors
          • PWN Periphery
          • Timelock
    • PWN DAO
      • Governance
        • Optimistic
        • Token
      • Tokens
        • PWN
        • stPWN
        • vePWN
          • Stake
          • Power
          • Metadata
      • Epoch Clock
      • Miscellaneous
        • Errors
        • EpochPowerLib
    • Tools
      • PWN Safe
        • Architecture
        • Security considerations
        • Smart Contract Reference
          • PWN Safe Factory
          • ATR Module
            • Tokenized Asset Manager
            • Recipient Permission Manager
          • Whitelist
          • ATR Guard
            • Operators context
      • Token Bundler
      • PWN Deployer
    • Libraries
      • MultiToken
    • Contract Addresses
  • More documentation
    • PWN Docs
    • FAQ
    • Audits
    • Using PWN without front-end
  • Deprecated
    • PWN Beta
      • Architecture
      • PWN
        • Off-chain signed offer
        • Offer types
      • PWN Vault
      • PWN LOAN
Powered by GitBook
On this page
  • 1. Summary
  • 2. Important links
  • 3. Contract details
  • Features
  • Functions
  • Errors
Edit on GitHub
  1. Smart contracts
  2. Core
  3. Smart Contract Reference

PWN Utilized Credit

PreviousDutch ProposalNextPWN LOAN

Last updated 3 months ago

1. Summary

The PWNUtilizedCredit.sol contract is designed to manage and update credit across different proposal types. The contract ensures that credit usage does not exceed a predefined limit for a credit asset and restricts access only to selected proposal types.

2. Important links

3. Contract details

  • PWNUtilizedCredit.sol is written in Solidity version 0.8.16

Features

  • Credit utilization across proposals

  • Limit credit usage per proposal type

Functions

utilizeCredit

Overview

This function updates the utilized credit for an owner for a selected credit asset.

This function takes four arguments:

  • addressowner - Credit owner address

  • bytes32id - Credit identifier

  • uint256amount - Credit amount

  • uint256limit - Credit limit

Implementation

function utilizeCredit(address owner, bytes32 id, uint256 amount, uint256 limit) external onlyWithHubTag {
    uint256 extendedAmount = utilizedCredit[owner][id] + amount;
    if (extendedAmount > limit) {
        revert AvailableCreditLimitExceeded({ owner: owner, id: id, utilized: extendedAmount, limit: limit });
    }

    utilizedCredit[owner][id] = extendedAmount;
}

Errors

The PWN Utilized Credit contract defines one error.

error AvailableCreditLimitExceeded(address owner, bytes32 id, uint256 utilized, uint256 limit);
AvailableCreditLimitExceeded

A AvailableCreditLimitExceeded error is thrown when

This error has four parameters:

  • addressowner

  • bytes32id

  • uint256utilzed

  • uint256limit

3KB
PWNUtilizedCredit.json
pwn_contracts/src/utilized-credit/PWNUtilizedCredit.sol at master · PWNDAO/pwn_contractsGitHub
Logo