PageSourceSearch

https://opentezos.com/assets/js/d3c71d96.b50bdf80.js

js opentezos.com collected 2026-10-02 07:02:18 UTC 7,444 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkopentezos=self.webpackChunkopentezos||[]).push([[6948],{15680:(e,t,a)=>{a.d(t,{xA:()=>c,yg:()=>y});var n=a(96540);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},g="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),g=s(a),u=r,y=g["".concat(p,".").concat(u)]||g[u]||m[u]||o;return a?n.createElement(y,i(i({ref:t},c),{},{components:a})):n.createElement(y,i({ref:t},c))}));function y(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=u;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[g]="string"==typeof e?e:r,i[1]=l;for(var s=2;s<o;s++)i[s]=a[s];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}u.displayName="MDXCreateElement"},61781:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var n=a(58168),r=(a(96540),a(15680));const o={id:"take-away",title:"Take Away",authors:"Maxime Sallerin, Benjamin Pilia and Frank Hillard"},i=void 0,l={unversionedId:"ligo/take-away/take-away",id:"ligo/take-away/take-away",title:"Take Away",description:"- LIGO is a programming language for writing Tezos smart contracts.",source:"@site/prebuild/ligo/take-away/take-away.md",sourceDirName:"ligo/take-away",slug:"/ligo/take-away/",permalink:"/ligo/take-away/",draft:!1,editUrl:"https://gitlab.com/tezos-paris-hub/opentezos/-/blob/main/prebuild/ligo/take-away/take-away.md",tags:[],version:"current",frontMatter:{id:"take-away",title:"Take Away",authors:"Maxime Sallerin, Benjamin Pilia and Frank Hillard"},sidebar:"docs",previous:{title:"More examples",permalink:"/ligo/examples/"},next:{title:"Introduction",permalink:"/michelson"}},p={},s=[{value:"To go further",id:"to-go-further",level:2}],c={toc:s},g="wrapper";
1function m(e){let{components:t,...o}=e;return(0,r.yg)(g,(0,n.A)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"LIGO is a programming language for writing ",(0,r.yg)("strong",{parentName:"p"},"Tezos smart contracts"),".")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"LIGO ",(0,r.yg)("strong",{parentName:"p"},"compiles")," scripts written in a high-level language into ",(0,r.yg)("strong",{parentName:"p"},"Michelson script"),".")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"A smart contract is some code written in Michelson language (a low-level stack-based Turing-complete language)."),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},"It defines all the ",(0,r.yg)("strong",{parentName:"li"},"entrypoints")," (invokable functions) of the smart contract."),(0,r.yg)("li",{parentName:"ul"},"It defines the prototype of each entry point (e.g. specifies the parameters types of the entry point)."),(0,r.yg)("li",{parentName:"ul"},"It defines the ",(0,r.yg)("strong",{parentName:"li"},"storage")," of the smart contract."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"The storage")," is an allocated memory space associated with a smart contract.\nThe description of the storage is done by strongly typing the data structure.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Entrypoints")," of a smart contract describe how to mutate the storage.\nExecuting an entry point takes some of the parameters and a state of the storage\nand returns a new state of storage and some operations."))),(0,r.yg)("br",null),(0,r.yg)("p",null,(0,r.yg)("img",{alt:"Smart contract inputs: entrypoint, parameter and storage. Smart contract outputs: operations and modified storage",src:a(2061).A,width:"673",height:"132"})),(0,r.yg)("small",{className:"figure"},"FIGURE 1 Smart Contract"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"LIGO functions are the basic building block of smart contracts.\nEach ",(0,r.yg)("strong",{parentName:"p"},"entrypoint")," of a contract is a ",(0,r.yg)("strong",{parentName:"p"},"function"),"\nand each smart contract must have at least one ",(0,r.yg)("strong",{parentName:"p"},"main function"),"\nthat dispatches the control flow to other functions.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"The ",(0,r.yg)("strong",{parentName:"p"},"option type")," is used to express if there is a value, of some type, or none.\nThis is especially useful when calling a partial function, that is, a function that is not defined for specific inputs.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"The keyword ",(0,r.yg)("inlineCode",{parentName:"p"},"failwith(<string_message>)")," throws an exception and stop the execution of the smart contract.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"You can transfer tez to an account, or to the function of another smart contract, with ",(0,r.yg)("inlineCode",{parentName:"p"},"Tezos.transaction(<parameter>, <mutez>, <contract>)")))),(0,r.yg)("h2",{id:"to-go-further"},"To go further"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"You can go to the ",(0,r.yg)("a",{parentName:"p",href:"https://academy.ligolang.org/js/chapter-about"},"Tezos Academy"),"\nwhich is a fun interactive tutorial on the LIGO language.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"You can go to ",(0,r.yg)("a",{parentName:"p",href:"https://ligolang.org/"},"Ligolang"),"\nand try your hand at their ",(0,r.yg)("a",{parentName:"p",href:"https://ide.ligolang.org/"},"IDE online"),".")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"You can check the smart contract\nexample ",(0,r.yg)("a",{parentName:"p",href:"https://github.com/frankhillard/ligo_tutorial_fundadvisor"},"FundAdvisor")," with explanatory videos."))))}m.isMDXComponent=!0},2061:(e,t,a)=>{a.d(t,{A:()=>n});const n=a.p+"assets/images/smart_contract-60cf30eef28cd3097505d46992b28ced.svg"}}]);

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.