[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"navigation":3,"\u002Fbuild\u002Ftreasury-model":260,"\u002Fbuild\u002Ftreasury-model-surround":1291},[4,22,105,148,177,186,243],{"title":5,"path":6,"stem":7,"children":8,"page":21},"Agents","\u002Fagents","agents",[9,13,17],{"title":10,"path":11,"stem":12},"LLMs.txt","\u002Fagents\u002Fllms-txt","agents\u002Fllms-txt",{"title":14,"path":15,"stem":16},"MCP Server","\u002Fagents\u002Fmcp-server","agents\u002Fmcp-server",{"title":18,"path":19,"stem":20},"Skills","\u002Fagents\u002Fskills","agents\u002Fskills",false,{"title":23,"path":24,"stem":25,"children":26,"page":21},"Api Reference","\u002Fapi-reference","api-reference",[27,31,35,68],{"title":28,"path":29,"stem":30},"Authentication","\u002Fapi-reference\u002Fauthentication","api-reference\u002Fauthentication",{"title":32,"path":33,"stem":34},"API Reference","\u002Fapi-reference\u002Fintroduction","api-reference\u002Fintroduction",{"title":36,"path":37,"stem":38,"children":39,"page":21},"Orchestration","\u002Fapi-reference\u002Forchestration","api-reference\u002Forchestration",[40,44,48,52,56,60,64],{"title":41,"path":42,"stem":43},"POST \u002Fcancel-order","\u002Fapi-reference\u002Forchestration\u002Fcancel-order","api-reference\u002Forchestration\u002Fcancel-order",{"title":45,"path":46,"stem":47},"GET \u002Forder-status\u002F{orderId}","\u002Fapi-reference\u002Forchestration\u002Forder-status","api-reference\u002Forchestration\u002Forder-status",{"title":49,"path":50,"stem":51},"GET \u002Forders","\u002Fapi-reference\u002Forchestration\u002Forders","api-reference\u002Forchestration\u002Forders",{"title":53,"path":54,"stem":55},"Orchestration API","\u002Fapi-reference\u002Forchestration\u002Foverview","api-reference\u002Forchestration\u002Foverview",{"title":57,"path":58,"stem":59},"POST \u002Fquote","\u002Fapi-reference\u002Forchestration\u002Fquote","api-reference\u002Forchestration\u002Fquote",{"title":61,"path":62,"stem":63},"GET \u002Fsupported-assets","\u002Fapi-reference\u002Forchestration\u002Fsupported-assets","api-reference\u002Forchestration\u002Fsupported-assets",{"title":65,"path":66,"stem":67},"TypeScript Type Generation","\u002Fapi-reference\u002Forchestration\u002Ftype-generation","api-reference\u002Forchestration\u002Ftype-generation",{"title":69,"path":70,"stem":71,"children":72,"page":21},"Recipes","\u002Fapi-reference\u002Frecipes","api-reference\u002Frecipes",[73,77,81,85,89,93,97,101],{"title":74,"path":75,"stem":76},"Collateral Composition","\u002Fapi-reference\u002Frecipes\u002Fcollateral-composition","api-reference\u002Frecipes\u002Fcollateral-composition",{"title":78,"path":79,"stem":80},"Daily Yields","\u002Fapi-reference\u002Frecipes\u002Fdaily-yields","api-reference\u002Frecipes\u002Fdaily-yields",{"title":82,"path":83,"stem":84},"Earner Rate History","\u002Fapi-reference\u002Frecipes\u002Fearner-rate-history","api-reference\u002Frecipes\u002Fearner-rate-history",{"title":86,"path":87,"stem":88},"Minter Daily Expenses","\u002Fapi-reference\u002Frecipes\u002Fminter-daily-expenses","api-reference\u002Frecipes\u002Fminter-daily-expenses",{"title":90,"path":91,"stem":92},"Network Supply","\u002Fapi-reference\u002Frecipes\u002Fnetwork-supply","api-reference\u002Frecipes\u002Fnetwork-supply",{"title":94,"path":95,"stem":96},"Protocol Configuration","\u002Fapi-reference\u002Frecipes\u002Fprotocol-config","api-reference\u002Frecipes\u002Fprotocol-config",{"title":98,"path":99,"stem":100},"Token Holders","\u002Fapi-reference\u002Frecipes\u002Ftoken-holders","api-reference\u002Frecipes\u002Ftoken-holders",{"title":102,"path":103,"stem":104},"Token Overview","\u002Fapi-reference\u002Frecipes\u002Ftoken-overview","api-reference\u002Frecipes\u002Ftoken-overview",{"title":106,"path":107,"stem":108,"children":109,"page":21},"Build","\u002Fbuild","build",[110,114,118,122,126,130,134,138,142,145],{"title":111,"path":112,"stem":113},"Integrating with the M0 Portals","\u002Fbuild\u002Fbridging-developer","build\u002Fbridging-developer",{"title":115,"path":116,"stem":117},"Bridging M And wM Tokens","\u002Fbuild\u002Fbridging-user","build\u002Fbridging-user",{"title":119,"path":120,"stem":121},"Stablecoin Extension Templates","\u002Fbuild\u002Fchoosing-your-model","build\u002Fchoosing-your-model",{"title":123,"path":124,"stem":125},"How to Design Your Stablecoin","\u002Fbuild\u002Foverview","build\u002Foverview",{"title":127,"path":128,"stem":129},"Implementation Guide: NoYield","\u002Fbuild\u002Fsvm-noyield-guide","build\u002Fsvm-noyield-guide",{"title":131,"path":132,"stem":133},"Getting started","\u002Fbuild\u002Fsvm-noyield-guide-overview","build\u002Fsvm-noyield-guide-overview",{"title":135,"path":136,"stem":137},"Implementation Guide: MYieldToOne (Onshore)","\u002Fbuild\u002Ftreasury-guide","build\u002Ftreasury-guide",{"title":139,"path":140,"stem":141},"Implementation Guide: JMI (Offshore)","\u002Fbuild\u002Ftreasury-jmi-guide","build\u002Ftreasury-jmi-guide",{"title":131,"path":143,"stem":144},"\u002Fbuild\u002Ftreasury-jmi-overview","build\u002Ftreasury-jmi-overview",{"title":131,"path":146,"stem":147},"\u002Fbuild\u002Ftreasury-model","build\u002Ftreasury-model",{"title":149,"path":150,"stem":151,"children":152,"page":21},"Get Started","\u002Fget-started","get-started",[153,157,161,165,169,173],{"title":154,"path":155,"stem":156},"Accessing Liquidity","\u002Fget-started\u002Faccessing-liquidity","get-started\u002Faccessing-liquidity",{"title":158,"path":159,"stem":160},"Cross Chain Interoperability","\u002Fget-started\u002Fcross-chain","get-started\u002Fcross-chain",{"title":162,"path":163,"stem":164},"Architecture Overview","\u002Fget-started\u002Fhow-it-works","get-started\u002Fhow-it-works",{"title":166,"path":167,"stem":168},"Overview","\u002Fget-started\u002Foverview","get-started\u002Foverview",{"title":170,"path":171,"stem":172},"Platform Mechanics & Reward Programmability","\u002Fget-started\u002Fprotocol-mechanics","get-started\u002Fprotocol-mechanics",{"title":174,"path":175,"stem":176},"Stablecoin Features","\u002Fget-started\u002Fstablecoin-features","get-started\u002Fstablecoin-features",{"title":178,"path":179,"stem":180,"children":181,"page":21},"Issuers","\u002Fissuers","issuers",[182],{"title":183,"path":184,"stem":185},"Issue Your Stablecoin","\u002Fissuers\u002Foverview","issuers\u002Foverview",{"title":187,"path":188,"stem":189,"children":190,"page":21},"Protocol","\u002Fprotocol","protocol",[191,195,199,203,207,211,215,219,223,227,231,235,239],{"title":192,"path":193,"stem":194},"Distribution Vault","\u002Fprotocol\u002Fdistribution-vault","protocol\u002Fdistribution-vault",{"title":196,"path":197,"stem":198},"M0 Extensions","\u002Fprotocol\u002Fextensions","protocol\u002Fextensions",{"title":200,"path":201,"stem":202},"Limit Order Protocol","\u002Fprotocol\u002Flimit-order-protocol","protocol\u002Flimit-order-protocol",{"title":204,"path":205,"stem":206},"M0 Portals","\u002Fprotocol\u002Fm-portals","protocol\u002Fm-portals",{"title":208,"path":209,"stem":210},"M Token","\u002Fprotocol\u002Fm-token","protocol\u002Fm-token",{"title":212,"path":213,"stem":214},"M Token Specification","\u002Fprotocol\u002Fm-token-spec","protocol\u002Fm-token-spec",{"title":216,"path":217,"stem":218},"Minting & Burning (MinterGateway)","\u002Fprotocol\u002Fminting-burning","protocol\u002Fminting-burning",{"title":220,"path":221,"stem":222},"Portal V2","\u002Fprotocol\u002Fportal-v2","protocol\u002Fportal-v2",{"title":224,"path":225,"stem":226},"Rate Models & Yield","\u002Fprotocol\u002Frate-models","protocol\u002Frate-models",{"title":228,"path":229,"stem":230},"Roles","\u002Fprotocol\u002Froles","protocol\u002Froles",{"title":232,"path":233,"stem":234},"M0 On Solana","\u002Fprotocol\u002Fsolana","protocol\u002Fsolana",{"title":236,"path":237,"stem":238},"Wrapped M (wM)","\u002Fprotocol\u002Fwrapped-m","protocol\u002Fwrapped-m",{"title":240,"path":241,"stem":242},"Wrapped M Specification","\u002Fprotocol\u002Fwrapped-m-spec","protocol\u002Fwrapped-m-spec",{"title":244,"path":245,"stem":246,"children":247,"page":21},"Resources","\u002Fresources","resources",[248,252,256],{"title":249,"path":250,"stem":251},"Deployments","\u002Fresources\u002Faddresses","resources\u002Faddresses",{"title":253,"path":254,"stem":255},"Audits","\u002Fresources\u002Faudits","resources\u002Faudits",{"title":257,"path":258,"stem":259},"Glossary","\u002Fresources\u002Fglossary","resources\u002Fglossary",{"id":261,"title":131,"body":262,"description":1285,"extension":1286,"links":1287,"meta":1288,"navigation":1115,"path":146,"seo":1289,"stem":147,"__hash__":1290},"docs\u002Fbuild\u002Ftreasury-model.md",{"type":263,"value":264,"toc":1274},"minimark",[265,273,278,294,299,302,394,403,419,423,433,436,449,454,460,465,482,517,521,593,596,600,606,610,613,654,658,682,686,699,703,748,752,762,786,790,793,819,823,845,855,865,869,878,881,903,906,911,914,956,959,1013,1016,1019,1024,1027,1037,1146,1150,1167,1170,1204,1208,1211,1233,1237,1240,1260,1270],[266,267,268,272],"p",{},[269,270,271],"strong",{},"Core Concept:"," All accrued rewards are captured by the use case owner. Token holders observe a stable, non-rebasing token with 1:1 backing.",[266,274,275],{},[269,276,277],{},"When to Use:",[279,280,281,285,288,291],"ul",{},[282,283,284],"li",{},"Simple business models where all rewards go to one entity.",[282,286,287],{},"Corporate treasuries requiring centralized revenue management.",[282,289,290],{},"Protocol-owned stablecoins where rewards fund protocol development.",[282,292,293],{},"Ecosystem development funds or grants programs.",[295,296,298],"h2",{"id":297},"evm-implementation-options","EVM Implementation Options",[266,300,301],{},"The Treasury Model offers two EVM implementations to fit different collateral strategies:",[303,304,305,321],"table",{},[306,307,308],"thead",{},[309,310,311,315,318],"tr",{},[312,313,314],"th",{},"Feature",[312,316,317],{},"MYieldToOne (Standard)",[312,319,320],{},"JMIExtension (Multi-Collateral)",[322,323,324,338,351,364,381],"tbody",{},[309,325,326,332,335],{},[327,328,329],"td",{},[269,330,331],{},"Collateral",[327,333,334],{},"Single-collateral",[327,336,337],{},"Multi-collateral (liquid stablecoins such as USDC, USDT also supported)",[309,339,340,345,348],{},[327,341,342],{},[269,343,344],{},"Asset Caps",[327,346,347],{},"N\u002FA",[327,349,350],{},"Configurable per asset",[309,352,353,358,361],{},[327,354,355],{},[269,356,357],{},"Unwrap Logic",[327,359,360],{},"Always 1:1 backed",[327,362,363],{},"Limited to base backing portion",[309,365,366,371,374],{},[327,367,368],{},[269,369,370],{},"Additional Operations",[327,372,373],{},"None",[327,375,376,380],{},[377,378,379],"code",{},"replaceAssetWithM"," for rebalancing",[309,382,383,388,391],{},[327,384,385],{},[269,386,387],{},"Best For",[327,389,390],{},"Simple treasury setups",[327,392,393],{},"Diversified collateral pools",[266,395,396,402],{},[269,397,398,399],{},"Choose ",[377,400,401],{},"MYieldToOne"," for single-collateral deployments with the simplest implementation.",[266,404,405,408,409,412,413],{},[269,406,407],{},"Choose"," ",[377,410,411],{},"JMIExtension"," if you need flexibility to accept multiple stablecoins while still directing all rewards to a single recipient. ",[414,415,416],"a",{"href":143},[269,417,418],{},"Learn more about JMI",[295,420,422],{"id":421},"default-myieldtoone","Default: MYieldToOne",[266,424,425,426,428,429,432],{},"The ",[377,427,401],{}," template is the simplest and most direct way to build on M0. It creates an upgradeable ERC-20 token backed 1:1 by eligible collateral, while directing ",[269,430,431],{},"100% of the accrued rewards"," to a single, designated recipient address.",[266,434,435],{},"This model is perfect for builders who want the stability and liquidity of an M0-powered token within their ecosystem, but prefer to centralize the rewards for strategic purposes like funding operational expenses, protocol development, ecosystem grants.",[266,437,438,408,441],{},[269,439,440],{},"Source Code:",[414,442,446],{"href":443,"rel":444},"https:\u002F\u002Fgithub.com\u002Fm0-foundation\u002Fm-extensions\u002Fblob\u002Fmain\u002Fsrc\u002Fprojects\u002FyieldToOne\u002FMYieldToOne.sol",[445],"nofollow",[377,447,448],{},"MYieldToOne.sol",[450,451,453],"h3",{"id":452},"architecture-and-mechanism","Architecture and Mechanism",[266,455,456,457,459],{},"The beauty of ",[377,458,401],{}," lies in its simplicity. It separates the token holding experience from the rewards generation, while incorporating freezing capabilities for compliance.",[461,462,464],"h4",{"id":463},"roles-access-control","Roles (Access Control)",[266,466,467,469,470,473,474,477,478,481],{},[377,468,401],{}," inherits from both ",[377,471,472],{},"MExtension"," and ",[377,475,476],{},"Freezable",", using OpenZeppelin's ",[377,479,480],{},"AccessControl"," to manage permissions with these distinct roles:",[279,483,484,492,502],{},[282,485,486,491],{},[269,487,488],{},[377,489,490],{},"DEFAULT_ADMIN_ROLE",": The super-user. This role can grant and revoke any other role. It should be held by a secure multi-sig or governance contract.",[282,493,494,497,498,501],{},[377,495,496],{},"YIELD_RECIPIENT_MANAGER_ROLE",": This role has one job: to manage where the rewards go. It can call ",[377,499,500],{},"setYieldRecipient()"," to change the beneficiary address.",[282,503,504,509,510,473,513,516],{},[269,505,506],{},[377,507,508],{},"FREEZE_MANAGER_ROLE",": This role can block specific addresses from wrapping, unwrapping, or transferring the token, adding a layer of compliance through the ",[377,511,512],{},"freeze()",[377,514,515],{},"unfreeze()"," functions.",[461,518,520],{"id":519},"how-it-works","How It Works",[522,523,524,537,550,563,573],"ol",{},[282,525,526,529,530,533,534,536],{},[269,527,528],{},"Wrapping:"," A user wraps through the SwapFacility and receives an equal amount of your new extension token (e.g., wrap 100, receive 100 ",[377,531,532],{},"YourToken","). The ",[377,535,401],{}," contract now holds the underlying balance.",[282,538,539,542,543,545,546,549],{},[269,540,541],{},"Accruing Rewards:"," Your deployed ",[377,544,401],{}," contract must call ",[377,547,548],{},"enableEarning()"," to start earning rewards. It begins to accrue rewards from the underlying eligible collateral.",[282,551,552,555,556,559,560,562],{},[269,553,554],{},"Creating a Surplus:"," As rewards accrue, the contract's balance becomes greater than the total supply of your extension token. For example, the contract might hold 100.05 while the ",[377,557,558],{},"totalSupply()"," of ",[377,561,532],{}," is still 100.",[282,564,565,568,569,572],{},[269,566,567],{},"Claiming Rewards:"," This surplus is the claimable rewards. Anyone can call the ",[377,570,571],{},"claimYield()"," function to realize this revenue.",[282,574,575,578,579,581,582,584,585,588,589,592],{},[269,576,577],{},"Distribution:"," When ",[377,580,571],{}," is called, the contract mints new ",[377,583,532],{}," equivalent to the surplus amount (0.05 in our example) and sends them directly to the designated ",[377,586,587],{},"yieldRecipient"," address. The ",[377,590,591],{},"totalSupply"," now becomes 100.05.",[266,594,595],{},"For end-users holding your token, their balance remains stable and unchanged. The rewards are handled completely behind the scenes.",[450,597,599],{"id":598},"key-interface-functions","Key Interface & Functions",[266,601,602,603,605],{},"While ",[377,604,401],{}," is a full ERC-20 token, its unique logic revolves around a few key functions.",[461,607,609],{"id":608},"storage-layout","Storage Layout",[266,611,612],{},"The state is kept minimal and efficient.",[614,615,620],"pre",{"className":616,"code":617,"language":618,"meta":619,"style":619},"language-solidity shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","struct MYieldToOneStorageStruct {\n    uint256 totalSupply;\n    address yieldRecipient;\n    mapping(address account => uint256 balance) balanceOf;\n}\n","solidity","",[377,621,622,630,636,642,648],{"__ignoreMap":619},[623,624,627],"span",{"class":625,"line":626},"line",1,[623,628,629],{},"struct MYieldToOneStorageStruct {\n",[623,631,633],{"class":625,"line":632},2,[623,634,635],{},"    uint256 totalSupply;\n",[623,637,639],{"class":625,"line":638},3,[623,640,641],{},"    address yieldRecipient;\n",[623,643,645],{"class":625,"line":644},4,[623,646,647],{},"    mapping(address account => uint256 balance) balanceOf;\n",[623,649,651],{"class":625,"line":650},5,[623,652,653],{},"}\n",[461,655,657],{"id":656},"core-rewards-functions","Core Rewards Functions",[279,659,660,673],{},[282,661,662,665,666,668,669,672],{},[377,663,664],{},"yield() external view returns (uint256)"," This view function calculates the amount of claimable rewards at any moment. It returns the difference between the contract's current balance and the ",[377,667,591],{}," of the extension token: ",[377,670,671],{},"mBalance > totalSupply ? mBalance - totalSupply : 0",".",[282,674,675,678,679,681],{},[377,676,677],{},"claimYield() external returns (uint256)"," This is the function that triggers the rewards distribution. It calculates the rewards, mints that amount of new tokens, and transfers them to the ",[377,680,587],{},". Returns 0 if there are no rewards to claim.",[461,683,685],{"id":684},"management-functions","Management Functions",[279,687,688],{},[282,689,690,695,696,698],{},[269,691,692],{},[377,693,694],{},"setYieldRecipient(address yieldRecipient) external"," Callable only by the ",[377,697,496],{},", this function updates the address that receives the rewards. It automatically claims any existing rewards for the previous recipient before making the change.",[461,700,702],{"id":701},"freezing-functions-inherited-from-freezable","Freezing Functions (Inherited from Freezable)",[279,704,705,716,724,732,740],{},[282,706,707,712,713,715],{},[269,708,709],{},[377,710,711],{},"freeze(address account) external"," Callable by the ",[377,714,508],{},", this function prevents an address from interacting with the token. Reverts if the account is already frozen.",[282,717,718,723],{},[269,719,720],{},[377,721,722],{},"unfreeze(address account) external"," Removes an address from the frozen list. Reverts if the account is not currently frozen.",[282,725,726,731],{},[269,727,728],{},[377,729,730],{},"isFrozen(address account) external view returns (bool)"," Checks if an address is currently frozen.",[282,733,734,739],{},[269,735,736],{},[377,737,738],{},"freezeAccounts(address[] calldata accounts) external"," Batch version for freezing multiple accounts.",[282,741,742,747],{},[269,743,744],{},[377,745,746],{},"unfreezeAccounts(address[] calldata accounts) external"," Batch version for unfreezing multiple accounts.",[461,749,751],{"id":750},"standard-mextension-functions","Standard MExtension Functions",[266,753,754,755,758,759,761],{},"As a child of ",[377,756,757],{},"MExtension.sol",", ",[377,760,401],{}," automatically inherits all the essential functionalities for interacting with the M0 ecosystem:",[279,763,764,770,775,780],{},[282,765,766,769],{},[377,767,768],{},"wrap(address recipient, uint256 amount)"," - Called by SwapFacility only.",[282,771,772,769],{},[377,773,774],{},"unwrap(address recipient, uint256 amount)",[282,776,777,779],{},[377,778,548],{}," - Starts earning rewards.",[282,781,782,785],{},[377,783,784],{},"disableEarning()"," - Stops earning rewards.",[461,787,789],{"id":788},"hook-functions","Hook Functions",[266,791,792],{},"The contract implements several internal hook functions that enforce freezing:",[279,794,795,801,807,813],{},[282,796,797,800],{},[377,798,799],{},"_beforeApprove()"," - Checks both account and spender aren't frozen.",[282,802,803,806],{},[377,804,805],{},"_beforeWrap()"," - Checks both depositor and recipient aren't frozen.",[282,808,809,812],{},[377,810,811],{},"_beforeUnwrap()"," - Checks the account isn't frozen.",[282,814,815,818],{},[377,816,817],{},"_beforeTransfer()"," - Checks sender, recipient, and msg.sender aren't frozen.",[461,820,822],{"id":821},"constants","Constants",[279,824,825,835],{},[282,826,827,831,832],{},[269,828,829],{},[377,830,496],{},": ",[377,833,834],{},"keccak256(\"YIELD_RECIPIENT_MANAGER_ROLE\")",[282,836,837,831,841,844],{},[269,838,839],{},[377,840,508],{},[377,842,843],{},"keccak256(\"FREEZE_MANAGER_ROLE\")"," (inherited from Freezable)",[266,846,847,408,850],{},[269,848,849],{},"Ready to build with MYieldToOne?",[414,851,852],{"href":136},[269,853,854],{},"Follow the implementation guide",[266,856,857,408,860],{},[269,858,859],{},"Need multi-collateral support?",[414,861,862],{"href":140},[269,863,864],{},"See the JMI implementation guide",[295,866,868],{"id":867},"svm-implementation-noyield","SVM Implementation: NoYield",[266,870,425,871,874,875,877],{},[377,872,873],{},"NoYield"," extension template is the most direct way to build a treasury-focused stablecoin on Solana. It creates an upgradeable, non-rebasing token backed 1:1 by eligible collateral, while directing ",[269,876,431],{}," to the extension's administrator. The NoYield variant supports both the Token-2022 standard and the legacy token program.",[266,879,880],{},"This model is perfect for builders who want the stability of an M0-powered token within their ecosystem but prefer to centralize rewards for strategic purposes, such as funding operational expenses, protocol development, ecosystem grants.",[266,882,883,885,886,888,889,892,893,896,897,902],{},[269,884,440],{}," The ",[377,887,873],{}," model is compiled from the ",[377,890,891],{},"m_ext"," program using the ",[377,894,895],{},"no-yield"," Rust feature flag. The source code is available in the ",[414,898,901],{"href":899,"rel":900},"https:\u002F\u002Fgithub.com\u002Fm0-foundation\u002Fsolana-m-extensions",[445],"solana-m-extensions"," repository.",[450,904,453],{"id":905},"architecture-and-mechanism-1",[266,907,425,908,910],{},[377,909,873],{}," model's strength is its simplicity. It completely separates token holding from rewards generation, which is managed centrally by the platform.",[461,912,464],{"id":913},"roles-access-control-1",[279,915,916,945],{},[282,917,918,923,924],{},[269,919,920],{},[377,921,922],{},"admin",": The root administrator, typically a secure multi-sig or governance contract. This role can:\n",[279,925,926,932,939],{},[282,927,928,929,672],{},"Configure the extension via ",[377,930,931],{},"initialize",[282,933,934,935,938],{},"Claim all accrued rewards using the ",[377,936,937],{},"claim_fees"," instruction.",[282,940,941,942,672],{},"Manage a whitelist of ",[377,943,944],{},"wrap_authorities",[282,946,947,952,953,955],{},[269,948,949],{},[377,950,951],{},"wrap_authority",": An address authorized by the ",[377,954,922],{}," to perform wrap and unwrap operations. This is useful for delegating wrapping capabilities to specific programs or services, like the swap facility.",[461,957,520],{"id":958},"how-it-works-1",[522,960,961,976,982,990,1000],{},[282,962,963,965,966,968,969,971,972,975],{},[269,964,528],{}," A user or program with ",[377,967,951],{}," wraps and receives an equal amount of the new extension token. The ",[377,970,873],{}," contract's vault (",[377,973,974],{},"m_vault",") now holds the underlying balance.",[282,977,978,981],{},[269,979,980],{},"Rewards Accrual:"," The contract's vault is registered as an earner in the base program. It begins to accrue rewards through Solana's rebasing mechanism.",[282,983,984,986,987,989],{},[269,985,554],{}," As rewards accrue, the contract's balance in its vault becomes greater than the total supply of the extension token. For example, the contract might hold 100.05 while the ",[377,988,591],{}," of the extension token remains 100. This surplus represents the claimable rewards.",[282,991,992,885,994,996,997,999],{},[269,993,567],{},[377,995,922],{}," calls the ",[377,998,937],{}," function. This is the core mechanism for capturing the protocol's revenue.",[282,1001,1002,885,1004,1006,1007,1009,1010,1012],{},[269,1003,577],{},[377,1005,937],{}," instruction calculates the surplus, mints an equivalent amount of new extension tokens, and sends them directly to a recipient token account controlled by the ",[377,1008,922],{},". The ",[377,1011,591],{}," of the extension token is now updated to reflect the newly minted fee tokens.",[266,1014,1015],{},"For end-users, their token balance remains stable and unchanged. The rewards are handled entirely behind the scenes by the protocol's administrator.",[450,1017,599],{"id":1018},"key-interface-functions-1",[266,1020,425,1021,1023],{},[377,1022,873],{}," model is a feature-complete Token-2022 token. Its unique logic is centered around a few key instructions defined in the generic Extension program.",[461,1025,609],{"id":1026},"storage-layout-1",[266,1028,1029,1030,1033,1034,672],{},"The extension's state is managed by the ",[377,1031,1032],{},"ExtGlobal"," account, which is a PDA seeded with ",[377,1035,1036],{},"b\"ext_global\"",[614,1038,1042],{"className":1039,"code":1040,"language":1041,"meta":619,"style":619},"language-rust shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F State structure from m_ext program\npub struct ExtGlobal {\n    pub admin: Pubkey,\n    pub ext_mint: Pubkey,\n    pub m_mint: Pubkey,\n    pub m_earn_global_account: Pubkey,\n    pub bump: u8,\n    pub m_vault_bump: u8,\n    pub ext_mint_authority_bump: u8,\n    pub yield_config: YieldConfig,\n    pub wrap_authorities: Vec\u003CPubkey>,\n}\n\npub struct YieldConfig {\n    pub variant: YieldVariant,     \u002F\u002F Set to YieldVariant::NoYield\n    pub last_m_index: u64,\n    pub last_ext_index: u64,\n}\n","rust",[377,1043,1044,1049,1054,1059,1064,1069,1075,1081,1087,1093,1099,1105,1110,1117,1123,1129,1135,1141],{"__ignoreMap":619},[623,1045,1046],{"class":625,"line":626},[623,1047,1048],{},"\u002F\u002F State structure from m_ext program\n",[623,1050,1051],{"class":625,"line":632},[623,1052,1053],{},"pub struct ExtGlobal {\n",[623,1055,1056],{"class":625,"line":638},[623,1057,1058],{},"    pub admin: Pubkey,\n",[623,1060,1061],{"class":625,"line":644},[623,1062,1063],{},"    pub ext_mint: Pubkey,\n",[623,1065,1066],{"class":625,"line":650},[623,1067,1068],{},"    pub m_mint: Pubkey,\n",[623,1070,1072],{"class":625,"line":1071},6,[623,1073,1074],{},"    pub m_earn_global_account: Pubkey,\n",[623,1076,1078],{"class":625,"line":1077},7,[623,1079,1080],{},"    pub bump: u8,\n",[623,1082,1084],{"class":625,"line":1083},8,[623,1085,1086],{},"    pub m_vault_bump: u8,\n",[623,1088,1090],{"class":625,"line":1089},9,[623,1091,1092],{},"    pub ext_mint_authority_bump: u8,\n",[623,1094,1096],{"class":625,"line":1095},10,[623,1097,1098],{},"    pub yield_config: YieldConfig,\n",[623,1100,1102],{"class":625,"line":1101},11,[623,1103,1104],{},"    pub wrap_authorities: Vec\u003CPubkey>,\n",[623,1106,1108],{"class":625,"line":1107},12,[623,1109,653],{},[623,1111,1113],{"class":625,"line":1112},13,[623,1114,1116],{"emptyLinePlaceholder":1115},true,"\n",[623,1118,1120],{"class":625,"line":1119},14,[623,1121,1122],{},"pub struct YieldConfig {\n",[623,1124,1126],{"class":625,"line":1125},15,[623,1127,1128],{},"    pub variant: YieldVariant,     \u002F\u002F Set to YieldVariant::NoYield\n",[623,1130,1132],{"class":625,"line":1131},16,[623,1133,1134],{},"    pub last_m_index: u64,\n",[623,1136,1138],{"class":625,"line":1137},17,[623,1139,1140],{},"    pub last_ext_index: u64,\n",[623,1142,1144],{"class":625,"line":1143},18,[623,1145,653],{},[461,1147,1149],{"id":1148},"core-rewards-function","Core Rewards Function",[279,1151,1152],{},[282,1153,1154,1157,1158,1160,1161,1164,1165,672],{},[377,1155,1156],{},"claim_fees()",": The primary instruction for capturing rewards. It calculates the total rewards accrued in the ",[377,1159,974],{}," since the last claim, mints that amount of new extension tokens, and transfers them to an admin-controlled ",[377,1162,1163],{},"recipient_ext_token_account",". This instruction can only be called by the ",[377,1166,922],{},[461,1168,685],{"id":1169},"management-functions-1",[279,1171,1172,1180,1188,1196],{},[282,1173,1174,1179],{},[269,1175,1176],{},[377,1177,1178],{},"initialize(wrap_authorities: Vec\u003CPubkey>)",": Sets up the extension's global state with the NoYield configuration.",[282,1181,1182,1187],{},[269,1183,1184],{},[377,1185,1186],{},"add_wrap_authority(new_wrap_authority: Pubkey)",": Adds a new address to the list of authorized wrappers.",[282,1189,1190,1195],{},[269,1191,1192],{},[377,1193,1194],{},"remove_wrap_authority(wrap_authority: Pubkey)",": Removes an address from the list of authorized wrappers.",[282,1197,1198,1203],{},[269,1199,1200],{},[377,1201,1202],{},"transfer_admin(new_admin: Pubkey)",": Transfers admin control to a new address.",[461,1205,1207],{"id":1206},"standard-extension-functions","Standard Extension Functions",[266,1209,1210],{},"The contract inherits essential functionalities for interacting with the M0 ecosystem:",[279,1212,1213,1223],{},[282,1214,1215,1220,1221,672],{},[269,1216,1217],{},[377,1218,1219],{},"wrap(amount: u64)",": Wraps into the extension token. Requires the caller to be a whitelisted ",[377,1222,951],{},[282,1224,1225,1230,1231,672],{},[269,1226,1227],{},[377,1228,1229],{},"unwrap(amount: u64)",": Unwraps the extension token. Requires the caller to be a whitelisted ",[377,1232,951],{},[461,1234,1236],{"id":1235},"error-handling","Error Handling",[266,1238,1239],{},"The contract includes robust error handling to ensure secure operation:",[279,1241,1242,1248,1254],{},[282,1243,1244,1247],{},[377,1245,1246],{},"Unauthorized",": Thrown if a non-admin tries to call a privileged instruction.",[282,1249,1250,1253],{},[377,1251,1252],{},"InvalidAmount",": Thrown for invalid wrap or unwrap amounts.",[282,1255,1256,1259],{},[377,1257,1258],{},"InsufficientCollateral",": Ensures the contract never mints more extension tokens than its underlying balance.",[266,1261,1262,408,1265],{},[269,1263,1264],{},"Ready to build?",[414,1266,1267],{"href":136},[269,1268,1269],{},"Follow the implementation guide to deploy your NoYield extension.",[1271,1272,1273],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":619,"searchDepth":626,"depth":632,"links":1275},[1276,1277,1281],{"id":297,"depth":632,"text":298},{"id":421,"depth":632,"text":422,"children":1278},[1279,1280],{"id":452,"depth":638,"text":453},{"id":598,"depth":638,"text":599},{"id":867,"depth":632,"text":868,"children":1282},[1283,1284],{"id":905,"depth":638,"text":453},{"id":1018,"depth":638,"text":599},"Deep dive into the Treasury Model template where all accrued rewards are captured by the use case owner.","md",null,{},{"title":131,"description":1285},"mJoa2MNjyvQeySJjUFTcf1X5kuUfsz6xgmBLJQa0a3A",[1292,1294],{"title":131,"path":143,"stem":144,"description":1293,"children":-1},"Deep dive into the JMI (\"Just Mint It\") extension template which accepts multiple collateral types while directing 100% of rewards to a single recipient.",{"title":154,"path":155,"stem":156,"description":1295,"children":-1},"M0's Onchain Orchestration provides seamless access to liquidity for M0-powered stablecoin across multiple chains."]