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
  • Inherited contracts, implemented Interfaces and ERCs
  • Functions
  • MetadataAttributes Struct
  • PowerChange Struct
  • StakedAmount Struct
Edit on GitHub
  1. Smart contracts
  2. PWN DAO
  3. Tokens
  4. vePWN

Metadata

PreviousPowerNextEpoch Clock

Last updated 6 months ago

1. Summary

The vePWN Stake Metadata contract is an abstract contract inherited by vePWN. It implements stakeMetadata function to get associated metadata about a stake NFT.

2. Important links

3. Contract details

  • VoteEscrowedPWNStakeMetadata.sol is written in Solidity version 0.8.25

Features

  • Provides metadata for staked NFT

Inherited contracts, implemented Interfaces and ERCs

Functions

stakeMetadata

Overview

Function to get associated metadata about a specific stake.

This function takes one argument:

  • uint256stakeId

Implementation

function stakeMetadata(uint256 stakeId) external view returns (string memory) {
    string memory json = string.concat(
        '{"name":', _makeName(stakeId), ',',
        '"external_url":', _makeExternalUrl(stakeId), ',',
        '"image":', _makeApiUriWith(stakeId, "thumbnail"), ',',
        '"animation_url":', _makeApiUriWith(stakeId, "animation"), ',',
        '"attributes":', _makeAttributes(stakeId), ',',
        '"description":', _makeDescription(), '}'
    );

    return string.concat("data:application/json;base64,", Base64.encode(bytes(json)));
}

MetadataAttributes Struct

struct MetadataAttributes {
    StakedAmount stakedAmount;
    uint256 stakedAmountFormatted;
    uint256 currentPower;
    uint256 initialTimestamp;
    uint256 lockUpDuration;
    uint256 unlockTimestamp;
    string multiplier;
    address stakeOwner;
    PowerChange[] powerChanges;
}

PowerChange Struct

struct PowerChange {
    uint256 timestamp;
    uint256 power;
    string multiplier;
}

StakedAmount Struct

struct StakedAmount {
    uint256 amount;
    uint256 decimals;
    address pwnTokenAddress;
}

Checkout struct definition below to learn more about the attributes field in the json response returned by this function.

VoteEscrowedPWNBase
IStakedPWNSupplyManager
MetadataAttributes
pwn_dao/src/token/vePWN/VoteEscrowedPWNStakeMetadata.sol at main · PWNDAO/pwn_daoGitHub
Logo