CINXE.COM
<!doctype html> <html lang="en" dir="ltr" class="docs-wrapper plugin-docs plugin-id-default docs-version-current docs-doc-page docs-doc-id-tokens/stellar-asset-contract" data-has-hydrated="false"> <head> <meta charset="UTF-8"> <meta name="generator" content="Docusaurus v3.7.0"> <title data-rh="true">Use Issued Assets in Smart Contracts with the Stellar Asset Contract (SAC) | Stellar Docs</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:image" content="https://developers.stellar.org/img/docusaurus/dev-docs-preview.png"><meta data-rh="true" name="twitter:image" content="https://developers.stellar.org/img/docusaurus/dev-docs-preview.png"><meta data-rh="true" property="og:url" content="https://developers.stellar.org/docs/tokens/stellar-asset-contract"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" property="og:locale:alternate" content="es"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="Use Issued Assets in Smart Contracts with the Stellar Asset Contract (SAC) | Stellar Docs"><meta data-rh="true" name="description" content="Learn to make payments and interact with assets issued on the Stellar network in smart contracts using the Stellar Asset Contract (SAC), a built-in contract."><meta data-rh="true" property="og:description" content="Learn to make payments and interact with assets issued on the Stellar network in smart contracts using the Stellar Asset Contract (SAC), a built-in contract."><link data-rh="true" rel="icon" href="/img/docusaurus/favicon-96x96.png"><link data-rh="true" rel="canonical" href="https://developers.stellar.org/docs/tokens/stellar-asset-contract"><link data-rh="true" rel="alternate" href="https://developers.stellar.org/docs/tokens/stellar-asset-contract" hreflang="en"><link data-rh="true" rel="alternate" href="https://developers.stellar.org/es/docs/tokens/stellar-asset-contract" hreflang="es"><link data-rh="true" rel="alternate" href="https://developers.stellar.org/docs/tokens/stellar-asset-contract" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://VNSJF5AWIZ-dsn.algolia.net" crossorigin="anonymous"><link rel="alternate" type="application/rss+xml" href="/meetings/rss.xml" title="Stellar Docs RSS Feed"> <link rel="alternate" type="application/atom+xml" href="/meetings/atom.xml" title="Stellar Docs Atom Feed"> <link rel="preconnect" href="https://www.google-analytics.com"> <link rel="preconnect" href="https://www.googletagmanager.com"> <script async src="https://www.googletagmanager.com/gtag/js?id=G-ZCT4GYX8KN"></script> <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-ZCT4GYX8KN",{anonymize_ip:!0})</script> <link rel="search" type="application/opensearchdescription+xml" title="Stellar Docs" href="/opensearch.xml"> <script crossorigin="anonymous" src="https://js.sentry-cdn.com/efc31f19f9c54082b8d993bfb62eee57.min.js"></script> <script>!function(e,t,a,n){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var g=t.getElementsByTagName(a)[0],m=t.createElement(a);m.async=!0,m.src="https://www.googletagmanager.com/gtm.js?id=GTM-M2JLH37",g.parentNode.insertBefore(m,g)}(window,document,"script","dataLayer")</script> <meta name="facebook-domain-verification" content="d0o7hha86jfxvtqyxz3d9i5wtfanmy"> <link rel="preconnect" href="https://dev.visualwebsiteoptimizer.com"> <script id="vwoCode">window._vwo_code||function(){var e=814004,t=!1,n=window,i=document,o=i.querySelector("#vwoCode"),r="_vwo_"+e+"_settings",s={};try{var a=JSON.parse(localStorage.getItem("_vwo_"+e+"_config"));s=a&&"object"==typeof a?a:{}}catch(e){}var d="session"===s.stT?n.sessionStorage:n.localStorage;code={nonce:o&&o.nonce,use_existing_jquery:function(){return"undefined"!=typeof use_existing_jquery?use_existing_jquery:void 0},library_tolerance:function(){return"undefined"!=typeof library_tolerance?library_tolerance:void 0},settings_tolerance:function(){return s.sT||2e3},hide_element_style:function(){return"{"+(s.hES||"opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;transition:none !important;")+"}"},hide_element:function(){return performance.getEntriesByName("first-contentful-paint")[0]?"":"string"==typeof s.hE?s.hE:"body"},getVersion:function(){return 2.1},finish:function(n){if(!t){t=!0;var o=i.getElementById("_vis_opt_path_hides");o&&o.parentNode.removeChild(o),n&&((new Image).src="https://dev.visualwebsiteoptimizer.com/ee.gif?a="+e+n)}},finished:function(){return t},addScript:function(e){var t=i.createElement("script");t.type="text/javascript",e.src?t.src=e.src:t.text=e.text,o&&t.setAttribute("nonce",o.nonce),i.getElementsByTagName("head")[0].appendChild(t)},load:function(e,t){var o=this.getSettings(),s=i.createElement("script");if(t=t||{},o)s.textContent=o,i.getElementsByTagName("head")[0].appendChild(s),n.VWO&&!VWO.caE||(d.removeItem(r),this.load(e));else{var a=new XMLHttpRequest;a.open("GET",e,!0),a.withCredentials=!t.dSC,a.responseType=t.responseType||"text",a.onload=function(){if(t.onloadCb)return t.onloadCb(a,e);200===a.status||304===a.status?_vwo_code.addScript({text:a.responseText}):_vwo_code.finish("&e=loading_failure:"+e)},a.onerror=function(){if(t.onerrorCb)return t.onerrorCb(e);_vwo_code.finish("&e=loading_failure:"+e)},a.send()}},getSettings:function(){try{var e=d.getItem(r);if(!e)return;return e=JSON.parse(e),Date.now()>e.e?void d.removeItem(r):e.s}catch(e){return}},init:function(){if(!(i.URL.indexOf("__vwo_disable__")>-1)){var t,s=this.settings_tolerance();if(n._vwo_settings_timer=setTimeout((function(){_vwo_code.finish(),d.removeItem(r)}),s),"body"!==this.hide_element()){t=i.createElement("style");var a=this.hide_element(),c=a?a+this.hide_element_style():"",_=i.getElementsByTagName("head")[0];t.setAttribute("id","_vis_opt_path_hides"),o&&t.setAttribute("nonce",o.nonce),t.setAttribute("type","text/css"),t.styleSheet?t.styleSheet.cssText=c:t.appendChild(i.createTextNode(c)),_.appendChild(t)}else{t=i.getElementsByTagName("head")[0],(c=i.createElement("div")).style.cssText="z-index: 2147483647 !important;position: fixed !important;left: 0 !important;top: 0 !important;width: 100% !important;height: 100% !important;background: white !important;display: block !important;",c.setAttribute("id","_vis_opt_path_hides"),c.classList.add("_vis_hide_layer"),t.parentNode.insertBefore(c,t.nextSibling)}var l=window._vis_opt_url||i.URL,p="https://dev.visualwebsiteoptimizer.com/j.php?a="+e+"&u="+encodeURIComponent(l)+"&vn=2.1";-1!==n.location.search.indexOf("_vwo_xhr")?this.addScript({src:p}):this.load(p+"&x=true")}}},n._vwo_code=code,code.init()}()</script> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v6.5.2/css/all.css"><link rel="stylesheet" href="/assets/css/styles.888e9809.css"> <script src="/assets/js/runtime~main.6f165b31.js" defer="defer"></script> <script src="/assets/js/main.5d22bbbd.js" defer="defer"></script> </head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return window.localStorage.getItem("theme")}catch(t){}}();t(null!==e?e:"light")}(),function(){try{const a=new URLSearchParams(window.location.search).entries();for(var[t,e]of a)if(t.startsWith("docusaurus-data-")){var n=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(n,e)}}catch(t){}}(),document.documentElement.setAttribute("data-announcement-bar-initially-dismissed",function(){try{return"true"===localStorage.getItem("docusaurus.announcement.dismiss")}catch(t){}return!1}())</script> <script>"function"==typeof window.ga&&(window.ga("require","linker"),window.ga("linker:autolink",["www.stellar.org","stellar.org"]))</script> <noscript> <iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M2JLH37" height="0" width="0" style="display:none;visibility:hidden"></iframe> </noscript><div id="__docusaurus"><link rel="preload" as="image" href="/img/docusaurus/stellar-logo.svg"><link rel="preload" as="image" href="/img/docusaurus/stellar-logo-dark.svg"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="/img/docusaurus/stellar-logo.svg" alt="Stellar Docs" class="themedComponent_mlkZ themedComponent--light_NVdE" width="100"><img src="/img/docusaurus/stellar-logo-dark.svg" alt="Stellar Docs" class="themedComponent_mlkZ themedComponent--dark_xIcU" width="100"></div></a><a class="navbar__item navbar__link" href="/docs/build">Build</a><a class="navbar__item navbar__link" href="/docs/learn/fundamentals">Learn</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/docs/tokens">Tokens</a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link" aria-haspopup="true" aria-expanded="false" role="button" href="/docs/data">Data</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/docs/data">Overview</a></li><li class="subtitle"><hr><a href="/docs/data/analytics" class="subtitle"><small>Analytics</small></a></li><li><a class="dropdown__link" href="/docs/data/analytics/hubble">Hubble</a></li><li><a class="dropdown__link" href="/docs/data/analytics/analytics-providers">Providers</a></li><li class="subtitle"><hr><a href="/docs/data/apis" class="subtitle"><small>API</small></a></li><li><a class="dropdown__link" href="/docs/data/apis/rpc">RPC</a></li><li><a class="dropdown__link" href="/docs/data/apis/horizon">Horizon</a></li><li><a class="dropdown__link" href="/docs/data/apis/migrate-from-horizon-to-rpc">Migrate Horizon to RPC</a></li><li><a class="dropdown__link" href="/docs/data/apis/api-providers">Providers</a></li><li class="subtitle"><hr><a href="/docs/data/indexers" class="subtitle"><small>Indexers</small></a></li><li><a class="dropdown__link" href="/docs/data/indexers/build-your-own">Build Your Own</a></li><li><a class="dropdown__link" href="/docs/data/indexers/indexer-providers">Providers</a></li><li class="subtitle"><hr><a href="/docs/data/oracles" class="subtitle"><small>Oracles</small></a></li><li><a class="dropdown__link" href="/docs/data/oracles/oracle-providers">Providers</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link" aria-haspopup="true" aria-expanded="false" role="button" href="/docs/tools">Tools</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/docs/tools/sdks">SDKs</a></li><li><a class="dropdown__link" href="/docs/tools/developer-tools">Developer Tools</a></li><li class="subtitle"><hr><small>SDF Platforms</small></li><li><a class="dropdown__link" href="/platforms/anchor-platform">Anchor Platform</a></li><li><a class="dropdown__link" href="/platforms/stellar-disbursement-platform">Stellar Disbursement Platform</a></li></ul></div><a class="navbar__item navbar__link" href="/docs/networks">Networks</a><a class="navbar__item navbar__link" href="/docs/validators">Validators</a></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link" href="/meetings">Meetings</a><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link"><svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" class="iconLanguage_nlXk"><path fill="currentColor" d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path></svg>English</a><ul class="dropdown__menu"><li><a href="/docs/tokens/stellar-asset-contract" target="_self" rel="noopener noreferrer" class="dropdown__link dropdown__link--active" lang="en">English</a></li><li><a href="/es/docs/tokens/stellar-asset-contract" target="_self" rel="noopener noreferrer" class="dropdown__link" lang="es">Español</a></li></ul></div><a href="https://github.com/stellar/stellar-docs" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link header-github-link" aria-label="GitHub"></a><a href="https://discord.gg/stellardev" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link header-discord-link" aria-label="Discord"></a><div class="toggle_vylO colorModeToggle_DEke"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite" aria-pressed="false"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="navbarSearchContainer_Bca1"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search (Command+K)"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20" aria-hidden="true"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0"><div class="docsWrapper_hBAB"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docRoot_UBD9"><aside class="theme-doc-sidebar-container docSidebarContainer_YfHR"><div class="sidebarViewport_aRkj"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG menuWithAnnouncementBar_GW3s"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/tokens">Inroduction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/tokens/anatomy-of-an-asset">Assets Overview</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/tokens/quickstart">Quickstart</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/tokens/control-asset-access">Asset Design Considerations</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" href="/docs/tokens/stellar-asset-contract">Stellar Asset Contract</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/tokens/token-interface">Token Interface</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/tokens/how-to-issue-an-asset">Issue an Asset Tutorial</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/tokens/publishing-asset-info">Publish Information About An Asset</a></li></ul></nav></div></div></aside><main class="docMainContainer_TBSr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_xLCN"><div class="docItemContainer_jfFK"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_YNFT"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">Stellar Asset Contract</span><meta itemprop="position" content="1"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><div class="row"><div class="col col--12 markdown"><header><h1>Stellar Asset Contract (SAC)</h1></header> <p>The Stellar Asset Contract (SAC) is an implementation of <a href="https://github.com/stellar/stellar-protocol/blob/master/core/cap-0046-06.md" target="_blank" rel="noopener noreferrer">CAP-46-6 Smart Contract Standardized Asset</a> and <a href="/docs/tokens/token-interface">SEP-41 Token Interface</a> for Stellar <a href="/docs/learn/fundamentals/stellar-data-structures/assets">assets</a>.</p> <p>See examples of how to use the SAC in the <a href="/docs/build/guides/tokens">Tokens How-To Guides</a>.</p> <h2 class="anchor anchorWithStickyNavbar_LWe7" id="overview">Overview<a href="#overview" class="hash-link" aria-label="Direct link to Overview" title="Direct link to Overview"></a></h2> <div class="theme-admonition theme-admonition-note admonition_xJq3 alert alert--secondary"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>note</div><div class="admonitionContent_BuS1"><p>Stellar assets are issued by Stellar accounts. Issue an asset on Stellar by following the <a href="/docs/tokens/how-to-issue-an-asset">Issue an Asset Tutorial</a>.</p></div></div> <p>The Stellar Asset Contract allows users and contracts to make payments with, and interact with, assets. The SAC can interact with assets held by Stellar accounts or contracts.</p> <p>The SAC is a special built-in contract that has access to functionality of the Stellar network that allows it to use Stellar assets directly.</p> <p>Each Stellar asset has an instance of the SAC reserved on the network. To use the SAC reserved for an asset, the instance just needs to be deployed.</p> <p>When the SAC transfers assets between accounts, the same debit and credits occur as they do when a Stellar payment operation is used, because the SAC interacts directly with Stellar account trust lines. When the SAC transfers assets between contracts, it uses Contract Data ledger entries to store the balances for contracts.</p> <p>Stellar account balances for the native asset are always stored on the account, and Stellar contract balances for the native asset are always stored in a contract data entry.</p> <p>Stellar account balances for issued assets are always stored in trust lines, and Stellar contract balances for issued assets are always stored in a contract data entry.</p> <p>For example, when transferring from a Stellar account to a Stellar contract, the Stellar account's trust line entry is debited, and a contract data entry is credited.</p> <p>And for example, when transferring from a Stellar contract to a Stellar account, a contract data entry is debited, and the account's trust line entry is credited.</p> <p>In both those examples it is a single asset that is transferring from the account to the contract and back again. No bridging is required and no intermediary tokens are needed. An asset on Stellar and it's Stellar Asset Contract represent the same asset. The SAC for an asset is simply an API for interacting with the asset.</p> <p>The SAC implements the <a href="/docs/tokens/token-interface">SEP-41 Token Interface</a>, which is similar to the widely used ERC-20 token standard. Contracts that depend on only the SEP-41 portion of the SAC's interface, are also compatible with any custom token that implements SEP-41.</p> <p>Some functionality available on the Stellar network in transaction operations, such as the order book, do not have any functions exposed on the Stellar Asset Contract in the current protocol.</p> <h2 class="anchor anchorWithStickyNavbar_LWe7" id="deployment">Deployment<a href="#deployment" class="hash-link" aria-label="Direct link to Deployment" title="Direct link to Deployment"></a></h2> <p>Every Stellar asset on Stellar has reserved a contract address that the Stellar Asset Contract can be deployed to. Anyone can initiate the deploy and the Stellar asset issuer does not need to be involved.</p> <p>It can be deployed using the <a href="/docs/tools/developer-tools/cli/stellar-cli">Stellar CLI</a> as shown <a href="/docs/build/guides/cli/deploy-stellar-asset-contract">here</a>.</p> <p>Or the <a href="/docs/tools/sdks">Stellar SDK</a> can be used as shown <a href="/docs/learn/encyclopedia/contract-development/contract-interactions/stellar-transaction#xdr-usage">here</a> by calling <code>InvokeHostFunctionOp</code> with <code>HOST_FUNCTION_TYPE_CREATE_CONTRACT</code> and <code>CONTRACT_ID_FROM_ASSET</code>. The resulting token will have a deterministic identifier, which will be the sha256 hash of <code>HashIDPreimage::ENVELOPE_TYPE_CONTRACT_ID_FROM_ASSET</code> xdr specified <a href="https://github.com/stellar/stellar-xdr/blob/dc23adf60e095a6ce626b2b09128e58a5eae0cd0/Stellar-transaction.x#L661" target="_blank" rel="noopener noreferrer">here</a>.</p> <p>Anyone can deploy the instances of Stellar Asset Contract. Note, that the initialization of the Stellar Asset Contracts happens automatically during the deployment. Asset Issuer will have the administrative permissions after the contract has been deployed.</p> <h2 class="anchor anchorWithStickyNavbar_LWe7" id="interacting-with-classic-stellar-assets">Interacting with classic Stellar assets<a href="#interacting-with-classic-stellar-assets" class="hash-link" aria-label="Direct link to Interacting with classic Stellar assets" title="Direct link to Interacting with classic Stellar assets"></a></h2> <p>The Stellar Asset Contract is the only way for contracts to interact with Stellar assets, either the native XLM asset, or those issued by Stellar accounts.</p> <p>The issuer of the asset will be the administrator of the deployed contract. Because the Native Stellar token doesn't have an issuer, it will not have an administrator either. It also cannot be burned.</p> <p>After the contract has been deployed, users can use their classic account (for lumens) or trustline (for other assets) balance. There are some differences depending on if you are using a classic account <code>Address</code> vs a contract <code>Address</code> (corresponding either to a regular contract or to a custom account contract). The following section references some issuer and trustline flags from Stellar classic, which you can learn more about <a href="/docs/tokens/control-asset-access#controlling-access-to-an-asset-with-flags">here</a>.</p> <ul> <li>Using <code>Address::Account</code> <ul> <li>The balance must exist in a trustline (or an account for the native balance). This means the contract will not store the balance in ContractData. If the trustline or account is missing, any function that tries to interact with that balance will fail.</li> <li>Classic trustline semantics will be followed.<!-- --> <ul> <li>Transfers will only succeed if the corresponding trustline(s) have the <code>AUTHORIZED_FLAG</code> set.</li> <li>A trustline balance can only be clawed back using the <code>clawback</code> contract function if the trustline has <code>TRUSTLINE_CLAWBACK_ENABLED_FLAG</code> set.</li> <li>Transfers to the issuer account will burn the token, while transfers from the issuer account will mint.</li> <li>Trustline balances are stored in a 64-bit signed integer even though the interface accepts 128-bit signed integers. Any operation that attempts to send or receive an amount more than the maximum amount that can be represented by a 64-bit signed integer will fail.</li> </ul> </li> </ul> </li> <li>Using <code>Address::Contract</code> <ul> <li>The balance and authorization state will be stored in contract storage, as opposed to a trustline.</li> <li>Balances are stored in a 128-bit signed integer.</li> <li>A balance can only be clawed back if the issuer account had the <code>AUTH_CLAWBACK_ENABLED_FLAG</code> set when the balance was created. A balance is created when either an <code>Address::Contract</code> is on the receiving end of a successful transfer, or if the admin sets the authorization state. Read more about <code>AUTH_CLAWBACK_ENABLED_FLAG</code> <a href="/docs/tokens/control-asset-access#clawback-enabled-0x8">here</a>.</li> </ul> </li> </ul> <h3 class="anchor anchorWithStickyNavbar_LWe7" id="balance-authorization-required">Balance Authorization Required<a href="#balance-authorization-required" class="hash-link" aria-label="Direct link to Balance Authorization Required" title="Direct link to Balance Authorization Required"></a></h3> <p>In the <code>Address::Contract</code> case, if the issuer has <code>AUTH_REQUIRED_FLAG</code> set, then the specified <code>Address::Contract</code> will need to be explicitly authorized with <code>set_auth</code> before it can receive a balance. This logic lines up with how trustlines interact with the <code>AUTH_REQUIRED_FLAG</code> issuer flag, allowing asset issuers to have the same control in Soroban as they do in Stellar classic. Read more about <code>AUTH_REQUIRED_FLAG</code> <a href="/docs/tokens/control-asset-access#authorization-required-0x1">here</a>.</p> <h3 class="anchor anchorWithStickyNavbar_LWe7" id="revoking-authorization">Revoking Authorization<a href="#revoking-authorization" class="hash-link" aria-label="Direct link to Revoking Authorization" title="Direct link to Revoking Authorization"></a></h3> <p>The admin can only revoke authorization from an <code>Address</code>, if the issuer of the asset has <code>AUTH_REVOCABLE_FLAG</code> set. The deauthorization will fail if the issuer is missing. This requirement is true for both the trustline balances of <code>Address::Account</code> and contract balances of <code>Address:Contract</code>. Note that when a trustline is deauthorized from Soroban, <code>AUTHORIZED_FLAG</code> is cleared and <code>AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG</code> is set to avoid having to pull offers and redeeming pool shares.</p> <h2 class="anchor anchorWithStickyNavbar_LWe7" id="authorization-semantics">Authorization semantics<a href="#authorization-semantics" class="hash-link" aria-label="Direct link to Authorization semantics" title="Direct link to Authorization semantics"></a></h2> <p>See the <a href="/docs/learn/encyclopedia/security/authorization">authorization overview</a> and <a href="/docs/build/smart-contracts/example-contracts/auth">auth example</a> for general information about authorization in Soroban.</p> <p>The token contract contains three kinds of operations that follow the token <a href="/docs/tokens/token-interface#code">interface</a>:</p> <ul> <li>getters, such as <code>balance</code>, which do not change the state of the contract</li> <li>unprivileged mutators, such as <code>incr_allow</code> and <code>xfer</code>, which change the state of the contract but do not require special privileges</li> <li>privileged mutators, such as <code>clawback</code> and <code>set_admin</code>, which change the state of the contract but require special privileges</li> </ul> <p>Getters require no authorization because they do not change the state of the contract and all contract data is public. For example, <code>balance</code> simply returns the balance of the specified <code>Address</code> without changing it.</p> <p>Unprivileged mutators require authorization from the <code>Address</code> that spends or allows spending their balance. The exceptions are <code>xfer_from</code> and <code>burn_from</code> operations where the <code>Address</code> that require authorization from the 'spender' entity that has got an allowance from another <code>Address</code> beforehand.</p> <p>Priviliged mutators require authorization from a specific privileged identity, known as the "administrator". For example, only the administrator can <code>mint</code> more of the token. Similarly, only the administrator can appoint a new administrator.</p> <h2 class="anchor anchorWithStickyNavbar_LWe7" id="contract-interface">Contract Interface<a href="#contract-interface" class="hash-link" aria-label="Direct link to Contract Interface" title="Direct link to Contract Interface"></a></h2> <p>This interface can be found in the <a href="https://docs.rs/soroban-sdk/latest/soroban_sdk/token/index.html" target="_blank" rel="noopener noreferrer">SDK</a>. It extends the common <a href="/docs/tokens/token-interface">SEP-41 Token Interface</a>.</p></div></div></div><div class="row"><div class="col col--12"><footer class="theme-doc-footer docusaurus-mt-lg"><div class="row margin-top--sm theme-doc-footer-edit-meta-row"><div class="col"><a href="https://github.com/stellar/stellar-docs/edit/main/docs/tokens/stellar-asset-contract.mdx" target="_blank" rel="noopener noreferrer" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_JAkA"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2025-02-18T21:29:52.000Z" itemprop="dateModified">Feb 18, 2025</time></b> by <b>Bri Wylde</b></span></div></div></footer></div></div></article><div class="row"><div class="col col--12"><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages"><a class="pagination-nav__link pagination-nav__link--prev" href="/docs/tokens/control-asset-access"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Asset Design Considerations</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/docs/tokens/token-interface"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Token Interface</div></a></nav></div></div></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li><li><a href="#deployment" class="table-of-contents__link toc-highlight">Deployment</a></li><li><a href="#interacting-with-classic-stellar-assets" class="table-of-contents__link toc-highlight">Interacting with classic Stellar assets</a><ul><li><a href="#balance-authorization-required" class="table-of-contents__link toc-highlight">Balance Authorization Required</a></li><li><a href="#revoking-authorization" class="table-of-contents__link toc-highlight">Revoking Authorization</a></li></ul></li><li><a href="#authorization-semantics" class="table-of-contents__link toc-highlight">Authorization semantics</a></li><li><a href="#contract-interface" class="table-of-contents__link toc-highlight">Contract Interface</a></li></ul></div></div></div></div></main></div></div></div><footer class="footer"><div class="container container-fluid"><div class="row footer__links"><div class="col footer__col"><div class="footer__title">Resources</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://www.stellar.org/developers-blog" target="_blank" rel="noopener noreferrer" class="footer__link-item">Developer Blog<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://quest.stellar.org/" target="_blank" rel="noopener noreferrer" class="footer__link-item">Stellar Quest<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://fastcheapandoutofcontrol.com/tutorial" target="_blank" rel="noopener noreferrer" class="footer__link-item">Soroban Quest<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://www.youtube.com/@StellarDevelopmentFoundation" target="_blank" rel="noopener noreferrer" class="footer__link-item">YouTube<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://m.twitch.tv/stellarorg/home" target="_blank" rel="noopener noreferrer" class="footer__link-item">Twitch<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="col footer__col"><div class="footer__title">Tools</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://stellar.expert" target="_blank" rel="noopener noreferrer" class="footer__link-item">Explorer<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://lab.stellar.org" target="_blank" rel="noopener noreferrer" class="footer__link-item">Lab<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://status.stellar.org/" target="_blank" rel="noopener noreferrer" class="footer__link-item">Status<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://dashboard.stellar.org/" target="_blank" rel="noopener noreferrer" class="footer__link-item">Dashboard<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://developers.stellar.org/docs/tools/developer-tools" target="_blank" rel="noopener noreferrer" class="footer__link-item">All Tools<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="col footer__col"><div class="footer__title">Community</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://github.com/stellar/stellar-docs?tab=readme-ov-file#contributing" target="_blank" rel="noopener noreferrer" class="footer__link-item">Contribute to Docs<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://discord.gg/stellardev" target="_blank" rel="noopener noreferrer" class="footer__link-item">Developer Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://groups.google.com/g/stellar-dev" target="_blank" rel="noopener noreferrer" class="footer__link-item">Developer Google Group<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://stellar.stackexchange.com/" target="_blank" rel="noopener noreferrer" class="footer__link-item">Stack Exchange<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://communityfund.stellar.org/" target="_blank" rel="noopener noreferrer" class="footer__link-item">Stellar Community Fund<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="col footer__col"><div class="footer__title">About</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://stellar.org/foundation" target="_blank" rel="noopener noreferrer" class="footer__link-item">About SDF<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://stellar.org/foundation/careers" target="_blank" rel="noopener noreferrer" class="footer__link-item">Careers<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://stellar.org/events" target="_blank" rel="noopener noreferrer" class="footer__link-item">Events<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://stellar.org/foundation/grants-and-funding" target="_blank" rel="noopener noreferrer" class="footer__link-item">Grants & Funding<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div></div></footer></div> </body> </html>