1"use strict";(self.webpackChunkpwndao_docs=self.webpackChunkpwndao_docs||[]).push([[992],{5404:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>o});var a=n(6672);const s={},r=a.createContext(s);function i(e){const t=a.useContext(r);return a.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),a.createElement(r.Provider,{value:t},e.children)}},5919:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>a,toc:()=>c});const a=JSON.parse('{"id":"smart-contracts/pwn-dao/tokens/vepwn/metadata","title":"Metadata","description":"1. Summary","source":"@site/docs/smart-contracts/pwn-dao/tokens/vepwn/metadata.md","sourceDirName":"smart-contracts/pwn-dao/tokens/vepwn","slug":"/smart-contracts/pwn-dao/tokens/vepwn/metadata","permalink":"/smart-contracts/pwn-dao/tokens/vepwn/metadata","draft":false,"unlisted":false,"editUrl":"https://github.com/pwndao/pwndao-docs/tree/main/docs/docs/smart-contracts/pwn-dao/tokens/vepwn/metadata.md","tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"Power","permalink":"/smart-contracts/pwn-dao/tokens/vepwn/power"},"next":{"title":"Epoch Clock","permalink":"/smart-contracts/pwn-dao/epoch-clock"}}');var s=n(3420),r=n(5404);const i={},o="Metadata",d={},c=[{value:"1. Summary",id:"1-summary",level:2},{value:"2. Important links",id:"2-important-links",level:2},{value:"3. Contract details",id:"3-contract-details",level:2},{value:"Features",id:"features",level:3},{value:"Inherited contracts, implemented Interfaces and ERCs",id:"inherited-contracts-implemented-interfaces-and-ercs",level:3},{value:"Functions",id:"functions",level:3},{value:"Overview",id:"overview",level:4},{value:"Implementation",id:"implementation",level:4},{value:"<code>MetadataAttributes</code> Struct",id:"metadataattributes-struct",level:3},{value:"<code>PowerChange</code> Struct",id:"powerchange-struct",level:3},{value:"<code>StakedAmount</code> Struct",id:"stakedamount-struct",level:3}];function l(e){const t={a:"a",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",h4:"h4",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components},{Details:n}=t;return n||function(e,t){throw new Error("Expected "+(t?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Details",!0),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.header,{children:(0,s.jsx)(t.h1,{id:"metadata",children:"Metadata"})}),"\n",(0,s.jsx)(t.h2,{id:"1-summary",children:"1. Summary"}),"\n",(0,s.jsxs)(t.p,{children:["The vePWN Stake Metadata contract is an abstract contract inherited by vePWN. It implements ",(0,s.jsx)(t.code,{children:"stakeMetadata"})," function to get associated metadata about a stake NFT. "]}),"\n",(0,s.jsx)(t.h2,{id:"2-important-links",children:"2. Important links"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:(0,s.jsx)(t.a,{href:"https://github.com/PWNDAO/pwn_dao/blob/main/src/token/vePWN/VoteEscrowedPWNStakeMetadata.sol",children:(0,s.jsx)(t.strong,{children:"View on GitHub"})})}),"\n"]}),"\n",(0,s.jsx)(t.h2,{id:"3-contract-details",children:"3. Contract details"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.em,{children:"VoteEscrowedPWNStakeMetadata.sol"})," is written in Solidity version 0.8.25"]}),"\n"]}),"\n",(0,s.jsx)(t.h3,{id:"features",children:"Features"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"Provides metadata for staked NFT"}),"\n"]}),"\n",(0,s.jsx)(t.h3,{id:"inherited-contracts-implemented-interfaces-and-ercs",children:"Inherited contracts, implemented Interfaces and ERCs"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:(0,s.jsx)(t.a,{href:"https://github.com/PWNDAO/pwn_dao/blob/main/src/token/vePWN/VoteEscrowedPWNBase.sol",children:"VoteEscrowedPWNBase"})}),"\n",(0,s.jsx)(t.li,{children:(0,s.jsx)(t.a,{href:"https://github.com/PWNDAO/pwn_dao/blob/main/src/interfaces/IStakedPWNSupplyManager.sol",children:"IStakedPWNSupplyManager"})}),"\n"]}),"\n",(0,s.jsx)(t.h3,{id:"functions",children:"Functions"}),"\n",(0,s.jsxs)(n,{children:[(0,s.jsx)("summary",{children:(0,s.jsx)("code",{children:"stakeMetadata"})}),(0,s.jsx)(t.h4,{id:"overview",children:"Overview"}),(0,s.jsx)(t.p,{children:"Function to get associated metadata about a specific stake. "}),(0,s.jsxs)(t.p,{children:["Checkout ",(0,s.jsx)(t.a,{href:"/smart-contracts/pwn-dao/tokens/vepwn/metadata#metadataattributes-struct",children:(0,s.jsx)(t.code,{children:"MetadataAttributes"})})," struct definition below to learn more about the ",(0,s.jsx)(t.code,{children:"attributes"})," field in the json response returned by this function."]}),(0,s.jsx)(t.p,{children:"This function takes one argument:"}),(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.code,{children:"uint256"}),(0,s.jsx)(t.strong,{children:(0,s.jsx)(t.code,{children:"stakeId"})})]}),"\n"]}),(0,s.jsx)(t.h4,{id:"implementation",children:"Implementation"}),(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-solidity",children:"function stakeMetadata(uint256 stakeId) external view returns (string memory) {\n string memory json = string.concat(\n '{\"name\":', _makeName(stakeId), ',',\n '\"external_url\":', _makeExternalUrl(stakeId), ',',\n '\"image\":', _makeApiUriWith(stakeId, \"thumbnail\"), ',',\n '\"animation_url\":', _makeApiUriWith(stakeId, \"animation\"), ',',\n '\"attributes\":', _makeAttributes(stakeId), ',',\n '\"description\":', _makeDescription(), '}'\n );\n\n return string.concat(\"data:application/json;base64,\", Base64.encode(bytes(json)));\n}\n"})})]}),"\n",(0,s.jsxs)(t.h3,{id:"metadataattributes-struct",children:[(0,s.jsx)(t.code,{children:"MetadataAttributes"})," Struct"]}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-solidity",children:"struct MetadataAttributes {\n StakedAmount stakedAmount;\n uint256 stakedAmountFormatted;\n uint256 currentPower;\n uint256 initialTimestamp;\n uint256 lockUpDuration;\n uint256 unlockTimestamp;\n string multiplier;\n address stakeOwner;\n PowerChange[] powerChanges;\n}\n"})}),"\n",(0,s.jsxs)(t.h3,{id:"powerchange-struct",children:[(0,s.jsx)(t.code,{children:"PowerChange"})," Struct"]}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-solidity",children:"struct PowerChange {\n uint256 timestamp;\n uint256 power;\n string multiplier;\n}\n"})}),"\n",(0,s.jsxs)(t.h3,{id:"stakedamount-struct",children:[(0,s.jsx)(t.code,{children:"StakedAmount"})," Struct"]}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-solidity",children:"struct StakedAmount {\n uint256 amount;
1\n uint256 decimals;\n address pwnTokenAddress;\n}\n"})})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.